diff --git a/config.php.default b/config.php.default index 2dad094be..a05c0967c 100755 --- a/config.php.default +++ b/config.php.default @@ -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 diff --git a/discovery.php b/discovery.php index c23bc0580..223593d03 100755 --- a/discovery.php +++ b/discovery.php @@ -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'; } diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index d4f60beae..3e4f428f5 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -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"); } } diff --git a/includes/discovery/mempools-cemp.inc.php b/includes/discovery/mempools-cemp.inc.php index 60d7d3d81..e9b6e4f0c 100755 --- a/includes/discovery/mempools-cemp.inc.php +++ b/includes/discovery/mempools-cemp.inc.php @@ -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"); diff --git a/includes/discovery/toner.inc.php b/includes/discovery/toner.inc.php index 226f6fcd3..5336b5cd3 100644 --- a/includes/discovery/toner.inc.php +++ b/includes/discovery/toner.inc.php @@ -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)) diff --git a/includes/discovery/voltages.inc.php b/includes/discovery/voltages.inc.php index 494a49cfb..5ce7f5145 100755 --- a/includes/discovery/voltages.inc.php +++ b/includes/discovery/voltages.inc.php @@ -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); }