Fix SNMP exception handling, loop iteration
parent
3491e29d9d
commit
81ac2c1a03
|
@ -5,6 +5,7 @@ using ln.snmp;
|
|||
using System.Collections.Generic;
|
||||
using ln.snmp.types;
|
||||
using ln.logging;
|
||||
using System.Linq;
|
||||
|
||||
namespace ln.skyscanner.checks
|
||||
{
|
||||
|
@ -15,7 +16,6 @@ namespace ln.skyscanner.checks
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
public override void Check(SkyChecker skyChecker,ref SkyCheckState checkState,Node node)
|
||||
{
|
||||
UbiquityCheckState ubiquityCheckState = checkState as UbiquityCheckState;
|
||||
|
@ -23,6 +23,23 @@ namespace ln.skyscanner.checks
|
|||
foreach (URI snmpUri in node.FindURIs("snmp"))
|
||||
{
|
||||
using (SnmpInterface snmp = SnmpInterface.FromURI(snmpUri,skyChecker.SNMPEngine))
|
||||
{
|
||||
List<String> mibs = null;
|
||||
try
|
||||
{
|
||||
mibs = new List<String>();
|
||||
|
||||
foreach (Sequence s in snmp.snmpWalk("1.3.6.1.2.1.1.9.1.2"))
|
||||
{
|
||||
Logging.Log(LogLevel.DEBUG, "Ubiquiti: snmpWalk over OIDs: {0}", (s.Items[1] as ObjectIdentifier).AsString);
|
||||
mibs.Add((s.Items[1] as ObjectIdentifier).AsString);
|
||||
}
|
||||
|
||||
} catch (TimeoutException)
|
||||
{
|
||||
}
|
||||
|
||||
if (mibs.Contains("1.3.6.1.4.1.41112")) // RF Device
|
||||
{
|
||||
Sequence[][] ptp = snmp.snmpWalk(new string[] {
|
||||
"1.3.6.1.4.1.41112.1.3.2.1.5",
|
||||
|
@ -49,9 +66,10 @@ namespace ln.skyscanner.checks
|
|||
ubiquityCheckState.WritePerformanceValue("ptp_rx_rate", ubiquityCheckState.RXRate.Current);
|
||||
ubiquityCheckState.WritePerformanceValue("ptp_tx_rate", ubiquityCheckState.TXRate.Current);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
checkState.CheckState = CheckState.OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue