Deleting of devices / graphs through CLI
Moderators: Developers, Moderators
-
- Posts: 7
- Joined: Thu Jan 26, 2012 6:21 am
Deleting of devices / graphs through CLI
Hi,
first of all. I love Cacti and it really is an excellent and customizable tool for network monitoring.
I can seem to find deleting devices over CLI, which would be most welcome since adding works perfectly.
Am I looking on the wrong location / how can I remove the device that is no longer needed to be monitored?
TIA
first of all. I love Cacti and it really is an excellent and customizable tool for network monitoring.
I can seem to find deleting devices over CLI, which would be most welcome since adding works perfectly.
Am I looking on the wrong location / how can I remove the device that is no longer needed to be monitored?
TIA
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: Deleting of devices / graphs through CLI
We did not yet create such delete scripts. I do not want to be blamed for a failing script that deleted all hosts e.g. due to a misuse of parameters or whatever. You know, in case we recommend a db dump before using a delete, nobody even will consider to REALLY do so ...
R.
R.
-
- Posts: 7
- Joined: Thu Jan 26, 2012 6:21 am
Re: Deleting of devices / graphs through CLI
Gandalf, thanks for your reply.
I will not blame anyone, I totally understand the concept of the open source
Basically I have an issue where I can successfully add the devices, but when are they pulled out of the network, they still exist in the polling database so the times of polling increase because of waiting to those responds. It looks like it shouldn't be too complicated - if you could give me some ideas, from which tables should the data be removed. If there would be a way to get all the data from the correct tables and the input information is hostname and then just deleting it? Dont know, just thinking
Thanks for any pointers or information though.
Best regards.
I will not blame anyone, I totally understand the concept of the open source
Basically I have an issue where I can successfully add the devices, but when are they pulled out of the network, they still exist in the polling database so the times of polling increase because of waiting to those responds. It looks like it shouldn't be too complicated - if you could give me some ideas, from which tables should the data be removed. If there would be a way to get all the data from the correct tables and the input information is hostname and then just deleting it? Dont know, just thinking
Thanks for any pointers or information though.
Best regards.
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: Deleting of devices / graphs through CLI
We should go by concept of API function calls. Let me have a minute to hack sth together
R.
R.
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: Deleting of devices / graphs through CLI
This is a backport from 1.0.0, not really tested. Use with care. You know what I mean.
R.
R.
- Attachments
-
- device_delete.php.gz
- delete device script
- (4.55 KiB) Downloaded 439 times
-
- Posts: 7
- Joined: Thu Jan 26, 2012 6:21 am
Re: Deleting of devices / graphs through CLI
Thanks a lot, I will try it tommorrow.
Regards
Regards
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: Deleting of devices / graphs through CLI
Strat with "--help". There's a huge amount of host selecting options.
Remember to use "--force" to drop graphs and data sources as well!!!
Default is to only drop hosts!
R.
Remember to use "--force" to drop graphs and data sources as well!!!
Default is to only drop hosts!
R.
-
- Posts: 7
- Joined: Thu Jan 26, 2012 6:21 am
Re: Deleting of devices / graphs through CLI
Have tested it today and so far it works... excellent, thx!
-
- Posts: 28
- Joined: Mon Sep 21, 2009 9:31 am
Re: Deleting of devices / graphs through CLI
Does this get rid of the rrd files..
I tried with a host and i saw the graphs go away in cacti but in the rra dir it still exists.
[cactiuser@ossccacti01 cli]$ ./device_delete.php --device-id=1966 --force
Removing device and all resources for device id 1966. Success - removed device id: 1966
The data sources go away in side cacti but remain in the directory on the servre
[cactiuser@ossccacti01 cli]$ ls -lrt /apps/cactiweb/cacti/rra/hostname-1_*
-rw-r--r-- 1 cactiuser cactiuser 2051104 Mar 6 18:07 /apps/cactiweb/cacti/rra/hostname-1_traffic_in_62883.rrd
-rw-r--r-- 1 cactiuser cactiuser 2051104 Mar 6 18:07 /apps/cactiweb/cacti/rra/hostname-1_traffic_in_62882.rrd
Poller runs every 15mins i believe and the files are still there 40mins later
In fact when i delete the device from the gui the rrd files also remain even if i choose "Delete all associated Graph(s) and Data Source(s). "
installing rrdcleaner.. tonight
I tried with a host and i saw the graphs go away in cacti but in the rra dir it still exists.
[cactiuser@ossccacti01 cli]$ ./device_delete.php --device-id=1966 --force
Removing device and all resources for device id 1966. Success - removed device id: 1966
The data sources go away in side cacti but remain in the directory on the servre
[cactiuser@ossccacti01 cli]$ ls -lrt /apps/cactiweb/cacti/rra/hostname-1_*
-rw-r--r-- 1 cactiuser cactiuser 2051104 Mar 6 18:07 /apps/cactiweb/cacti/rra/hostname-1_traffic_in_62883.rrd
-rw-r--r-- 1 cactiuser cactiuser 2051104 Mar 6 18:07 /apps/cactiweb/cacti/rra/hostname-1_traffic_in_62882.rrd
Poller runs every 15mins i believe and the files are still there 40mins later
In fact when i delete the device from the gui the rrd files also remain even if i choose "Delete all associated Graph(s) and Data Source(s). "
installing rrdcleaner.. tonight
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: Deleting of devices / graphs through CLI
No, by design not.mstbone67a wrote:Does this get rid of the rrd files..
Yep, the recommended moveinstalling rrdcleaner.. tonight
R.
Who is online
Users browsing this forum: No registered users and 7 guests