2010-07-31 20:30:30 +00:00
|
|
|
<?php
|
|
|
|
|
2011-05-04 11:04:19 +00:00
|
|
|
|
2010-07-31 20:30:30 +00:00
|
|
|
|
|
|
|
## XUPS-MIB
|
|
|
|
if ($device['os'] == "powerware")
|
|
|
|
{
|
|
|
|
echo("XUPS-MIB ");
|
2011-03-14 19:24:23 +00:00
|
|
|
|
2010-07-31 20:30:30 +00:00
|
|
|
$oids = snmp_walk($device, "xupsBatCurrent", "-Osqn", "XUPS-MIB");
|
|
|
|
if ($debug) { echo($oids."\n"); }
|
|
|
|
$oids = trim($oids);
|
2011-03-14 19:24:23 +00:00
|
|
|
foreach (explode("\n", $oids) as $data)
|
2010-07-31 20:30:30 +00:00
|
|
|
{
|
|
|
|
$data = trim($data);
|
2011-03-14 19:24:23 +00:00
|
|
|
if ($data)
|
2010-07-31 20:30:30 +00:00
|
|
|
{
|
|
|
|
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;
|
2011-03-14 19:24:23 +00:00
|
|
|
|
2011-05-04 11:04:19 +00:00
|
|
|
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
2010-07-31 20:30:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-31 20:35:59 +00:00
|
|
|
$oids = trim(snmp_walk($device, "xupsOutputCurrent", "-OsqnU", "XUPS-MIB"));
|
2010-07-31 20:30:30 +00:00
|
|
|
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;
|
2011-03-14 19:24:23 +00:00
|
|
|
|
2011-05-04 11:04:19 +00:00
|
|
|
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
2010-07-31 20:30:30 +00:00
|
|
|
}
|
|
|
|
|
2010-07-31 20:35:59 +00:00
|
|
|
$oids = trim(snmp_walk($device, "xupsInputCurrent", "-OsqnU", "XUPS-MIB"));
|
2010-07-31 20:30:30 +00:00
|
|
|
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;
|
2011-03-14 19:24:23 +00:00
|
|
|
|
2011-05-04 11:04:19 +00:00
|
|
|
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
2010-07-31 20:30:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-14 19:24:23 +00:00
|
|
|
?>
|