From 949fd9777b7c222cb5d4ef910dc7d5dc90586771 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Tue, 16 Feb 2010 20:45:40 +0000 Subject: [PATCH] multiple directories for rancid configs (use array instead of text variable) git-svn-id: http://www.observium.org/svn/observer/trunk@874 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/pages/device.php | 10 +++++++++- html/pages/device/overview/temperatures.inc.php | 2 +- html/pages/device/showconfig.inc.php | 16 +++++++++++----- includes/discovery/temperatures.php | 4 +++- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/html/pages/device.php b/html/pages/device.php index 5c1c4c9be..f45fdfec7 100644 --- a/html/pages/device.php +++ b/html/pages/device.php @@ -172,7 +172,15 @@ echo('
  • '); } -if($_SESSION['userlevel'] >= "5" && is_file($config['rancid_configs'] . $device['hostname'])) { + + +if($_SESSION['userlevel'] >= "5") { + if(!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_configs']); } + foreach($config['rancid_configs'] as $configs) { + if(is_file($configs . $device['hostname'])) { $device_config_file = $configs . $device['hostname']; } + } +} +if($device_config_file) { echo('
  • Config diff --git a/html/pages/device/overview/temperatures.inc.php b/html/pages/device/overview/temperatures.inc.php index 6462eff13..6794c169c 100644 --- a/html/pages/device/overview/temperatures.inc.php +++ b/html/pages/device/overview/temperatures.inc.php @@ -28,7 +28,7 @@ if(mysql_result(mysql_query("SELECT count(temp_id) from temperature WHERE device $temp_link .= "overlib('
    ".$device['hostname']." - ".$temp['temp_descr']; $temp_link .= "
    ', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >"; - $temp_link_c = $temp_link . "" . $temp['temp_current'] . "°C
    "; + $temp_link_c = $temp_link . "" . round($temp['temp_current'],0) . "°C"; $temp_link_b = $temp_link . $temp_minigraph . ""; $temp_link_a = $temp_link . $temp['temp_descr'] . ""; diff --git a/html/pages/device/showconfig.inc.php b/html/pages/device/showconfig.inc.php index ea02ef7a8..7514ac118 100644 --- a/html/pages/device/showconfig.inc.php +++ b/html/pages/device/showconfig.inc.php @@ -2,11 +2,18 @@ include("includes/geshi/geshi.php"); -if($_SESSION['userlevel'] >= "5" && is_file($config['rancid_configs'] . $device['hostname'])) { - $file = $config['rancid_configs'] . $device['hostname']; +if($_SESSION['userlevel'] >= "5") { + + if(!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_configs']); } + + foreach($config['rancid_configs'] as $configs) { + if(is_file($configs . $device['hostname'])) { $file = $configs . $device['hostname']; } + } + $fh = fopen($file, 'r') or die("Can't open file"); $text = fread($fh, filesize($file)); fclose($fh); + if ($config['rancid_ignorecomments']) { $lines = split("\n",$text); @@ -20,10 +27,9 @@ if($_SESSION['userlevel'] >= "5" && is_file($config['rancid_configs'] . $device[ $geshi = new GeSHi($text, $language); $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS); $geshi->set_overall_style('color: black;'); -# $geshi->set_line_style('color: #999999'); + #$geshi->set_line_style('color: #999999'); echo $geshi->parse_code(); -} else { - print_error("Error : Insufficient access."); + } ?> diff --git a/includes/discovery/temperatures.php b/includes/discovery/temperatures.php index e279c6e17..8175653b5 100755 --- a/includes/discovery/temperatures.php +++ b/includes/discovery/temperatures.php @@ -30,7 +30,9 @@ if($device['os'] == "ironware") $descr = str_replace("temperature", "", $descr); $descr = str_replace("temp", "", $descr); $descr = str_replace("sensor", "Sensor", $descr); - $descr = str_replace("Line module", "Line Mod", $descr); + $descr = str_replace("Line module", "Slot", $descr); + $descr = str_replace("Switch Fabric module", "Fabric", $descr); + $descr = str_replace("Active management module", "Mgmt Module", $descr); $descr = str_replace(" ", " ", $descr); $descr = trim($descr); if (mysql_result(mysql_query("SELECT count(temp_id) FROM `temperature` WHERE temp_oid = '$temp_oid' AND device_id = '$id'"),0) == '0')