remove the last usage of config variables outside of the $config array ($rrd_file) + fixed adduser script

git-svn-id: http://www.observium.org/svn/observer/trunk@354 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2009-03-16 15:19:44 +00:00
parent 98ba6a4f83
commit 83eb114da1
18 changed files with 74 additions and 91 deletions

View File

@@ -216,8 +216,8 @@ function truncate($substring, $max = 50, $rep = '...')
function interface_rates ($interface)
{
global $config, $rrd_dir;
$rrdfile = $rrd_dir . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd";
global $config;
$rrdfile = $config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd";
$cmd = $config['rrdtool']." fetch -s -600s -e now ".$rrdfile." AVERAGE | grep : | cut -d\" \" -f 2,3 | grep e";
$data = trim(`$cmd`);
foreach( explode("\n", $data) as $entry) {
@@ -231,8 +231,8 @@ function interface_rates ($interface)
function interface_errors ($interface)
{
global $config, $rrd_dir;
$rrdfile = $rrd_dir . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd";
global $config;
$rrdfile = $config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd";
$cmd = $config['rrdtool']." fetch -s -1d -e -300s $rrdfile AVERAGE | grep : | cut -d\" \" -f 4,5";
$data = trim(`$cmd`);
foreach( explode("\n", $data) as $entry) {
@@ -356,9 +356,8 @@ function delHost($id)
mysql_query("DELETE FROM `interfaces` WHERE `device_id` = '$id'");
mysql_query("DELETE FROM `services` WHERE `service_host` = '$id'");
mysql_query("DELETE FROM `alerts` WHERE `device_id` = '$id'");
$rrd_dir = $config['rrd_dir'];
`rm -f $rrd_dir/$host-*.rrd`;
`rm -rf $rrd_dir/$host`;
shell_exec("rm -f ".$config['rrd_dir'] . "/$host-*.rrd");
shell_exec("rm -rf ".$config['rrd_dir']."/$host");
echo("Removed device $host<br />");
}