Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


remove_device.php & remove_graph.php CLI scripts

 
Post new topic   Reply to topic    Cacti Forum Index -> Addons for Cacti
Author Message
aimonb



Joined: 10 Jun 2008
Posts: 3

PostPosted: Tue Jun 10, 2008 3:04 am    Post subject: remove_device.php & remove_graph.php CLI scripts Reply with quote

Given the advent of cloud computing and the ultimate reality that servers will disappear forever having the ability to use the CLI to remove devices and graphs has become quite useful. So I have created remove_device.php & remove_graph.php CLI files which i would like to contribute. I used as much as possible the programming style of the add_device.php and add_graph.php files.

I will add the remove_graph.php file soon.

Code:

A very simple command line utility to remove a device or multiple devices from Cacti

Remove device usage: remove_device.php --device-id=[device ids]
Required:
    --device-id    comma separated list of host/device IDs.

List devices usage: remove_device.php --list-devices

List Options:
    --list-devices    Lists all devices



remove_device.php.zip
 Description:
1.0.1 tag. This contains minor fix to help output.

uncompress and drop in the CLI folder in your cacti install

Download
 Filename:  remove_device.php.zip
 Filesize:  1.17 KB
 Downloaded:  86 Time(s)

Back to top
satish_kumarp2k1



Joined: 25 Mar 2008
Posts: 9
Location: Bangalore

PostPosted: Mon Sep 08, 2008 5:21 am    Post subject: Reply with quote

Hi,

Can you also upload the script to delete graphs?

Thanks
Back to top
aimonb



Joined: 10 Jun 2008
Posts: 3

PostPosted: Thu Sep 11, 2008 1:31 am    Post subject: Reply with quote

satish_kumarp2k1 wrote:
Hi,

Can you also upload the script to delete graphs?

Thanks


I have yet to write it. The other script only took me a couple of hours. This should be about as easy. I am mid sprint for a release though. I will get it up after Oct 1st.
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 9689
Location: MI, USA

PostPosted: Fri Sep 12, 2008 6:20 am    Post subject: Reply with quote

Make sure you provide an option to either Delete Graphs and Data Sources for both scripts. The default should be "yes", even though the default in Cacti for deleting Graphs is "no".

You should also allow specifying either a substring range, or regular expression, and provide the user the ability to confirm before delete. Like do the query, show the rows and then delete if the response comes back to proceed. Provide an option to "force".

There are lot's of example on how I have written argument handling in the add* scripts.

Thanks for contributing.

TheWitness
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Addons for Cacti All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group