Automated Device Entry

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
swebster
Posts: 9
Joined: Mon Sep 21, 2009 12:04 pm

Automated Device Entry

Post by swebster »

I have not found any documentation or a post relating to this.

What we are looking at trying with Cacti is to utilize an existing database of devices on our network(currently 5,700+) I already know the IP of ever device and the OID that will be used, but what I'm wanting to figure out is how I can automate the entry of these devices and set the "location" tree up correctly because each device has a location and new devices are added hourly usually around 150-200 a month. Using this existing database I know the "Category / Location" for each and every device and the device names and types. I am trying to figure out how I could script the input of all new devices into cacti as they come in and build out just as if I was doing it by hand. As you can see manually adding these devices would be overly time consuming.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Sounds like the job for a plugin. http://docs.cacti.net/plugins:development
swebster
Posts: 9
Joined: Mon Sep 21, 2009 12:04 pm

Post by swebster »

I figured that much, well I will definately take this into consideration then and begin reading on plugin development.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

Can't the cli tools do this?

You would need to some script to read your database and figure out what was new etc, but you'd need that anyway.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
Deviloper
Cacti User
Posts: 256
Joined: Tue Jul 07, 2009 8:03 am

Post by Deviloper »

If you real do a search on the form and did not find a single post, the search engine could have a dramatic failure.

I posted at least 4 topics on staht, explaining how to edit and utilize add_device.php and add_graphs-php to generate devices and graphs automaticly.

If you are interessted in this stuff you can do a search on cacti cli, "add_graphs.php" and "automate cacti".

I build up a complet automation backend, partly in perl, which is much faster than the original stuff. You also may contact me and get a discount on the scripts for sure ;-)
swebster
Posts: 9
Joined: Mon Sep 21, 2009 12:04 pm

Post by swebster »

You are correct , it's not the search that is broken, but it was me who was broken I for some reason thought I searched these forums but I did not I do appologize, and I spend most of the night reading through parts of cacti and I think I'm going to lay in the framework using Python. I also believe for my situation I will need to build a customized plugin.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I just posted my very recent plugin, autom8.
It will NOT cover the device creation (this is done by add_device.php), but it will automate graph creation and tree entries.

Be warned. A beginner might not understand on the first run. And there's a good chance to break your installation using faulty rules created with this plugin.

Reinhard
swebster
Posts: 9
Joined: Mon Sep 21, 2009 12:04 pm

Post by swebster »

I have gone through all the cli php files and began testing ideas on how to automate my entry. The only part I'm struggling with is how to handle a device that is removed from a client site, but then two months later put in at another site with the same IP. I am not for sure yet if just renaming the host to a historical name, and allowing the creation of a new host with the same name as previous ( for some of the help desk guys that are used to the old namming convention) would be a good idea. How does cacti handle naming convention of the RRD's, would it detect that for example site_10.0.0.1(sm).rrd exists and then would name the new one site_10.0.0.1(sm)-2.rrd. These are a few things I will need to play with.


Also I am thinking that I will write this in nothing but PHP and use a cronjob to sync up cacti with the new devices. Or can I translate the cli functions I want into Python because it appears to be 99% DB UPDATE/ADD/DROP.

Thank you again for the reply's
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

swebster wrote:Also I am thinking that I will write this in nothing but PHP and use a cronjob to sync up cacti with the new devices. Or can I translate the cli functions I want into Python because it appears to be 99% DB UPDATE/ADD/DROP.
I seriously doupt that. However, it depends on the version of Cacti you are running. There were some bad bugs in the early automation. Had nothing to do with Perl/PHP/Python. It was bad code. PHP is one of the richest and most broadly supported languages I know from the structured (old man world) to the OO.

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?
swebster
Posts: 9
Joined: Mon Sep 21, 2009 12:04 pm

Post by swebster »

Ok, Well I have everything working but the creation of the graphs.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Of course, there is nothing wrong with what you have done. I'm just speaking to the PHP vs. the crowd issue.

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?
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

TheWitness wrote:Of course, there is nothing wrong with what you have done. I'm just speaking to the PHP vs. the crowd issue.
The main downside is that you take on the burden of tracking any Cacti database schema changes as the software evolves.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
swebster
Posts: 9
Joined: Mon Sep 21, 2009 12:04 pm

Post by swebster »

I understand what you're point was. I believe each language can have it's strong point and weak points. I went ahead and did it in PHP and wrapped everything into one nice little file.
swebster
Posts: 9
Joined: Mon Sep 21, 2009 12:04 pm

Post by swebster »

Howie wrote:The main downside is that you take on the burden of tracking any Cacti database schema changes as the software evolves.
Yup and that sucks, but people were asking for it faster and faster .
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests