From 7efdf5d9aaa09014a41204c954a922795d18f707 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Fri, 5 Feb 2010 23:20:15 +0000 Subject: [PATCH] one less fork if no cpu usage could be read on junos (i.e. olive) git-svn-id: http://www.observium.org/svn/observer/trunk@770 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/polling/device-junos.inc.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/polling/device-junos.inc.php b/includes/polling/device-junos.inc.php index a6cee9d2f..bd0e50808 100644 --- a/includes/polling/device-junos.inc.php +++ b/includes/polling/device-junos.inc.php @@ -25,8 +25,10 @@ $cpu_cmd = $config['snmpget'] . " -m JUNIPER-MIB -O qv -" . $device['snmpver'] $cpu_cmd .= " .1.3.6.1.4.1.2636.3.1.13.1.8.9.1.0.0"; $cpu_usage = trim(shell_exec($cpu_cmd)); -if (!is_file($cpurrd)) { - shell_exec($config['rrdtool'] . " create $cpurrd \ +if (is_numeric($cpu_usage)) +{ + if (!is_file($cpurrd)) { + shell_exec($config['rrdtool'] . " create $cpurrd \ --step 300 \ DS:cpu:GAUGE:600:0:100 \ RRA:AVERAGE:0.5:1:800 \ @@ -37,9 +39,11 @@ if (!is_file($cpurrd)) { RRA:MAX:0.5:6:800 \ RRA:MAX:0.5:24:800 \ RRA:MAX:0.5:288:800"); -} + } -shell_exec($config['rrdtool'] . " update $cpurrd N:$cpu_usage"); + if ($cpu_usage) { echo "CPU: $cpu_usage%\n"; } + shell_exec($config['rrdtool'] . " update $cpurrd N:$cpu_usage"); +} include("hr-mib.inc.php");