adjust message and variable with snmp-mqtt

This commit is contained in:
Wolfgang Hottgenroth 2025-02-10 13:54:08 +01:00
parent c05cf671cf
commit 64dba890dd

View File

@ -12,14 +12,15 @@ import (
)
type variable_t struct {
Name string `json:"variable"`
Label string `json:"label"`
Variable string `json:"variable"`
Value float64 `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 +33,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,7 +49,8 @@ func Start() {
}
v := variable_t {
Name: label,
Label: label,
Variable: "",
Value: value,
Unit: "ms",
Status: status,