APC STS/ATS support

git-svn-id: http://www.observium.org/svn/observer/trunk@1306 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-07-06 10:27:20 +00:00
parent 5b5af4b20f
commit a3a6d5ddae
5 changed files with 134 additions and 2 deletions

View File

@@ -9,9 +9,10 @@ $valid_current = array();
echo("Current : ");
## APC PDU
## APC
if ($device['os'] == "apc")
{
# PDU
$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"); }
$oids = trim($oids);
@@ -43,6 +44,25 @@ if ($device['os'] == "apc")
echo discover_current($valid_current,$device, $current_oid, $index, $type, $descr, $precision, $lowlimit, $warnlimit, $limit, $current);
}
}
# ATS
$atsCurrent = snmp_get($device, "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1", "-OsqnU", "");
if ($atsCurrent)
{
$current_oid = "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1";
$limit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.5.1";
$lowlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.3.1";
$warnlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.4.1";
$index = 1;
$current = snmp_get($device, $current_oid, "-Oqv", "") / $precision;
$limit = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$descr = "Output Feed";
echo discover_current($valid_current,$device, $current_oid, $index, $type, $descr, $precision, $lowlimit, $warnlimit, $limit, $current);
}
}
## MGE UPS

View File

@@ -89,6 +89,48 @@ if ($device['os'] == "netmanplus")
echo discover_freq($valid_freq, $device, $freq_oid, $index, $type, $descr, $precision, NULL, NULL, $current);
}
## APC
if ($device['os'] == "apc")
{
$oids = snmp_walk($device, "1.3.6.1.4.1.318.1.1.8.5.3.2.1.4", "-OsqnU", "");
if ($debug) { echo($oids."\n"); }
if ($oids) echo("APC In ");
$precision = 1;
$type = "apc";
foreach(explode("\n", $oids) as $data)
{
$data = trim($data);
if ($data)
{
list($oid,$current) = explode(" ", $data,2);
$split_oid = explode('.',$oid);
$index = $split_oid[count($split_oid)-1];
$oid = "1.3.6.1.4.1.318.1.1.8.5.3.2.1.4." . $index;
$descr = "Input Feed " . chr(64+$index);
discover_freq($valid_freq,$device, $oid, "3.2.1.4.$index", $type, $descr, $precision, NULL, NULL, $current);
}
}
$oids = snmp_walk($device, "1.3.6.1.4.1.318.1.1.8.5.4.2.1.4", "-OsqnU", "");
if ($debug) { echo($oids."\n"); }
if ($oids) echo(" APC Out ");
$precision = 1;
$type = "apc";
foreach(explode("\n", $oids) as $data)
{
$data = trim($data);
if ($data)
{
list($oid,$current) = explode(" ", $data,2);
$split_oid = explode('.',$oid);
$index = $split_oid[count($split_oid)-3];
$oid = "1.3.6.1.4.1.318.1.1.8.5.4.2.1.4." . $index;
$descr = "Output Feed"; if (count(explode("\n", $oids)) > 1) { $descr .= " $index"; }
discover_freq($valid_freq,$device, $oid, "4.2.1.4.$index", $type, $descr, $precision, NULL, NULL, $current);
}
}
}
## Delete removed sensors

View File

@@ -58,6 +58,48 @@ if ($device['os'] == "areca")
}
}
## APC Voltages
if ($device['os'] == "apc")
{
$oids = snmp_walk($device, "1.3.6.1.4.1.318.1.1.8.5.3.3.1.3", "-OsqnU", "");
if ($debug) { echo($oids."\n"); }
if ($oids) echo("APC In ");
$precision = 1;
$type = "apc";
foreach(explode("\n", $oids) as $data)
{
$data = trim($data);
if ($data)
{
list($oid,$current) = explode(" ", $data,2);
$split_oid = explode('.',$oid);
$index = $split_oid[count($split_oid)-3];
$oid = "1.3.6.1.4.1.318.1.1.8.5.3.3.1.3." . $index . ".1.1";
$descr = "Input Feed " . chr(64+$index);
discover_volt($valid_volt,$device, $oid, "3.3.1.3.$index", $type, $descr, $precision, NULL, NULL, $current);
}
}
$oids = snmp_walk($device, "1.3.6.1.4.1.318.1.1.8.5.4.3.1.3", "-OsqnU", "");
if ($debug) { echo($oids."\n"); }
if ($oids) echo(" APC Out ");
$precision = 1;
$type = "apc";
foreach(explode("\n", $oids) as $data)
{
$data = trim($data);
if ($data)
{
list($oid,$current) = explode(" ", $data,2);
$split_oid = explode('.',$oid);
$index = $split_oid[count($split_oid)-3];
$oid = "1.3.6.1.4.1.318.1.1.8.5.4.3.1.3." . $index . ".1.1";
$descr = "Output Feed"; if (count(explode("\n", $oids)) > 1) { $descr .= " $index"; }
discover_volt($valid_volt,$device, $oid, "4.3.1.3.$index", $type, $descr, $precision, NULL, NULL, $current);
}
}
}
## Supermicro Voltages
if ($device['os'] == "linux")
{

View File

@@ -1,11 +1,36 @@
<?php
# PDU
$serial = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.12.1.6.0", "-OQv", "", ""),'"');
if ($serial == "")
{
# ATS
$serial = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.8.1.6.0", "-OQv", "", ""),'"');
}
######################
# PDU
$hardware = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.12.1.5.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.12.1.2.0", "-OQv", "", ""),'"');
if ($hardware == " ")
{
# ATS
$hardware = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.8.1.5.0", "-OQv", "", ""),'"');
$hardware .= ' ' . trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.8.1.1.0", "-OQv", "", ""),'"');
}
######################
# PDU
$version = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.12.1.3.0", "-OQv", "", ""),'"');
if ($version == "")
{
# ATS
$version = trim(snmp_get($device, "1.3.6.1.4.1.318.1.1.8.1.2.0", "-OQv", "", ""),'"');
}
?>