skip diff value
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful

This commit is contained in:
Wolfgang Hottgenroth 2024-01-25 15:22:29 +01:00
parent 11e63155bc
commit 4222e19573
Signed by: wn
GPG Key ID: 836E9E1192A6B132

View File

@ -114,15 +114,15 @@ func Start() {
convertedValue = fmt.Sprintf("%d", gosnmp.ToBigInt(variable.Value)) convertedValue = fmt.Sprintf("%d", gosnmp.ToBigInt(variable.Value))
} }
diffValue := "-"
if oidTopic.Diff == "true" { if oidTopic.Diff == "true" {
log.Println("Calculate difference to last value") log.Println("Calculate difference to last value")
key := endpoint.Endpoint + ":" + oidTopic.OID key := endpoint.Endpoint + ":" + oidTopic.OID
diff, err := calculateDifference(key, convertedValue) diff, err := calculateDifference(key, convertedValue)
if err != nil { if err != nil {
log.Printf("Error when building difference: %v", err) log.Printf("Error when building difference: %v", err)
convertedValue = "-1"
} else { } else {
diffValue = diff convertedValue = diff
} }
} }
@ -131,7 +131,6 @@ func Start() {
Label: oidTopic.Label, Label: oidTopic.Label,
Variable: oidTopic.OID, Variable: oidTopic.OID,
Value: convertedValue, Value: convertedValue,
DiffValue: diffValue,
} }
message.Variables[oidTopic.Label] = v message.Variables[oidTopic.Label] = v