From e848814a19bdd723eb267dedbdc3df12eda2f371 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Mon, 16 Nov 2009 20:00:13 +0000 Subject: [PATCH] fixes to memory and CPU graphs on IOS. adding mixed colourscheme to static-config git-svn-id: http://www.observium.org/svn/observer/trunk@523 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/includes/graphs/device_cpu_ios.inc.php | 5 --- .../includes/graphs/device_memory_ios.inc.php | 4 ++- includes/static-config.php | 36 +++---------------- 3 files changed, 7 insertions(+), 38 deletions(-) diff --git a/html/includes/graphs/device_cpu_ios.inc.php b/html/includes/graphs/device_cpu_ios.inc.php index 5d7eff892..5deeb731d 100644 --- a/html/includes/graphs/device_cpu_ios.inc.php +++ b/html/includes/graphs/device_cpu_ios.inc.php @@ -4,14 +4,10 @@ $query = mysql_query("SELECT * FROM `cpmCPU` where `device_id` = '".mres($device $i=0; while($proc = mysql_fetch_array($query)) { - $rrd_filename = $config['rrd_dir'] . "/$hostname/cpmCPU-" . $proc['cpmCPU_oid'] . ".rrd"; - if(is_file($rrd_filename)) { - $descr = str_pad($proc['entPhysicalDescr'], 8); $descr = substr($descr,0,8); - $rrd_list[$i]['filename'] = $rrd_filename; $rrd_list[$i]['descr'] = $descr; $rrd_list[$i]['rra'] = "usage"; @@ -42,5 +38,4 @@ if($rrd_list) {include ("generic_multi_line.inc.php"); } else { $rrd_options .= " GPRINT:5m_max:MAX:%6.2lf\ GPRINT:5m:AVERAGE:%6.2lf\\\\n"; } - ?> diff --git a/html/includes/graphs/device_memory_ios.inc.php b/html/includes/graphs/device_memory_ios.inc.php index 87c8cc4a1..e17439467 100644 --- a/html/includes/graphs/device_memory_ios.inc.php +++ b/html/includes/graphs/device_memory_ios.inc.php @@ -34,7 +34,7 @@ if(mysql_result(mysql_query("SELECT COUNT(*) FROM `cempMemPool` WHERE `device_id $rrd_options .= " GPRINT:mempool" . $iter . "total:MAX:%3.0lf%%\\\\n"; $iter++; } -} else { +} elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `cmpMemPool` WHERE `device_id` = '$device_id'"),0) > '0') { $iter = "1"; $rrd_options .= " COMMENT:' Currently Used Max\\n'"; $sql = mysql_query("SELECT * FROM `cmpMemPool` where `device_id` = '$device_id'"); @@ -58,6 +58,8 @@ if(mysql_result(mysql_query("SELECT COUNT(*) FROM `cempMemPool` WHERE `device_id $rrd_options .= " GPRINT:mempool" . $iter . "total:MAX:%3.0lf%%\\\\n"; $iter++; } +} else { + } ?> diff --git a/includes/static-config.php b/includes/static-config.php index 88931b9ed..5fb225139 100644 --- a/includes/static-config.php +++ b/includes/static-config.php @@ -39,6 +39,10 @@ if(!$config['graph_colours']['purples']) { if(!$config['graph_colours']['default']) { $config['graph_colours']['default'] = $config['graph_colours']['blues']; } +if(!$config['graph_colours']['mixed']) { + $config['graph_colours']['mixed'] = array("CC0000", "008C00", "4096EE", "73880A", "D01F3C", "36393D", "FF0084"); +} + ############################## # No changes below this line # @@ -74,36 +78,4 @@ $week = time() - (7 * 24 * 60 * 60); $month = time() - (31 * 24 * 60 * 60); $year = time() - (365 * 24 * 60 * 60); - -### Update Database between 0.6.0 and 0.6.1 (slight slowdown) - -$exists = false; -$columns = @mysql_query("SHOW columns FROM `interfaces`"); -while($c = @mysql_fetch_assoc($columns)){ - if($c['Field'] == "pagpOperationMode"){ - $db_pagp = true; - } - if($c['Field'] == "portName"){ - $db_portName = true; - } - if($c['Field'] == "ifHighSpeed"){ - $db_ifHighSpeed = true; - } -} -if(!$db_pagp) { - mysql_query("ALTER TABLE `interfaces` ADD `pagpOperationMode` VARCHAR( 32 ) NULL , -ADD `pagpPortState` VARCHAR( 16 ) NULL , -ADD `pagpPartnerDeviceId` VARCHAR( 48 ) NULL , -ADD `pagpPartnerLearnMethod` VARCHAR( 16 ) NULL , -ADD `pagpPartnerIfIndex` INT NULL , -ADD `pagpPartnerGroupIfIndex` INT NULL , -ADD `pagpPartnerDeviceName` VARCHAR( 128 ) NULL , -ADD `pagpEthcOperationMode` VARCHAR( 16 ) NULL , -ADD `pagpDeviceId` VARCHAR( 48 ) NULL , -ADD `pagpGroupIfIndex` INT NULL"); } - -if(!$db_portName) { mysql_query("ALTER TABLE `interfaces` ADD `portName` VARCHAR( 128 ) NULL DEFAULT NULL AFTER `ifName`"); } -if(!$db_ifHighSpeed) { mysql_query("ALTER TABLE `interfaces` ADD `ifHighSpeed` INT ( 11 ) NULL DEFAULT NULL AFTER `ifSpeed`"); } - - ?>