mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
@@ -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 />");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user