Cacti CLI ?

Anything that you think should be in Cacti.

Moderators: Developers, Moderators

bligneri
Posts: 1
Joined: Wed Jan 31, 2007 8:49 pm

Cacti CLI ?

Post by bligneri »

Hello,

We are working for a customer that would like to create a Command Line Interface (CLI) that can be used to fill the CACTI configuration database instead of using the web Interface.

The main reason is that we have to deal with large Cacti deployement and we would like to automate the management of CACTI Devices as much as possible (I.e. :data is coming from an inventory database and contain all the releventant information so why using the Web Interface to create the devices ?. Ultimately ; we would like to automatically sync CACTI with the inventory database).


We would like to know if the CACTI community & developers would be interested by such a project.

At first, we would like to do a simple prototype that can :
- add a device
- position a device in the tree
- create tree node
- delete tree node
- delete a device
- move a device inside the tree

What would be the best langage to do it ?
[[ PHP would allow us to easily use existing CACTI code and would be my first choice }}

Flame / Comments / ideas / suggestion welcome.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

There is one already. It's not officially supported by the developers. Search the addon's or use google.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
bard tablett
Posts: 2
Joined: Tue Jun 12, 2007 3:25 pm

Cacti CLI ?

Post by bard tablett »

I have a very similar need for a CLI for Cacti. I have googled this and looked around the forums and most of what I see are old posts, broken links, and disjointed threads. Could someone point me to a good resource?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

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

Post by rony »

Cacti CHANGELOG

0.8.6k
<snip>
-bug: Cacti does not have any way to mass add devices, graphs, tree's and permissions.
CLI interfaces are coming in July! :D

If you pull the scripts from SVN branch_0_8_6, they should work with the latest release of Cacti, but I make not promises. Also, the still need some tweaking their paths will change before the release of 0.8.6k.
[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]
bard tablett
Posts: 2
Joined: Tue Jun 12, 2007 3:25 pm

Cacti CLI ?

Post by bard tablett »

Do you have a link to SVN branch_0_8_6? Also, the data we are graphing is all derived from Perl scripts. No SNMP. Will this CLI work with non-SNMP data?

Also, early July or late July?

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

Post by rony »

July.... :D I will not set a date.

I don't know if it supports that, but my gut tells me yes, based off of templates.
[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]
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

Rony, so does this mean i should hold off on rebuilding my Cacti server until you guys release the newest version...

Just how stable is the SVN version?

Just wondering. Although, maybe I should rebuild it anyway on the current version and get cactid working properly...

Off to the server room.

app
[b]Cacti Version[/b] - 0.8.7b
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - CMD.php
[b]Server Info[/b] - Linux 2.6.9-78.0.1.ELsmp
[b]Web Server[/b] - Apache/2.0.52 (Red Hat)
[b]PHP[/b] - 4.3.9
[b]MySQL[/b] - 4.1.22
[b]RRDTool[/b] - 1.2.23
[b]SNMP[/b] - 5.1.2
[b]Plugins[/b][list]Global Plugin Settings (settings - v0.5)
SuperLinks (superlinks - v0.72)
Host Info (hostinfo - v0.2)
Report Creator (reports - v0.3)
Update Checker (update - v0.4)
Realtime for Cacti (realtime - v0.35)
Cacti Log View (clog - v1.1)
RRD File Cleaner (rrdclean - v0.36)
Network Discovery (discovery - v0.9)
Uptime (uptime - v0.4)[/list]
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

App - I take it that the CACTID I sent you did not work ?
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
User avatar
rcaston
Cacti User
Posts: 204
Joined: Tue Jan 06, 2004 7:47 pm
Location: US-Dallas, TX
Contact:

Post by rcaston »

rony wrote:
Cacti CHANGELOG

0.8.6k
<snip>
-bug: Cacti does not have any way to mass add devices, graphs, tree's and permissions.
CLI interfaces are coming in July! :D
This is the best news I've heard all month 8)

I have about 60,000 interfaces I need to smite...
User avatar
rcaston
Cacti User
Posts: 204
Joined: Tue Jan 06, 2004 7:47 pm
Location: US-Dallas, TX
Contact:

Post by rcaston »

Where are the current CLI scripts in the SVN Dev/Unstable Trunk tree? I'd like to experiment with them.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

They are in BRANCH_0_8_6. There are 5 files of interest. They are:

add_device.php
add_graphs.php
add_perms.php
add_tree.php
lib/api_automation_tools.php

The only files "done" if you will are the add_device.php and add_graphs.php. I have changed the syntax to allow you to be more flexible when adding devices and graphs.

The other two files, I have yet to examine in detail.

If you were a prior user of these scripts, please note the syntax has changed significantly.

Regards,

TheWitness

Add Device Syntax

Code: Select all

Usage:
add_device.php --description=[description] --ip=[IP] --template=[ID] [--disable]
   [--version=[1|2|3]] [--community=] [--username= --password=] [--port=161] [--timeout=500]

Required:
    - description: the name that will be displayed by Cacti in the graphs
    - ip: self explanatory (can also be a FQDN)
    - template is a number (read below to get a list of templates)

Optional:
    - disable: 0, 1 to add this host but to disable checks and 0 to enable it
    - version: 1, 1|2|3, snmp version
    - community: '', snmp community string for snmpv1 and snmpv2. Leave blank for no community
    - username: '', snmp username for snmpv3
    - password: '', snmp password for snmpv3
    - port: 161
    - timeout: 500

List Options:  --list-templates
               --list-communities
Add Graphs Syntax

Code: Select all

Usage:
add_graphs.php --graph-type=[cg|ds] --graph-template-id=[ID]
  --host-id=[ID] [--graph-title=title] [graph options] [--force]

For cg graphs: [--force]

--force is optional - if you set this flag, then new cg graphs will be created, even though they may already exist.

For ds graphs: --snmp-query-id=[ID] --snmp-query-type-id=[ID] --snmp-field=[SNMP Field] --snmp-value=[SNMP Value]

--graph-title is optional - it defaults to what ever is in the graph template/data-source template.

List Options:  --list-hosts
               --list-graph-templates
               --list-snmp-queries
               --snmp-query-id [ID] --list-query-types
               --host-id=[ID] --list-snmp-fields
               --host-id=[ID] --snmp-field=[Field] --list-snmp-values

'cg' graphs are for things like CPU temp/fan speed, while 'ds' graphs are for data-source based graphs (interface stats etc.)
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
rcaston
Cacti User
Posts: 204
Joined: Tue Jan 06, 2004 7:47 pm
Location: US-Dallas, TX
Contact:

Post by rcaston »

im trying to get the add_graphs script to work with the current stable release of cacti; but i think the api_automation_tools.php needs to be added into the stable build as well, but upon doing that I run into other errors.

So... whens the ETA on the next release of cacti >:)
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Next month. You can add the api function without issue.

Larry
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Taiphun
Posts: 21
Joined: Mon Jan 08, 2007 11:44 am

Post by Taiphun »

Cool. I am eagerly looking forward to this.

Thanks to all the developers for all the hard work!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests