MGE UPS current support

git-svn-id: http://www.observium.org/svn/observer/trunk@1132 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-06-10 15:53:51 +00:00
parent c9eed0131f
commit 7233830e17
+56 -3
View File
@@ -8,7 +8,7 @@ $port = $device['port'];
echo("Current : ");
## APC PDU
if ($device['os'] == "apc")
if ($device['os'] == "apc")
{
$oids = snmp_walk($device, ".1.3.6.1.4.1.318.1.1.12.2.3.1.1.2", "-OsqnU", "");
if ($debug) { echo($oids."\n"); }
@@ -16,10 +16,10 @@ if ($device['os'] == "apc")
if ($oids) echo("APC ");
$type = "apc";
$precision = "10";
foreach(explode("\n", $oids) as $data)
foreach(explode("\n", $oids) as $data)
{
$data = trim($data);
if ($data)
if ($data)
{
list($oid,$kind) = explode(" ", $data);
$split_oid = explode('.',$oid);
@@ -44,6 +44,59 @@ if ($device['os'] == "apc")
}
}
## MGE UPS
if ($device['os'] == "mgeups")
{
echo("MGE ");
$oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.7.1", "-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.705.1.7.2.1.5.$i";
$descr = "Output"; if ($numPhase > 1) $descr .= " Phase $i";
$current = snmp_get($device, $current_oid, "-Oqv");
if (!$current)
{
$current_oid .= ".0";
$current = snmp_get($device, $current_oid, "-Oqv");
}
$current /= 10;
$type = "mge-ups";
$precision = 10;
$index = $i;
$warnlimit = NULL;
$lowlimit = 0;
$limit = NULL;
echo discover_current($device, $current_oid, $index, $type, $descr, $precision, $lowlimit, $warnlimit, $limit, $current);
$current_exists[$type][$index] = 1;
}
$oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.6.1", "-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.705.1.7.2.1.6.$i";
$descr = "Input"; if ($numPhase > 1) $descr .= " Phase $i";
$current = snmp_get($device, $current_oid, "-Oqv");
if (!$current)
{
$current_oid .= ".0";
$current = snmp_get($device, $current_oid, "-Oqv");
}
$current /= 10;
$type = "mge-ups";
$precision = 10;
$index = 100+$i;
$warnlimit = NULL;
$lowlimit = 0;
$limit = NULL;
echo discover_current($device, $current_oid, $index, $type, $descr, $precision, $lowlimit, $warnlimit, $limit, $current);
$current_exists[$type][$index] = 1;
}
}
## Delete removed sensors
if($debug) { print_r($current_exists); }