Cacti CLI ?

Anything that you think should be in Cacti.

Moderators: Developers, Moderators

User avatar
rcaston
Cacti User
Posts: 204
Joined: Tue Jan 06, 2004 7:47 pm
Location: US-Dallas, TX
Contact:

Post by rcaston »

TheWitness wrote:Next month. You can add the api function without issue.

Larry
woot.

i'll finally be able to add thousands of interfaces :)
earl26
Posts: 2
Joined: Tue Oct 23, 2007 9:26 am

Post by earl26 »

Hello,

we also need to manage hosts and graphs from outside cacti.

is this CLI yet stable?
is there a chance to disable/remove a hosts or graphs over CLI-interface?

regards
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

CLI are only designed for adding.

They will be available in the release of 0.8.7.

Deleting can easily be figured out by looking into the Cacti code.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
earl26
Posts: 2
Joined: Tue Oct 23, 2007 9:26 am

Post by earl26 »

thanks a lot for this excellent work.
jcampos
Posts: 3
Joined: Fri Oct 10, 2008 2:42 pm

suggestion

Post by jcampos »

excellent work.

it's possible that the developers of the "cli" for the next version, add_graphs.php added to the graphics options interfaces that match different values snmp_field and snmp_value, I explain.

Today I can do something like this.

Code: Select all

php -q /export/home/mordor/cacti/cli/add_graphs.php \
                                        --graph-type=ds \
                                        --graph-template-id=32 \
                                        --host-id=ID-HOST \
                                        --snmp-query-id=1 \
                                        --snmp-query-type-id=21 \
                                        --snmp-field=ifType \
                                        --snmp-value=ethernetCsmacd
I like to do something like this:

Code: Select all

php -q /export/home/mordor/cacti/cli/add_graphs.php \
                                        --graph-type=ds \
                                        --graph-template-id=32 \
                                        --host-id=ID-HOST \
                                        --snmp-query-id=1 \
                                        --snmp-query-type-id=21 \
                                        --snmp-field=ifType&ifOperStatus\
                                        --snmp-value=ethernetCsmacd&Up \

this because I'm measuring the network has more than 500 teams and many more 15000 interfaces to be measured.

Greetings

forgiveness for my English but I am of chile and not speak the language very much
felimwhiteley
Posts: 26
Joined: Mon Dec 10, 2007 10:14 am

Post by felimwhiteley »

Not sure about Deleting being that easy to figure out, there's not plans I take it for a script to handle it then ?

I've got a lot of hosts that change IP, and unfortunately they don't play well with DNS. So a script notifies me of an IP address change. So I tried a bit of SQL (It's hundreds changing allt he time... don't ask!)

Basically changed the host table where the cacti_id was one I was looking for and changed it's hostanme to the new address. Doesn't work. Something else appears to be done when that happens, looking through the PHP code (I'm not a PHP developer alas) looks like a whole raft of SQL updates need to be performed.

Dont' suppose there's a chance of a CLI tool to do that too ?
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Yes, scripts will be added for deleting.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Not before 088, as far as I'm concerned. We will supply a "delete" and an "update" interface for most objects. "list" options will be split off of current "add" scripts for sake of performance and design
Reinhard
felimwhiteley
Posts: 26
Joined: Mon Dec 10, 2007 10:14 am

Post by felimwhiteley »

gandalf wrote:Not before 088, as far as I'm concerned. We will supply a "delete" and an "update" interface for most objects. "list" options will be split off of current "add" scripts for sake of performance and design
Reinhard
Presume the delete of a host will allow the ripple down deleting of all graphs and data sources too ?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

This one should already be there. See SVN of 087 branch. You may check it out and try on 087-style cacti. Comments are welcomed
Reinhard
felimwhiteley
Posts: 26
Joined: Mon Dec 10, 2007 10:14 am

Post by felimwhiteley »

gandalf wrote:This one should already be there. See SVN of 087 branch. You may check it out and try on 087-style cacti. Comments are welcomed
Reinhard
Hmm not working, but might be my fault if there's sometihng needing tweaking from my Ubuntu Cacti Install (0.8.7b) ?

Warning: include_once(): Failed opening 'CACTI_BASE_PATH/lib/api_device.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/cacti/site/cli/remove_device.php on line 38

Fatal error: Call to undefined function getHosts() in /usr/share/cacti/site/cli/remove_device.php on line 47

Either that or perhaps I can get away with copying some of the api libs form SVN into mine... afriad it might mess it up though. Is the remove feature going to be in 0.8.7c then ?
felimwhiteley
Posts: 26
Joined: Mon Dec 10, 2007 10:14 am

Post by felimwhiteley »

felimwhiteley wrote:but might be my fault if there's sometihng needing tweaking from my Ubuntu Cacti Install (0.8.7b) ?
That would be a yes ;-)

Changed CACTI_BASE_PATH to $config["base_path"]

Worked a treat.. cheers gandalf
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest