From 8fc2f2e75643c04ddbbdf83452f398ff96b9ad10 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Sun, 21 Feb 2010 05:08:58 +0000 Subject: [PATCH] cpu polling support for Juniper JunOS. tested on m7i only git-svn-id: http://www.observium.org/svn/observer/trunk@910 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/defaults.inc.php | 3 +++ includes/discovery/processors.inc.php | 1 + includes/functions-poller.inc.php | 21 +++++++++++++++++++++ test-discovery.php | 2 ++ 4 files changed, 27 insertions(+) diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 89ea29f50..4a9361f72 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -60,6 +60,9 @@ $config['bad_if'] = array("voip-null", "virtual-", "unrouted", "eobc", "mpls", " $config['bad_if_regexp'] = array("/serial[0-9]:/"); +$config['processor_filter'][] = "An electronic chip that makes the computer work."; + + # Sensors $config['allow_entity_sensor']['amperes'] = 1; diff --git a/includes/discovery/processors.inc.php b/includes/discovery/processors.inc.php index 5a2cd1be0..0b375e096 100755 --- a/includes/discovery/processors.inc.php +++ b/includes/discovery/processors.inc.php @@ -4,6 +4,7 @@ echo("Processors : "); include("processors-ios.inc.php"); include("processors-junose.inc.php"); +include("processors-junos.inc.php"); include("processors-hrdevice.inc.php"); include("processors-ironware.inc.php"); diff --git a/includes/functions-poller.inc.php b/includes/functions-poller.inc.php index 2e0a80b98..5a81c5a60 100644 --- a/includes/functions-poller.inc.php +++ b/includes/functions-poller.inc.php @@ -96,6 +96,27 @@ function snmpwalk_cache_oid($poll_oid, $device, $array, $mib = NULL, $mibdir = N return $array; } +function snmpwalk_cache_multi_oid($device, $oid, $array, $mib = NULL, $mibdir = NULL) { + $data = snmp_walk($device, $oid, "-OQUs", $mib, $mibdir); + foreach(explode("\n", $data) as $entry) { + list($oid,$value) = explode("=", $entry); + $oid = trim($oid); $value = trim($value); + $oid_parts = explode(".", $oid); + $oid = $oid_parts['0']; + $index = $oid_parts['1']; + if(isset($oid_parts['2'])) { $index .= ".".$oid_parts['2']; } + if(isset($oid_parts['3'])) { $index .= ".".$oid_parts['3']; } + if(isset($oid_parts['4'])) { $index .= ".".$oid_parts['4']; } + if(isset($oid_parts['5'])) { $index .= ".".$oid_parts['5']; } + if(isset($oid_parts['6'])) { $index .= ".".$oid_parts['6']; } + if (!strstr($value, "at this OID") && isset($oid) && isset($index)) { + $array[$device[device_id]][$index][$oid] = $value; + } + } + return $array; +} + + function snmpwalk_cache_double_oid($device, $oid, $array, $mib = NULL, $mibdir = NULL) { $data = snmp_walk($device, $oid, "-OQUs", $mib, $mibdir); foreach(explode("\n", $data) as $entry) { diff --git a/test-discovery.php b/test-discovery.php index a51b8923e..856efce7c 100755 --- a/test-discovery.php +++ b/test-discovery.php @@ -44,6 +44,8 @@ $devices_polled = 0; echo("includes/discovery/".$type.".php \n"); +$debug = 1; + $device_query = mysql_query("SELECT * FROM `devices` WHERE status = '1' $where ORDER BY device_id ASC"); while ($device = mysql_fetch_array($device_query)) {