Developing lightweight computation at the DSG edge

Commit f4e5deda authored by Roger Pueyo Centelles's avatar Roger Pueyo Centelles
Browse files

[monitor-snmp] Wrong SNMP replies cause warnings, not errors


Signed-off-by: Roger Pueyo Centelles's avatarRoger Pueyo Centelles <rpueyo@ac.upc.edu>
parent 16551460
......@@ -169,7 +169,7 @@ func getSNMPData(IPAddress string) []SNMPInterfaceData {
snmp.Default.Target = IPAddress
err := snmp.Default.Connect()
if err != nil {
errCheck(err, ERROR, "Unable to start an SNMP connection")
errCheck(err, WARNING, "Unable to start an SNMP connection")
return measurements
}
defer snmp.Default.Conn.Close()
......@@ -187,7 +187,7 @@ 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 integer number of interfaces", IPAddress))
errCheck(err, WARNING, fmt.Sprintf("Device at %s is reporting an incorrect integer number of interfaces", IPAddress))
return measurements
}
if numInterfaces < 0 {
......@@ -198,7 +198,7 @@ func getSNMPData(IPAddress string) []SNMPInterfaceData {
fmt.Printf("Device at %s is reporting %s instead of Integer", IPAddress, variable.Type)
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, WARNING, fmt.Sprintf("Device at %s is reporting an incorrect number of interfaces", IPAddress))
return measurements
}
if numInterfaces < 0 {
......@@ -216,7 +216,7 @@ func getSNMPData(IPAddress string) []SNMPInterfaceData {
fmt.Println(" Trying", fmt.Sprintf("%s.%d", namesPrefix, i+1))
result, err = snmp.Default.Get(aoids) // Get() accepts up to g.MAX_OIDS
errCheck(err, ERROR, fmt.Sprintf("Device at %s is reporting an incorrect traffic info answer", IPAddress))
errCheck(err, WARNING, fmt.Sprintf("Device at %s is reporting an incorrect traffic info answer", IPAddress))
if len(result.Variables) == 3 {
var thisInterfaceSNMPData SNMPInterfaceData
......
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