stratum
This commit is contained in:
parent
101072eabc
commit
38d35c1e79
@ -39,24 +39,31 @@ func Start() {
|
||||
Variables: make(map[string]variable_t),
|
||||
}
|
||||
|
||||
label := "rootdisp"
|
||||
status := "Ok"
|
||||
value := 0.0
|
||||
rootdisp := 0.0
|
||||
stratum := 0
|
||||
resp, err := ntp.Query(server.Name)
|
||||
if err != nil {
|
||||
status = "Error"
|
||||
} else {
|
||||
value = resp.RootDispersion.Seconds() * 1000
|
||||
rootdisp = resp.RootDispersion.Seconds() * 1000
|
||||
stratum = resp.Stratum()
|
||||
}
|
||||
|
||||
v := variable_t {
|
||||
Label: label,
|
||||
message.Variables["rootdisp"] = variable_t {
|
||||
Label: "rootdisp",
|
||||
Variable: "",
|
||||
Value: strconv.FormatFloat(value, 'f', 4, 64),
|
||||
Value: strconv.FormatFloat(rootdisp, 'f', 4, 64),
|
||||
Unit: "ms",
|
||||
Status: status,
|
||||
}
|
||||
message.Variables["stratum"] = variable_t {
|
||||
Label: "stratum",
|
||||
Variable: "",
|
||||
Value: strconv.FormatInt(stratum, 10),
|
||||
Unit: "ms",
|
||||
Status: status,
|
||||
}
|
||||
message.Variables[label] = v
|
||||
|
||||
|
||||
j, err := json.Marshal(message)
|
||||
|
Loading…
x
Reference in New Issue
Block a user