From 89c5af8ff9106d908e056f777506ebf31914c263 Mon Sep 17 00:00:00 2001 From: Rudy Hardeman Date: Wed, 20 May 2015 11:59:59 +0200 Subject: [PATCH 1/3] Removed if for junos check so srx dataplane cpu is checked --- includes/discovery/processors/junos.inc.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/includes/discovery/processors/junos.inc.php b/includes/discovery/processors/junos.inc.php index d6fc75379..78cc5a543 100644 --- a/includes/discovery/processors/junos.inc.php +++ b/includes/discovery/processors/junos.inc.php @@ -28,22 +28,19 @@ if ($device['os'] == "junos") } // End if checks } // End Foreach } // End if array - else - { $srx_processors_array = snmpwalk_cache_multi_oid($device, "jnxJsSPUMonitoringCPUUsage", $srx_processors_array, "JUNIPER-SRX5000-SPU-MONITORING-MIB" , '+'.$config['install_dir']."/mibs/junos"); - if (is_array($srx_processors_array)) + if (is_array($srx_processors_array)) + { + foreach ($srx_processors_array as $index => $entry) { - foreach ($srx_processors_array as $index => $entry) + if ($index) { - if ($index) - { - $usage_oid = ".1.3.6.1.4.1.2636.3.39.1.12.1.1.1.4." . $index; - $descr = "CPU"; # No description in the table? - $usage = $entry['jnxJsSPUMonitoringCPUUsage']; + $usage_oid = ".1.3.6.1.4.1.2636.3.39.1.12.1.1.1.4." . $index; + $descr = "CPU"; # No description in the table? + $usage = $entry['jnxJsSPUMonitoringCPUUsage']; - discover_processor($valid['processor'], $device, $usage_oid, $index, "junos", $descr, "1", $usage, NULL, NULL); - } + discover_processor($valid['processor'], $device, $usage_oid, $index, "junos", $descr, "1", $usage, NULL, NULL); } } } From f0f1038b42875a7023f768143ec115e5985caa8e Mon Sep 17 00:00:00 2001 From: Rudy Hardeman Date: Wed, 20 May 2015 13:00:32 +0200 Subject: [PATCH 2/3] Added debug option --- includes/discovery/processors/junos.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/discovery/processors/junos.inc.php b/includes/discovery/processors/junos.inc.php index 78cc5a543..b8caecb84 100644 --- a/includes/discovery/processors/junos.inc.php +++ b/includes/discovery/processors/junos.inc.php @@ -28,8 +28,9 @@ if ($device['os'] == "junos") } // End if checks } // End Foreach } // End if array - $srx_processors_array = snmpwalk_cache_multi_oid($device, "jnxJsSPUMonitoringCPUUsage", $srx_processors_array, "JUNIPER-SRX5000-SPU-MONITORING-MIB" , '+'.$config['install_dir']."/mibs/junos"); + $srx_processors_array = snmpwalk_cache_multi_oid($device, "jnxJsSPUMonitoringCPUUsage", $srx_processors_array, "JUNIPER-SRX5000-SPU-MONITORING-MIB" , '+'.$config['install_dir']."/mibs/junos"); + if ($debug) { print_r($processors_array); } if (is_array($srx_processors_array)) { foreach ($srx_processors_array as $index => $entry) From fc16d9f410dcfd35358663d55fbe590ade54599a Mon Sep 17 00:00:00 2001 From: Rudy Hardeman Date: Wed, 20 May 2015 13:04:45 +0200 Subject: [PATCH 3/3] Fixed if --- includes/discovery/processors/junos.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/discovery/processors/junos.inc.php b/includes/discovery/processors/junos.inc.php index b8caecb84..f07fad372 100644 --- a/includes/discovery/processors/junos.inc.php +++ b/includes/discovery/processors/junos.inc.php @@ -35,7 +35,7 @@ if ($device['os'] == "junos") { foreach ($srx_processors_array as $index => $entry) { - if ($index) + if (isset($index) && $index >= 0) { $usage_oid = ".1.3.6.1.4.1.2636.3.39.1.12.1.1.1.4." . $index; $descr = "CPU"; # No description in the table?