Developing lightweight computation at the DSG edge

Commit 0c436957 authored by Roger Pueyo Centelles's avatar Roger Pueyo Centelles
Browse files

[monitor-snmp] Use unique error messages in getSNMPData()


Signed-off-by: Roger Pueyo Centelles's avatarRoger Pueyo Centelles <rpueyo@ac.upc.edu>
parent 0a052624
......@@ -145,7 +145,7 @@ func performPingChecks() {
snmpData := getSNMPData(v.Device.Addresses[0])
if len(snmpData) > 0 {
if snmpData != nil && len(snmpData) > 0 {
fmt.Println(snmpData)
saveMeasurement(v.Device.ID, snmpData)
}
......@@ -187,11 +187,11 @@ func getSNMPData(IPAddress string) []SNMPInterfaceData {
case snmp.Integer:
numInterfaces, err = strconv.Atoi(fmt.Sprintf("%d", snmp.ToBigInt(variable.Value)))
if err != nil {
errCheck(err, ERROR, fmt.Sprintf("Device at %s is reporting an incorrect number of interfaces", IPAddress))
errCheck(err, ERROR, fmt.Sprintf("Device at %s is reporting an incorrect integer number of interfaces", IPAddress))
return measurements
}
if numInterfaces < 0 {
fmt.Printf("Device at %s is reporting an incorrect number of %d interfaces", IPAddress, numInterfaces)
fmt.Printf("Device at %s is reporting a negative integer number of %d interfaces", IPAddress, numInterfaces)
return measurements
}
default:
......@@ -202,7 +202,7 @@ func getSNMPData(IPAddress string) []SNMPInterfaceData {
return measurements
}
if numInterfaces < 0 {
fmt.Printf("Device at %s is reporting an incorrect number of %d interfaces", IPAddress, numInterfaces)
fmt.Printf("Device at %s is reporting a negative number of %d interfaces", IPAddress, numInterfaces)
return measurements
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment