Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
553648e10d | |||
64dba890dd |
@ -3,6 +3,7 @@ package tsmq
|
||||
import (
|
||||
"log"
|
||||
"time"
|
||||
"strconv"
|
||||
"encoding/json"
|
||||
|
||||
"tsm/config"
|
||||
@ -12,14 +13,15 @@ import (
|
||||
)
|
||||
|
||||
type variable_t struct {
|
||||
Name string `json:"variable"`
|
||||
Value float64 `json:"value"`
|
||||
Label string `json:"label"`
|
||||
Variable string `json:"variable"`
|
||||
Value string `json:"value"`
|
||||
Unit string `json:"unit"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type message_t struct {
|
||||
Server string `json:"server"`
|
||||
Device string `json:"device"`
|
||||
Label string `json:"label"`
|
||||
Variables map[string]variable_t `json:"variables"`
|
||||
}
|
||||
@ -32,7 +34,7 @@ func Start() {
|
||||
log.Println("Polling server " + server.Name)
|
||||
|
||||
message := message_t {
|
||||
Server: server.Name,
|
||||
Device: server.Name,
|
||||
Label: server.Label,
|
||||
Variables: make(map[string]variable_t),
|
||||
}
|
||||
@ -48,8 +50,9 @@ func Start() {
|
||||
}
|
||||
|
||||
v := variable_t {
|
||||
Name: label,
|
||||
Value: value,
|
||||
Label: label,
|
||||
Variable: "",
|
||||
Value: strconv.FormatFloat(value, 'f', 4, 64)
|
||||
Unit: "ms",
|
||||
Status: status,
|
||||
}
|
||||
|
Reference in New Issue
Block a user