powerware device data polling + voltage discovery

git-svn-id: http://www.observium.org/svn/observer/trunk@1588 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-07-31 19:40:52 +00:00
parent 386846085e
commit fc3c3e67d0
4 changed files with 74 additions and 14 deletions

View File

@@ -138,7 +138,6 @@ while ($device = mysql_fetch_array($device_query))
include("includes/discovery/cisco-pw.inc.php");
include("includes/discovery/cisco-vrf.inc.php");
include("includes/discovery/toner.inc.php");
include("includes/discovery/ups.inc.php");
include("includes/discovery/ucd-diskio.inc.php");
include("includes/discovery/services.inc.php");

View File

@@ -1,13 +0,0 @@
<?php
$id = $device['device_id'];
$hostname = $device['hostname'];
$community = $device['community'];
$snmpver = $device['snmpver'];
$port = $device['port'];
#echo("UPS : ");
?>

View File

@@ -0,0 +1,63 @@
<?php
global $valid_sensor;
## XUPS-MIB
if ($device['os'] == "powerware")
{
echo("XUPS ");
# XUPS-MIB::xupsBatVoltage.0 = INTEGER: 51
$oids = snmp_walk($device, "xupsBatVoltage", "-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);
$volt_id = $split_oid[count($split_oid)-1];
$volt_oid = ".1.3.6.1.4.1.534.1.2.2.$volt_id";
$divisor = 1;
$volt = snmp_get($device, $volt_oid, "-O vq") / $divisor;
$descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($volt_id+1));
$type = "xups";
$index = '1.2.5.'.$volt_id;
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $volt);
}
}
# XUPS-MIB::xupsInputNumPhases.0 = INTEGER: 1
$oids = trim(snmp_walk($device, "xupsInputNumPhases", "-OsqnU", "XUPS-MIB"));
if ($debug) { echo($oids."\n"); }
list($unused,$numPhase) = explode(' ',$oids);
for($i = 1; $i <= $numPhase;$i++)
{
# XUPS-MIB::xupsInputVoltage.1 = INTEGER: 228
$volt_oid = ".1.3.6.1.4.1.534.1.3.4.1.2.$i";
$descr = "Output"; if ($numPhase > 1) $descr .= " Phase $i";
$type = "xups";
$divisor = 1;
$current = snmp_get($device, $volt_oid, "-Oqv") / $divisor;
$index = '3.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::xupsOutputNumPhases.0 = INTEGER: 1
$oids = trim(snmp_walk($device, "xupsOutputNumPhases", "-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.4.4.1.2.$i";
$descr = "Input"; 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);
}
}
?>

View File

@@ -0,0 +1,11 @@
<?php
# XUPS-MIB::xupsIdentManufacturer.0 = STRING: "Powerware Corporation"
# XUPS-MIB::xupsIdentModel.0 = STRING: "T1500 XR "
$hardware = trim(snmp_get($device, "xupsIdentManufacturer.0", "-OQv", "XUPS-MIB", ""),'" ');
$hardware .= ' ' . trim(snmp_get($device, "xupsIdentModel.0", "-OQv", "XUPS-MIB", ""),'" ');
# XUPS-MIB::xupsIdentSoftwareVersion.0 = STRING: " FP: 2.01 INV: 2.01 NET: 3.60 "
$version = trim(snmp_get($device, "xupsIdentSoftwareVersion.0", "-OQv", "XUPS-MIB", ""),'" ');
?>