Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
4ed32f8314
|
|||
4222e19573
|
@ -18,7 +18,6 @@ type variable_t struct {
|
||||
Label string `json:"label"`
|
||||
Variable string `json:"variable"`
|
||||
Value string `json:"value"`
|
||||
DiffValue string `json:"diffValue"`
|
||||
}
|
||||
|
||||
type message_t struct {
|
||||
@ -114,15 +113,15 @@ func Start() {
|
||||
convertedValue = fmt.Sprintf("%d", gosnmp.ToBigInt(variable.Value))
|
||||
}
|
||||
|
||||
diffValue := "-"
|
||||
if oidTopic.Diff == "true" {
|
||||
log.Println("Calculate difference to last value")
|
||||
key := endpoint.Endpoint + ":" + oidTopic.OID
|
||||
diff, err := calculateDifference(key, convertedValue)
|
||||
if err != nil {
|
||||
log.Printf("Error when building difference: %v", err)
|
||||
convertedValue = "-1"
|
||||
} else {
|
||||
diffValue = diff
|
||||
convertedValue = diff
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,7 +130,6 @@ func Start() {
|
||||
Label: oidTopic.Label,
|
||||
Variable: oidTopic.OID,
|
||||
Value: convertedValue,
|
||||
DiffValue: diffValue,
|
||||
}
|
||||
message.Variables[oidTopic.Label] = v
|
||||
|
||||
|
Reference in New Issue
Block a user