Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Wed Jun 28, 2017 10:48 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: remove_device.php & remove_graph.php CLI scripts
PostPosted: Tue Jun 10, 2008 3:04 am 
Offline

Joined: Tue Jun 10, 2008 2:59 am
Posts: 6
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


Attachments:
File comment: 1.0.1 tag. This contains minor fix to help output.

uncompress and drop in the CLI folder in your cacti install

remove_device.php.zip [1.17 KiB]
Downloaded 1162 times
Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2008 5:21 am 
Offline

Joined: Tue Mar 25, 2008 7:53 am
Posts: 9
Location: Bangalore
Hi,

Can you also upload the script to delete graphs?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 11, 2008 1:31 am 
Offline

Joined: Tue Jun 10, 2008 2:59 am
Posts: 6
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.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 12, 2008 6:20 am 
Offline
Developer
User avatar

Joined: Tue May 14, 2002 5:08 pm
Posts: 14863
Location: MI, USA
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...

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
Gandalfs Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 21, 2009 3:19 am 
Offline

Joined: Tue Jun 10, 2008 2:59 am
Posts: 6
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.

Aimon


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 21, 2009 3:21 am 
Offline

Joined: Tue Jun 10, 2008 2:59 am
Posts: 6
satish_kumarp2k1 wrote:
Hi,

Can you also upload the script to delete graphs?

Thanks


Hi I finally had a chance to work on this. I will be uploading the remove_graph.php shortly.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 06, 2009 8:55 am 
Offline

Joined: Mon Apr 21, 2008 2:49 pm
Posts: 22
Was this remove_graph.php ever posted?

I'm running 0.8.7b and the SVN version seems to be for a later release (and I'm not up to upgrading just yet) :)

Thanks!


Top
 Profile  
 
 Post subject: remove_graphs.php
PostPosted: Tue Oct 20, 2009 2:26 am 
Offline

Joined: Tue Jun 10, 2008 2:59 am
Posts: 6
this project died a bit internally, but we need it again. I will post soon.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 25, 2009 2:14 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
I'm just reworking ALL cli scripts for 088.
So code and/or ideas are welcome just NOW.
R.

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 26, 2010 4:28 pm 
Offline

Joined: Thu Apr 22, 2010 11:28 am
Posts: 4
I would love the ability to delete graphs from cli. THe delete device is great also.


Top
 Profile  
 
 Post subject: remove interface
PostPosted: Mon Jul 12, 2010 10:32 am 
Offline

Joined: Mon Jul 12, 2010 10:19 am
Posts: 2
remove interface graphing from cacti, basically copied the other script and changed it a bit :o


Remove Interface Script 0.1

CLI utility to remove interface from Cacti

Remove interface usage: remove_interface.php --device-id=[device id] --snmp-index=[snmp id]
Required:
--device-id host/device ID.

--snmp-index snmp index / if index.

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

List Options:
--list-devices Lists all devices


Attachments:
File comment: cacti remove interface graph script cli ifindex
remove_interface.zip [1.3 KiB]
Downloaded 497 times
Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 13, 2010 12:07 am 
Offline

Joined: Mon Jul 12, 2010 10:19 am
Posts: 2
nothing.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 13, 2010 2:35 pm 
Offline
Cacti User
User avatar

Joined: Tue Jan 02, 2007 8:22 am
Posts: 52
Location: MI
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?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 14, 2010 2:46 am 
Offline

Joined: Wed Jul 14, 2010 8:19 am
Posts: 46
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.

thanks Mithandra


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 14, 2010 10:12 am 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
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.

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group