Ad blocker detected: Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker on our website.
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.
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
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.
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
True understanding begins only when we realize how little we truly understand...
TheWitness wrote: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
Thanks for the info. I have very limited time to work on this, but i certainly will add these features if nobody beats me to it. I finally had a chance last night to do the remove_graph.php. I will upload it shortly.
TheWitness wrote: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
Was there ever an update to this cli script that incorporated these items?
testing the scrtipt against 8.7g and it seems to remove the graph, although when going back into the interfaces on the device and choosing 64 bit counters the interface which had the 64 bit graph running on it is still greyed out so i am assuming that there are more modifications required to the db to remove this lock?
Looks like the data source has not been remove so that is why the lock is still in place.
In this case, the cli script seems to delete the graph only, not the data source. As long as the data source exists, the according line will be greyed out.
R.