66 lines
2.9 KiB
C#
66 lines
2.9 KiB
C#
using System;
|
|
using ln.skyscanner.entities;
|
|
using ln.logging;
|
|
using ln.types;
|
|
using ln.snmp;
|
|
using ln.snmp.types;
|
|
using ln.skyscanner.services;
|
|
|
|
namespace ln.skyscanner.checks
|
|
{
|
|
public class SikluCheck : SkyCheck
|
|
{
|
|
public SikluCheck()
|
|
:base("siklu")
|
|
{
|
|
}
|
|
|
|
public override void Check(CheckService checkService, ref SkyCheckState checkState, Node node)
|
|
{
|
|
foreach (URI snmpUri in node.FindURIs("snmp"))
|
|
{
|
|
try
|
|
{
|
|
using (SnmpInterface snmp = SnmpInterface.FromURI(snmpUri, checkService.SNMPEngine))
|
|
{
|
|
Sequence[][] ptp = snmp.snmpWalk(new string[] {
|
|
"1.3.6.1.4.1.31926.2.1.1.19", // RX PWR
|
|
"1.3.6.1.4.1.31926.2.1.1.18", // SNR
|
|
"1.3.6.1.4.1.31926.2.1.1.42" // TX PWR
|
|
});
|
|
|
|
int n = 0;
|
|
foreach (Sequence[] row in ptp)
|
|
{
|
|
node.WritePerformanceValue(checkService.PerformanceValueService, Name, String.Format("ptp_rx_pwr_{0}", n), (double)((Integer)(row[0].Items[1])).LongValue, -75.0, 0, -80.0, 0);
|
|
node.WritePerformanceValue(checkService.PerformanceValueService, Name, String.Format("ptp_tx_snr_{0}", n), (double)((Integer)(row[1].Items[1])).LongValue);
|
|
node.WritePerformanceValue(checkService.PerformanceValueService, Name, String.Format("ptp_tx_pwr_{0}", n), (double)((Integer)(row[2].Items[1])).LongValue);
|
|
|
|
/* long rxBytes = ((Integer)(row[4].Items[1])).LongValue;
|
|
long txBytes = ((Integer)(row[5].Items[1])).LongValue;
|
|
|
|
ubiquityCheckState.RXRate.Update(rxBytes * 8);
|
|
ubiquityCheckState.TXRate.Update(txBytes * 8);
|
|
|
|
ubiquityCheckState.WritePerformanceValue("ptp_rx_rate", ubiquityCheckState.RXRate.Current);
|
|
ubiquityCheckState.WritePerformanceValue("ptp_tx_rate", ubiquityCheckState.TXRate.Current);
|
|
*/
|
|
n++;
|
|
}
|
|
}
|
|
break;
|
|
} catch (Exception e)
|
|
{
|
|
Logging.Log(LogLevel.DEBUG, "Exception caught in SikluCheck: {0}", e);
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
|
|
public override bool IsValid(Node node)
|
|
{
|
|
return (node.Vendor != null) && node.Vendor.Equals("Siklu");
|
|
}
|
|
}
|
|
}
|