Deleting of devices / graphs through CLI

Anything that you think should be in Cacti.

Moderators: Developers, Moderators

Post Reply
nightsailor
Posts: 7
Joined: Thu Jan 26, 2012 6:21 am

Deleting of devices / graphs through CLI

Post by nightsailor »

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
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Deleting of devices / graphs through CLI

Post by gandalf »

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.
nightsailor
Posts: 7
Joined: Thu Jan 26, 2012 6:21 am

Re: Deleting of devices / graphs through CLI

Post by nightsailor »

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.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Deleting of devices / graphs through CLI

Post by gandalf »

We should go by concept of API function calls. Let me have a minute to hack sth together
R.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Deleting of devices / graphs through CLI

Post by gandalf »

This is a backport from 1.0.0, not really tested. Use with care. You know what I mean.
R.
Attachments
device_delete.php.gz
delete device script
(4.55 KiB) Downloaded 440 times
nightsailor
Posts: 7
Joined: Thu Jan 26, 2012 6:21 am

Re: Deleting of devices / graphs through CLI

Post by nightsailor »

Thanks a lot, I will try it tommorrow.

Regards
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Deleting of devices / graphs through CLI

Post by gandalf »

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.
nightsailor
Posts: 7
Joined: Thu Jan 26, 2012 6:21 am

Re: Deleting of devices / graphs through CLI

Post by nightsailor »

Have tested it today and so far it works... excellent, thx!
mstbone67a
Posts: 28
Joined: Mon Sep 21, 2009 9:31 am

Re: Deleting of devices / graphs through CLI

Post by mstbone67a »

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
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Deleting of devices / graphs through CLI

Post by gandalf »

mstbone67a wrote:Does this get rid of the rrd files..
No, by design not.
installing rrdcleaner.. tonight
Yep, the recommended move
R.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests