MGE UPS support, various fixes

git-svn-id: http://www.observium.org/svn/observer/trunk@1093 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-06-03 09:12:07 +00:00
parent 7df73de29e
commit 564e9fdc07
6 changed files with 65 additions and 5 deletions
+1 -1
View File
@@ -111,7 +111,7 @@ $config['ports_page_default'] = "details/";
### Which additional features should we enable?
$config['enable_bgp'] = 1; # Enable BGP session collection and display
$config['enable_bgp'] = 1; # Enable BGP session collection and display
$config['enable_syslog'] = 0; # Enable Syslog
$config['enable_billing'] = 0; # Enable Billing
$config['enable_inventory'] = 1; # Enable Inventory
+1
View File
@@ -112,6 +112,7 @@ 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");
if($device['os'] == "screenos") {
if ($device['type'] == "unknown") { $device['type'] = 'firewall'; }
+1 -1
View File
@@ -231,7 +231,7 @@ function discover_volt($device, $oid, $index, $type, $descr, $precision = 1, $lo
}
else
{
mysql_query("UPDATE voltage SET `volt_descr` = '$descr', `volt_oid` = '$oid', `volt_precision` = '$precision' WHERE `device_id` = '$id' AND volt_type = '$type' AND `volt_index` = '$index' ");
mysql_query("UPDATE voltage SET `volt_descr` = '$descr', `volt_oid` = '$oid', `volt_precision` = '$precision' WHERE `device_id` = '" . $device['device_id'] . "' AND volt_type = '$type' AND `volt_index` = '$index' ");
echo("U");
if($debug) { echo("$query ". mysql_affected_rows() . " updated"); }
}
+2 -2
View File
@@ -6,8 +6,8 @@ if($device['os'] == "ios" || $device['os_group'] == "ios") {
$array = snmpwalk_cache_multi_oid($device, "cempMemPoolEntry", NULL, "CISCO-ENHANCED-MEMPOOL-MIB");
if(is_array($array)) {
foreach($array[$device[device_id]] as $index => $entry) {
if(is_array($array[$device['device_id']])) {
foreach($array[$device['device_id']] as $index => $entry) {
if(is_numeric($entry['cempMemPoolUsed']) && $entry['cempMemPoolValid'] == "true") {
list($entPhysicalIndex) = explode(".", $index);
$entPhysicalDescr = snmp_get($device, "entPhysicalDescr.".$entPhysicalIndex, "-Oqv", "ENTITY-MIB");
+1 -1
View File
@@ -43,7 +43,7 @@ if ($device['os'] == "dell-laser")
## Delete removed toners
if($debug) { echo("\n Checking ... \n"); print_r($fan_exists); }
if($debug) { echo("\n Checking ... \n"); print_r($toner_exists); }
$sql = "SELECT * FROM toner WHERE device_id = '".$device['device_id']."'";
if ($query = mysql_query($sql))
+59
View File
@@ -75,6 +75,65 @@ if ($device['os'] == "linux")
}
}
## MGE UPS Voltages
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++)
{
$volt_oid = ".1.3.6.1.4.1.705.1.7.2.$i.2.1.0";
$descr = "Output"; if ($numPhase > 1) $descr .= " Phase $i";
$current = snmp_get($device, $volt_oid, "-Oqv") / 10;
$type = "mge-ups";
$precision = 10;
$index = $i;
if ($current > 200 && $current < 250)
{
#FIXME Are these sensible values?
$lowlimit = 210;
$limit = 250;
}
else
{
$lowlimit = 0;
$limit = 0;
}
echo discover_volt($device, $volt_oid, $index, $type, $descr, $precision, $lowlimit, $limit, $current);
$volt_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++)
{
$volt_oid = ".1.3.6.1.4.1.705.1.6.2.$i.2.1.0";
$descr = "Input"; if ($numPhase > 1) $descr .= " Phase $i";
$current = snmp_get($device, $volt_oid, "-Oqv") / 10;
$type = "mge-ups";
$precision = 10;
$index = 100+$i;
if ($current > 200 && $current < 250)
{
#FIXME Are these sensible values?
$lowlimit = 210;
$limit = 250;
}
else
{
$lowlimit = 0;
$limit = 0;
}
echo discover_volt($device, $volt_oid, $index, $type, $descr, $precision, $lowlimit, $limit, $current);
$volt_exists[$type][$index] = 1;
}
}
## Delete removed sensors
if($debug) { print_r($volt_exists); }