diff --git a/includes/discovery/current/sentry3.inc.php b/includes/discovery/current/sentry3.inc.php index 5600c7e6de..93c5d37af8 100644 --- a/includes/discovery/current/sentry3.inc.php +++ b/includes/discovery/current/sentry3.inc.php @@ -4,56 +4,64 @@ global $valid_sensor; if ($device['os'] == 'sentry3') { - $oids = snmp_walk($device, "infeedPower", "-Osqn", "Sentry3-MIB"); - $tower_count = snmp_get($device,"systemTowerCount.0", "-Ovq", "Sentry3-MIB"); + $divisor = "100"; + $outlet_divisor = $divisor; + $multiplier = "1"; + # These PDUs may have > 1 "tower" accessible via a single management interface + $tower_count = snmp_get($device,"systemTowerCount.0", "-Ovq", "Sentry3-MIB"); $towers=1; while($towers <= $tower_count) { - $divisor = "100"; - $outlet_divisor = $divisor; - $multiplier = "1"; - if ($debug) { echo($oids."\n"); } - $oids = trim($oids); - if ($oids) echo("ServerTech Sentry Infeed "); - foreach (explode("\n", $oids) as $data) + ################################# + # Check for Infeeds + $infeed_oids = snmp_walk($device, "infeedID.$towers.1", "-Osqn", "Sentry3-MIB"); + if ($debug) { echo($infeed_oids."\n"); } + $infeed_oids = trim($infeed_oids); + + if ($infeed_oids) echo("ServerTech Sentry Infeed "); + foreach (explode("\n", $infeed_oids) as $infeed_data) { - $data = trim($data); - if ($data) + $infeed_data = trim($infeed_data); + if ($infeed_data) { - list($oid,$descr) = explode(" ", $data,2); - $split_oid = explode('.',$oid); - $index = $split_oid[count($split_oid)-1]; + list($infeed_oid,$descr) = explode(" ", $infeed_data,2); + $split_oid = explode('.',$infeed_oid); + $infeed_index = $split_oid[count($split_oid)-1]; #infeedLoadValue - $infeed_oid = "1.3.6.1.4.1.1718.3.2.2.1.7." . $towers . "." . $index; + $infeed_oid = "1.3.6.1.4.1.1718.3.2.2.1.7." . $towers . ".1"; - $descr_string = snmp_get($device,"infeedID.$towers.$index", "-Ovq", "Sentry3-MIB"); - #$descr = "Infeed " . $towers . " " . $descr_string; + $descr_string = snmp_get($device,"infeedID.$towers.$infeed_index", "-Ovq", "Sentry3-MIB"); $descr = "Infeed $descr_string"; $low_warn_limit = NULL; $low_limit = NULL; - $high_warn_limit = snmp_get($device,"infeedLoadHighThresh.$towers.$index", "-Ovq", "Sentry3-MIB"); - $high_limit = snmp_get($device,"infeedCapacity.$towers.$index", "-Ovq", "Sentry3-MIB"); + $high_warn_limit = snmp_get($device,"infeedLoadHighThresh.$towers.$infeed_index", "-Ovq", "Sentry3-MIB"); + $high_limit = snmp_get($device,"infeedCapacity.$towers.$infeed_index", "-Ovq", "Sentry3-MIB"); $current = snmp_get($device,"$infeed_oid", "-Ovq", "Sentry3-MIB") / $divisor; - discover_sensor($valid_sensor, 'current', $device, $infeed_oid, $index, 'sentry3', $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current); + if ($current >= 0) { + discover_sensor($valid_sensor, 'current', $device, $infeed_oid, $towers, 'sentry3', $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current); + } + ################################# # Check for per-outlet polling - $outlet_oids = snmp_walk($device, "outletLoadValue.$towers.$index", "-Osqn", "Sentry3-MIB"); + #$outlet_oids = snmp_walk($device, "outletLoadValue.$towers.$infeed_index", "-Osqn", "Sentry3-MIB"); + $outlet_oids = snmp_walk($device, "outletLoadValue.$towers.1", "-Osqn", "Sentry3-MIB"); $outlet_oids = trim($outlet_oids); + if ($outlet_oids) echo("ServerTech Sentry Outlet "); foreach (explode("\n", $outlet_oids) as $outlet_data) { - $data = trim($outlet_data); + $outlet_data = trim($outlet_data); if ($outlet_data) { list($outlet_oid,$outlet_descr) = explode(" ", $outlet_data,2); $outlet_split_oid = explode('.',$outlet_oid); $outlet_index = $outlet_split_oid[count($outlet_split_oid)-1]; - $outletsuffix = "$towers.$index.$outlet_index"; - $outlet_insert_index=$index . $outlet_index; + $outletsuffix = "$towers.$infeed_index.$outlet_index"; + $outlet_insert_index=$towers . $outlet_index; #outletLoadValue: "A non-negative value indicates the measured load in hundredths of Amps" $outlet_oid = "1.3.6.1.4.1.1718.3.2.3.1.7.$outletsuffix"; @@ -66,44 +74,42 @@ if ($device['os'] == 'sentry3') $outlet_high_limit = snmp_get($device,"outletLoadHighThresh.$outletsuffix", "-Ovq", "Sentry3-MIB"); $outlet_current = snmp_get($device,"$outlet_oid", "-Ovq", "Sentry3-MIB") / $outlet_divisor; - discover_sensor($valid_sensor, 'current', $device, $outlet_oid, $outlet_insert_index, 'sentry3', $outlet_descr, $outlet_divisor, $multiplier, $outlet_low_limit, $outlet_low_warn_limit, $outlet_high_warn_limit, $outlet_high_limit, $outlet_current); - + if ($outlet_current >= 0) { + discover_sensor($valid_sensor, 'current', $device, $outlet_oid, $outlet_insert_index, 'sentry3', $outlet_descr, $outlet_divisor, $multiplier, $outlet_low_limit, $outlet_low_warn_limit, $outlet_high_warn_limit, $outlet_high_limit, $outlet_current); + } } // if ($outlet_data) unset($outlet_data); + unset($outlet_oids); + unset($outlet_oid); + unset($outlet_descr_string); + unset($outlet_descr); + unset($outlet_low_warn_limit); + unset($outlet_low_limit); + unset($outlet_high_warn_limit); + unset($outlet_high_limit); + unset($outlet_current); } // foreach (explode("\n", $outlet_oids) as $outlet_data) - unset($outlet_oids); - unset($outlet_oid); - unset($outlet_descr_string); - unset($outlet_descr); - unset($outlet_low_warn_limit); - unset($outlet_low_limit); - unset($outlet_high_warn_limit); - unset($outlet_high_limit); - unset($outlet_current); + } //if($infeed_data) + unset($infeed_data); + unset($infeed_oids); + unset($descr_string); + unset($descr); + unset($low_warn_limit); + unset($low_limit); + unset($high_warn_limit); + unset($high_limit); + unset($current); - } //if($data) - - unset($data); - - } //foreach (explode("\n", $oids) as $data) - - unset($oids); - unset($oid); - unset($descr_string); - unset($descr); - unset($low_warn_limit); - unset($low_limit); - unset($high_warn_limit); - unset($high_limit); - unset($current); + } //foreach (explode("\n", $infeed_oids) as $infeed_data) $towers++; } // while($towers <= $tower_count) + unset($towers); } ?> diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 1dbe76a2ed..3e9fe768f2 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -165,6 +165,7 @@ function discover_juniAtmVp(&$valid, $interface_id, $vp_id, $vp_descr) $sql = "INSERT INTO `juniAtmVp` (`interface_id`,`vp_id`,`vp_descr`) VALUES ('".$interface_id."','".$vp_id."','".$vp_descr."')"; mysql_query($sql); echo("+"); if ($debug) { echo($sql . " - " . mysql_affected_rows() . "inserted "); } + log_event("Juniper ATM VP Added: port ".mres($interface_id)." vp ".mres($vp_id)." descr". mres($vp_descr), 'juniAtmVp', mysql_insert_id()); } else { @@ -200,7 +201,6 @@ function discover_link($local_interface_id, $protocol, $remote_interface_id, $re echo("U"); if ($debug) {echo("$sql"); } } } - $link_exists[$local_interface_id][$remote_hostname][$remote_port] = 1; } @@ -227,7 +227,6 @@ function discover_storage(&$valid, $device, $index, $type, $mib, $descr, $size, mysql_query($query); if ($debug) { print $query . "\n"; } } - $valid[$mib][$index] = 1; } } @@ -248,6 +247,8 @@ function discover_processor(&$valid, $device, $oid, $index, $type, $descr, $prec mysql_query($query); if ($debug) { print $query . "\n"; } echo("+"); + log_event("Processor added: type ".mres($type)." index ".mres($index)." descr ". mres($descr), 'processor', mysql_insert_id()); + } else { @@ -257,7 +258,6 @@ function discover_processor(&$valid, $device, $oid, $index, $type, $descr, $prec mysql_query($query); if ($debug) { print $query . "\n"; } } - $valid[$type][$index] = 1; } } @@ -287,7 +287,6 @@ function discover_mempool(&$valid, $device, $index, $type, $descr, $precision = mysql_query($query); if ($debug) { print $query . "\n"; } } - $valid[$type][$index] = 1; } } @@ -318,8 +317,7 @@ function discover_toner(&$valid, $device, $oid, $index, $type, $descr, $capacity echo("U"); } } - $valid[$type][$index] = 1; } -?> \ No newline at end of file +?> diff --git a/includes/discovery/humidity/sentry3.inc.php b/includes/discovery/humidity/sentry3.inc.php index 038027487a..b32437c184 100644 --- a/includes/discovery/humidity/sentry3.inc.php +++ b/includes/discovery/humidity/sentry3.inc.php @@ -28,7 +28,9 @@ if ($device['os'] == 'sentry3') $high_limit = snmp_get($device,"tempHumidSensorHumidHighThresh.1.$index", "-Ovq", "Sentry3-MIB"); $current = snmp_get($device,"$humidity_oid", "-Ovq", "Sentry3-MIB"); - discover_sensor($valid_sensor, 'humidity', $device, $humidity_oid, $index, 'sentry3', $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current); + if ($current >= 0) { + discover_sensor($valid_sensor, 'humidity', $device, $humidity_oid, $index, 'sentry3', $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current); + } } unset($data); } diff --git a/includes/discovery/temperatures/sentry3.inc.php b/includes/discovery/temperatures/sentry3.inc.php index f62e6a7664..3d43dca2a1 100644 --- a/includes/discovery/temperatures/sentry3.inc.php +++ b/includes/discovery/temperatures/sentry3.inc.php @@ -28,7 +28,9 @@ if ($device['os'] == "sentry3") $high_limit = snmp_get($device,"tempHumidSensorTempHighThresh.1.$index", "-Ovq", "Sentry3-MIB") / $divisor; $current = snmp_get($device,"$temperature_oid", "-Ovq", "Sentry3-MIB") / $divisor; - discover_sensor($valid_sensor, 'temperature', $device, $temperature_oid, $index, 'sentry3', $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current); + if ($current >= 0) { + discover_sensor($valid_sensor, 'temperature', $device, $temperature_oid, $index, 'sentry3', $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current); + } } unset($data); } diff --git a/includes/discovery/voltages/apc.inc.php b/includes/discovery/voltages/apc.inc.php index 9eeff5aa42..635748a237 100644 --- a/includes/discovery/voltages/apc.inc.php +++ b/includes/discovery/voltages/apc.inc.php @@ -72,6 +72,22 @@ if ($device['os'] == "apc") discover_sensor($valid_sensor, 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); } + + #PDU + #$oids = snmp_get($device, "1.3.6.1.4.1.318.1.1.12.1.15.0", "-OsqnU", ""); + $oids = snmp_walk($device, "rPDUIdentDeviceLinetoLineVoltage.0", "-OsqnU", "PowerNet-MIB"); + if ($debug) { echo($oids."\n"); } + if ($oids) + { + echo(" Voltage In "); + list($oid,$current) = explode(" ",$oids); + $divisor = 1; + $type = "apc"; + $index = "1"; + $descr = "Input"; + + discover_sensor($valid_sensor, 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); + } } -?> \ No newline at end of file +?>