mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-30 16:14:21 +02:00
Introduce own librenms user and remove rrds when removing a device
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
# YES, THAT MEANS YOU #
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
umask(0002);
|
||||
|
||||
$config['os']['default']['over'][0]['graph'] = "device_processor";
|
||||
$config['os']['default']['over'][0]['text'] = "Processor Usage";
|
||||
$config['os']['default']['over'][1]['graph'] = "device_mempool";
|
||||
|
||||
@@ -240,6 +240,9 @@ function delete_device($id)
|
||||
$ret = '';
|
||||
|
||||
$host = dbFetchCell("SELECT hostname FROM devices WHERE device_id = ?", array($id));
|
||||
if( empty($host) ) {
|
||||
return "No such host.";
|
||||
}
|
||||
|
||||
foreach (dbFetch("SELECT * FROM `ports` WHERE `device_id` = ?", array($id)) as $int_data)
|
||||
{
|
||||
@@ -260,7 +263,11 @@ function delete_device($id)
|
||||
}
|
||||
}
|
||||
|
||||
shell_exec("rm -rf ".trim($config['rrd_dir'])."/$host");
|
||||
$ex = shell_exec("bash -c '( [ ! -d ".trim($config['rrd_dir'])."/".$host." ] || rm -vrf ".trim($config['rrd_dir'])."/".$host." 2>&1 ) && echo -n OK'");
|
||||
$tmp = explode("\n",$ex);
|
||||
if( $tmp[sizeof($tmp)-1] != "OK" ) {
|
||||
$ret .= "Could not remove files:\n$ex\n";
|
||||
}
|
||||
|
||||
$ret .= "Removed device $host\n";
|
||||
return $ret;
|
||||
|
||||
Reference in New Issue
Block a user