mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
Completed XUPS-MIB support, complete with Eaton logo
git-svn-id: http://www.observium.org/svn/observer/trunk@1590 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 973 B |
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
global $valid_sensor;
|
||||
|
||||
## XUPS-MIB
|
||||
if ($device['os'] == "powerware")
|
||||
{
|
||||
echo("XUPS-MIB ");
|
||||
|
||||
$oids = snmp_walk($device, "xupsBatCurrent", "-Osqn", "XUPS-MIB");
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
$oids = trim($oids);
|
||||
foreach(explode("\n", $oids) as $data)
|
||||
{
|
||||
$data = trim($data);
|
||||
if ($data)
|
||||
{
|
||||
list($oid,$descr) = explode(" ", $data,2);
|
||||
$split_oid = explode('.',$oid);
|
||||
$current_id = $split_oid[count($split_oid)-1];
|
||||
$current_oid = "1.3.6.1.4.1.534.1.2.3.$current_id";
|
||||
$divisor = 1;
|
||||
$current = snmp_get($device, $current_oid, "-O vq");
|
||||
$descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($current_id+1));
|
||||
$type = "xups";
|
||||
$index = "1.2.3.".$current_id;
|
||||
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
$oids = trim(snmp_walk($device, "xupsOutputCurrent", "-OsqnU"));
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
list($unused,$numPhase) = explode(' ',$oids);
|
||||
for($i = 1; $i <= $numPhase;$i++)
|
||||
{
|
||||
$current_oid = "1.3.6.1.4.1.534.1.4.4.1.3.$i";
|
||||
$descr = "Output"; if ($numPhase > 1) $descr .= " Phase $i";
|
||||
$current = snmp_get($device, $current_oid, "-Oqv");
|
||||
$type = "xups";
|
||||
$divisor = 1;
|
||||
$index = "4.4.1.3.".$i;
|
||||
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
|
||||
$oids = trim(snmp_walk($device, "xupsInputCurrent", "-OsqnU"));
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
list($unused,$numPhase) = explode(' ',$oids);
|
||||
for($i = 1; $i <= $numPhase;$i++)
|
||||
{
|
||||
$current_oid = "1.3.6.1.4.1.534.1.3.4.1.3.$i";
|
||||
$descr = "Input"; if ($numPhase > 1) $descr .= " Phase $i";
|
||||
$current = snmp_get($device, $current_oid, "-Oqv");
|
||||
$type = "xups";
|
||||
$divisor = 1;
|
||||
$index = "3.4.1.3.".$i;
|
||||
echo discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
global $valid_sensor;
|
||||
|
||||
## XUPS
|
||||
if ($device['os'] == "powerware")
|
||||
{
|
||||
echo("XUPS-MIB ");
|
||||
|
||||
# I'm not sure if there is provision for frequency of multiple phases in this MIB -TL
|
||||
|
||||
# XUPS-MIB::xupsInputFrequency.0 = INTEGER: 500
|
||||
$freq_oid = ".1.3.6.1.4.1.534.1.3.1.0";
|
||||
$descr = "Input";
|
||||
$divisor = 10;
|
||||
$current = snmp_get($device, $freq_oid, "-Oqv") / $divisor;
|
||||
$type = "xups";
|
||||
$index = '3.1.0';
|
||||
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
|
||||
# XUPS-MIB::xupsOutputFrequency.0 = INTEGER: 500
|
||||
$freq_oid = "1.3.6.1.4.1.534.1.4.2.0";
|
||||
$descr = "Output";
|
||||
$divisor = 10;
|
||||
$current = snmp_get($device, $freq_oid, "-Oqv") / $divisor;
|
||||
$type = "xups";
|
||||
$index = '4.2.0';
|
||||
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
|
||||
# XUPS-MIB::xupsBypassFrequency.0 = INTEGER: 500
|
||||
$freq_oid = "1.3.6.1.4.1.534.1.5.1.0";
|
||||
$descr = "Bypass";
|
||||
$divisor = 10;
|
||||
$current = snmp_get($device, $freq_oid, "-Oqv");
|
||||
if ($current != "")
|
||||
{
|
||||
# Bypass is not always available in SNMP
|
||||
$current /= $divisor;
|
||||
$type = "xups";
|
||||
$index = '5.1.0';
|
||||
echo discover_sensor($valid_sensor, 'freq', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -5,7 +5,7 @@ global $valid_sensor;
|
||||
## XUPS-MIB
|
||||
if ($device['os'] == "powerware")
|
||||
{
|
||||
echo("XUPS ");
|
||||
echo("XUPS-MIB ");
|
||||
|
||||
# XUPS-MIB::xupsBatVoltage.0 = INTEGER: 51
|
||||
$oids = snmp_walk($device, "xupsBatVoltage", "-Osqn", "XUPS-MIB");
|
||||
@@ -51,13 +51,29 @@ if ($device['os'] == "powerware")
|
||||
list($unused,$numPhase) = explode(' ',$oids);
|
||||
for($i = 1; $i <= $numPhase;$i++)
|
||||
{
|
||||
# XUPS-MIB::xupsOutputVoltage.1 = INTEGER: 228
|
||||
$volt_oid = ".1.3.6.1.4.1.534.1.4.4.1.2.$i";
|
||||
$descr = "Input"; if ($numPhase > 1) $descr .= " Phase $i";
|
||||
$descr = "Output"; if ($numPhase > 1) $descr .= " Phase $i";
|
||||
$type = "xups";
|
||||
$divisor = 1;
|
||||
$current = snmp_get($device, $volt_oid, "-Oqv") / $divisor;
|
||||
$index = '4.4.1.2.'.$i;
|
||||
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
|
||||
# XUPS-MIB::xupsBypassNumPhases.0 = INTEGER: 1
|
||||
$oids = trim(snmp_walk($device, "xupsBypassNumPhases", "-OsqnU"));
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
list($unused,$numPhase) = explode(' ',$oids);
|
||||
for($i = 1; $i <= $numPhase;$i++)
|
||||
{
|
||||
$volt_oid = ".1.3.6.1.4.1.534.1.5.3.1.2.$i";
|
||||
$descr = "Bypass"; if ($numPhase > 1) $descr .= " Phase $i";
|
||||
$type = "xups";
|
||||
$divisor = 1;
|
||||
$current = snmp_get($device, $volt_oid, "-Oqv") / $divisor;
|
||||
$index = '5.3.1.2.'.$i;
|
||||
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -2,18 +2,16 @@
|
||||
|
||||
$query = "SELECT * FROM `sensors` WHERE device_id = '" . $device['device_id'] . "' AND `sensor_class` = 'freq'";
|
||||
$sensor_data = mysql_query($query);
|
||||
while($frequency = mysql_fetch_array($sensor_data)) {
|
||||
while($sensor = mysql_fetch_array($sensor_data)) {
|
||||
|
||||
echo("Checking frequency " . $frequency['sensor_descr'] . "... ");
|
||||
echo("Checking frequency " . $sensor['sensor_descr'] . "... ");
|
||||
|
||||
$freq = snmp_get($device, $frequency['sensor_oid'], "-OUqnv", "SNMPv2-MIB");
|
||||
$freq = snmp_get($device, $sensor['sensor_oid'], "-OUqnv", "SNMPv2-MIB");
|
||||
|
||||
if ($frequency['sensor_precision'])
|
||||
{
|
||||
$freq = $freq / $frequency['sensor_precision'];
|
||||
}
|
||||
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("freq-" . $frequency['sensor_descr'] . ".rrd");
|
||||
if ($sensor['sensor_divisor']) { $freq = $freq / $sensor['sensor_divisor']; }
|
||||
if ($sensor['sensor_multiplier']) { $freq = $freq * $sensor['sensor_multiplier']; }
|
||||
|
||||
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("freq-" . $sensor['sensor_descr'] . ".rrd");
|
||||
|
||||
if (!is_file($rrd_file)) {
|
||||
`rrdtool create $rrd_file \
|
||||
@@ -29,26 +27,26 @@ while($frequency = mysql_fetch_array($sensor_data)) {
|
||||
|
||||
rrdtool_update($rrd_file,"N:$freq");
|
||||
|
||||
if($frequency['sensor_current'] > $frequency['sensor_limit_low'] && $freq <= $frequency['sensor_limit_low'])
|
||||
if($sensor['sensor_current'] > $sensor['sensor_limit_low'] && $freq <= $sensor['sensor_limit_low'])
|
||||
{
|
||||
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
|
||||
$msg = "Frequency Alarm: " . $device['hostname'] . " " . $frequency['sensor_descr'] . " is " . $freq . "Hz (Limit " . $frequency['sensor_limit'];
|
||||
$msg = "Frequency Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is " . $freq . "Hz (Limit " . $sensor['sensor_limit'];
|
||||
$msg .= "Hz) at " . date($config['timestamp_format']);
|
||||
notify($device, "Frequency Alarm: " . $device['hostname'] . " " . $frequency['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $frequency['sensor_descr'] . "\n");
|
||||
log_event('Frequency ' . $frequency['sensor_descr'] . " under threshold: " . $freq . " Hz (< " . $frequency['sensor_limit_low'] . " Hz)", $device['device_id'] , 'frequency', $frequency['sensor_id']);
|
||||
notify($device, "Frequency Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $sensor['sensor_descr'] . "\n");
|
||||
log_event('Frequency ' . $sensor['sensor_descr'] . " under threshold: " . $freq . " Hz (< " . $sensor['sensor_limit_low'] . " Hz)", $device['device_id'] , 'frequency', $sensor['sensor_id']);
|
||||
}
|
||||
else if($frequency['sensor_current'] < $frequency['sensor_limit'] && $freq >= $frequency['sensor_limit'])
|
||||
else if($sensor['sensor_current'] < $sensor['sensor_limit'] && $freq >= $sensor['sensor_limit'])
|
||||
{
|
||||
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
|
||||
$msg = "Frequency Alarm: " . $device['hostname'] . " " . $frequency['sensor_descr'] . " is " . $freq . "Hz (Limit " . $frequency['sensor_limit'];
|
||||
$msg = "Frequency Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'] . " is " . $freq . "Hz (Limit " . $sensor['sensor_limit'];
|
||||
$msg .= "Hz) at " . date($config['timestamp_format']);
|
||||
notify($device, "Frequency Alarm: " . $device['hostname'] . " " . $frequency['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $frequency['sensor_descr'] . "\n");
|
||||
log_event('Frequency ' . $frequency['sensor_descr'] . " above threshold: " . $freq . " Hz (> " . $frequency['sensor_limit'] . " Hz)", $device['device_id'], 'frequency', $frequency['sensor_id']);
|
||||
notify($device, "Frequency Alarm: " . $device['hostname'] . " " . $sensor['sensor_descr'], $msg);
|
||||
echo("Alerting for " . $device['hostname'] . " " . $sensor['sensor_descr'] . "\n");
|
||||
log_event('Frequency ' . $sensor['sensor_descr'] . " above threshold: " . $freq . " Hz (> " . $sensor['sensor_limit'] . " Hz)", $device['device_id'], 'frequency', $sensor['sensor_id']);
|
||||
}
|
||||
|
||||
mysql_query("UPDATE frequency SET sensor_current = '$freq' WHERE sensor_id = '" . $frequency['sensor_id'] . "'");
|
||||
mysql_query("UPDATE frequency SET sensor_current = '$freq' WHERE sensor_id = '" . $sensor['sensor_id'] . "'");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
# deltaups / netmanplus: rfc1628
|
||||
|
||||
# powerware:
|
||||
# XUPS-MIB::xupsBatTimeRemaining.0 = INTEGER: 3155
|
||||
# XUPS-MIB::xupsBatCapacity.0 = INTEGER: 93
|
||||
# XUPS-MIB::xupsBatteryAbmStatus.0 = INTEGER: batteryResting(4)
|
||||
# XUPS-MIB::xupsAlarms.0 = Gauge32: 0
|
||||
# XUPS-MIB::xupsAlarmNumEvents.0 = Gauge32: 0
|
||||
# XUPS-MIB::xupsTestBattery.0 = INTEGER: 0
|
||||
# XUPS-MIB::xupsTestBatteryStatus.0 = INTEGER: unknown(1)
|
||||
# XUPS-MIB::xupsOutputLoad.0 = INTEGER: 19
|
||||
|
||||
# gamatronic: unknown
|
||||
|
||||
# mge: unknown
|
||||
|
||||
# apc: unknown
|
||||
|
||||
?>
|
||||
@@ -255,6 +255,7 @@ $config['os'][$os]['type'] = "power";
|
||||
$os = "powerware";
|
||||
$config['os'][$os]['text'] = "Powerware UPS";
|
||||
$config['os'][$os]['type'] = "power";
|
||||
$config['os'][$os]['icon'] = "eaton";
|
||||
|
||||
$os = "deltaups";
|
||||
$config['os'][$os]['text'] = "Delta UPS";
|
||||
@@ -280,7 +281,6 @@ $config['os'][$os]['over'][1]['text'] = "CPU Usage";
|
||||
$config['os'][$os]['over'][2]['graph'] = "device_mempools";
|
||||
$config['os'][$os]['over'][2]['text'] = "Memory Usage";
|
||||
|
||||
|
||||
$os = "speedtouch";
|
||||
$config['os'][$os]['text'] = "Thomson Speedtouch";
|
||||
$config['os'][$os]['ifname'] = 1;
|
||||
@@ -288,7 +288,6 @@ $config['os'][$os]['type'] = "network";
|
||||
$config['os'][$os]['over'][0]['graph'] = "device_bits";
|
||||
$config['os'][$os]['over'][0]['text'] = "Traffic";
|
||||
|
||||
|
||||
$os = "sonicwal";
|
||||
$config['os'][$os]['text'] = "SonicWALL";
|
||||
$config['os'][$os]['type'] = "firewall";
|
||||
|
||||
Reference in New Issue
Block a user