From d1d5b280e0943f8dc7ff0fa050b9a7a114cbdd4c Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Tue, 10 Nov 2009 10:19:30 +0000 Subject: [PATCH] added git-svn-id: http://www.observium.org/svn/observer/trunk@506 61d68cd4-352d-0410-923a-c4978735b2b8 --- .../includes/graphs/device_memory_ios.inc.php | 27 +++++++++++++- includes/polling/device-ios.inc.php | 36 +++++++++++++++++-- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/html/includes/graphs/device_memory_ios.inc.php b/html/includes/graphs/device_memory_ios.inc.php index e5a874a336..053598f33e 100644 --- a/html/includes/graphs/device_memory_ios.inc.php +++ b/html/includes/graphs/device_memory_ios.inc.php @@ -4,9 +4,11 @@ include("common.inc.php"); $rrd_options .= " -l 0 -E -b 1024 -u 100 -r"; + $count = mysql_result(mysql_query("SELECT COUNT(*) FROM `cempMemPool` WHERE `device_id` = '$device_id'"),0); + +if($count > '0') { $iter = "1"; $rrd_options .= " COMMENT:' Currently Used Max\\n'"; - $sql = mysql_query("SELECT * FROM `cempMemPool` where `device_id` = '$device_id'"); while($mempool = mysql_fetch_array($sql)) { $entPhysicalName = mysql_result(mysql_query("SELECT entPhysicalName from entPhysical WHERE device_id = '".$device_id."' @@ -34,5 +36,28 @@ include("common.inc.php"); $rrd_options .= " GPRINT:mempool" . $iter . "total:MAX:%3.0lf%%\\\\n"; $iter++; } +} else { + $database = $config['rrd_dir'] . "/" . $hostname . "/ios-mem.rrd"; + $rrd_options .= " DEF:MEMTOTAL=$database:MEMTOTAL:AVERAGE"; + $rrd_options .= " DEF:IOFREE=$database:IOFREE:AVERAGE"; + $rrd_options .= " DEF:IOUSED=$database:IOUSED:AVERAGE"; + $rrd_options .= " DEF:PROCFREE=$database:PROCFREE:AVERAGE"; + $rrd_options .= " DEF:PROCUSED=$database:PROCUSED:AVERAGE"; + $rrd_options .= " CDEF:FREE=IOFREE,PROCFREE,+"; + $rrd_options .= " CDEF:USED=IOUSED,PROCUSED,+"; + $rrd_options .= " COMMENT:Bytes\ \ \ \ Current\ \ Minimum\ \ Maximum\ \ Average\\\\n"; + $rrd_options .= " AREA:USED#ff6060:"; + $rrd_options .= " LINE2:USED#cc0000:Used"; + $rrd_options .= " GPRINT:USED:LAST:%6.2lf%s"; + $rrd_options .= " GPRINT:USED:MIN:%6.2lf%s"; + $rrd_options .= " GPRINT:USED:MAX:%6.2lf%s"; + $rrd_options .= " GPRINT:USED:AVERAGE:%6.2lf%s\\\\l"; + $rrd_options .= " AREA:FREE#e5e5e5:Free:STACK"; + $rrd_options .= " GPRINT:FREE:LAST:%6.2lf%s"; + $rrd_options .= " GPRINT:FREE:MIN:%6.2lf%s"; + $rrd_options .= " GPRINT:FREE:MAX:%6.2lf%s"; + $rrd_options .= " GPRINT:FREE:AVERAGE:%6.2lf%s\\\\l"; + $rrd_options .= " LINE1:MEMTOTAL#000000:"; +} ?> diff --git a/includes/polling/device-ios.inc.php b/includes/polling/device-ios.inc.php index 90b1a3e20e..2733f866d5 100755 --- a/includes/polling/device-ios.inc.php +++ b/includes/polling/device-ios.inc.php @@ -6,9 +6,8 @@ $port = $device['port']; $snmpver = $device['snmpver']; - $temprrd = $config['rrd_dir'] . "/" . $hostname . "/temp.rrd"; - $cpurrd = $config['rrd_dir'] . "/" . $hostname . "/cpu.rrd"; - $memrrd = $config['rrd_dir'] . "/" . $hostname . "/mem.rrd"; + $cpurrd = $config['rrd_dir'] . "/" . $hostname . "/ios-cpu.rrd"; + $memrrd = $config['rrd_dir'] . "/" . $hostname . "/ios-mem.rrd"; if(strstr($ciscomodel, "OID")){ unset($ciscomodel); } if(!strstr($ciscomodel, " ") && strlen($ciscomodel) >= '3') { @@ -43,6 +42,37 @@ shell_exec($config['rrdtool'] . " update $cpurrd N:$cpu5s:$cpu5m"); + $mem_get = ".1.3.6.1.4.1.9.9.48.1.1.1.6.2 .1.3.6.1.4.1.9.9.48.1.1.1.6.1 .1.3.6.1.4.1.9.9.48.1.1.1.6.3"; + $mem_get .= ".1.3.6.1.4.1.9.9.48.1.1.1.5.2 .1.3.6.1.4.1.9.9.48.1.1.1.5.1 .1.3.6.1.4.1.9.9.48.1.1.1.5.3"; + $mem_raw = shell_exec($config['snmpget'] . " -O qv -v2c -c $community $hostname:$port $mem_get"); + $mem_raw = str_replace("No Such Instance currently exists at this OID", "0", $mem_raw); + list ($memfreeio, $memfreeproc, $memfreeprocb, $memusedio, $memusedproc, $memusedprocb) = explode("\n", $mem_raw); + $memfreeproc = $memfreeproc + $memfreeprocb; + $memusedproc = $memusedproc + $memusedprocb; + $memfreeio = $memfreeio + 0; + $memfreeproc = $memfreeproc + 0; + $memusedio = $memusedio + 0; + $memusedproc = $memusedproc + 0; + $memtotal = $memfreeio + $memfreeproc + $memusedio + $memusedproc; + if (!is_file($memrrd)) { + shell_exec($config['rrdtool'] ." create $memrrd --step 300 \ + DS:IOFREE:GAUGE:600:0:U \ + DS:IOUSED:GAUGE:600:-1:U \ + DS:PROCFREE:GAUGE:600:0:U \ + DS:PROCUSED:GAUGE:600:-1:U \ + DS:MEMTOTAL:GAUGE:600:-1:U \ + RRA:AVERAGE:0.5:1:2000 \ + RRA:AVERAGE:0.5:6:2000 \ + RRA:AVERAGE:0.5:24:2000 \ + RRA:AVERAGE:0.5:288:2000 \ + RRA:MAX:0.5:1:2000 \ + RRA:MAX:0.5:6:2000 \ + RRA:MAX:0.5:24:2000 \ + RRA:MAX:0.5:288:2000"); + + } + rrdtool_update ($memrrd, "N:$memfreeio:$memusedio:$memfreeproc:$memusedproc:$memtotal"); + include("includes/polling/bgpPeer.inc.php"); include("includes/polling/cisco-processors.inc.php"); include("includes/polling/cisco-mempool.inc.php");