skip diff value
This commit is contained in:
parent
11e63155bc
commit
4222e19573
@ -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
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user