Help: Automating Router Interface Changes

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

cpedro
Posts: 5
Joined: Fri Jan 27, 2006 8:30 am

Help: Automating Router Interface Changes

Post by cpedro »

I work for an ISP and am currently working on migrating from our current Cricket system to Cacti. So far I'm extremely impressed by what Cacti can do verses Cricket, and was very pleased to have figured out that Cacti will do everything that our current Cricket systems does, plus much, much more.

The only thing that I can't seem to figure out how to do is to figure out how to automate the updates of router interfaces on Cacti. We have a small number of core routers (read 4-5) with a few main physical interfaces and up to 300 sub-interfaces to each of our customers. Each (sub)interface has an ifAlias associated with it that we use to keep track of the customer’s information (ie. Customer’s name, provisioned local loop bandwidth and circuit ID numbers), and this information tends to updated on the router’s side fairly regularly, and we obviously have interfaces that get decommissioned and new ones that are provisioned also on a fairly regular basis. So it becomes a bit tedious to have to be constantly updating our monitoring system to reflect these changes instead of just updating the router config.

On our current Cricket system, we simply run a cron script every night that runs a doctored version of the genRtrConfig script on each router to update the config tree so that any changes to the router interfaces are reflected.

Does anyone know of a similar procedure I can follow to do this for me in Cacti? Or will it boil down to me writing my own script to walk the router and update the database?

Any help with this is much appreciated.

--
Chris
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

Here is a quick and dirty method to doing it. Just so we're on the same page:
- Click on 'Console' then 'Devices' then select your device.
- To the far right of 'SNMP - Interface Statistics' there is a green circle. This will manually query_reload your device.

If you take a look at the URL when you hover over the green circle, it is doing a call to 'http://www.example.com/cacti/hosts.php? ... st_id=1678'

'action' is straight forward
'id' is the Data Query you want to reload (in most cases, SNMP, or '1')
'host' is the host id number

What you can do is create a modified 'hosts.php' file, somewhere outside of your web root, that does not require authentication to function, and call it with a wget, passing the variables as per the URL above.
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Also, in 0.8.6h, there is a handy utility in the root of your Cacti web site called:

poller_reindex_hosts.php

If you run that script once a night, you will get the same effect. Run it using "php poller_reindex_hosts.php -h" once to figure the syntax.

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
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

That's what I get for not looking at 0.8.6h....
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

lol... :lol:
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?
cpedro
Posts: 5
Joined: Fri Jan 27, 2006 8:30 am

Post by cpedro »

Thanks guys, I actually saw that script yesterday and wondered if that was what it did. Just to make sure it does what I want it to do, will this script add new interfaces that appear, and remove ones that no longer exist, as well as update the ifAlias tags? Or will I still need to manually add/delete interfaces from Cacti?
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

The script only re-indexes the hosts - updates names, ifAlias, etc. It will not add or remove graphs.
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
cpedro
Posts: 5
Joined: Fri Jan 27, 2006 8:30 am

Post by cpedro »

Is there any way to (or any scripts that anyone knows off that will) automate the adding or removing of graphs? Or am I stuck with finding my own way / doing it manually?
knobdy
Cacti User
Posts: 495
Joined: Wed Sep 28, 2005 1:39 pm

Post by knobdy »

Linegod wrote:The script only re-indexes the hosts - updates names, ifAlias, etc. It will not add or remove graphs.
I think I've already asked this question elsewhere - but where/how do you add ifAlias?

In "Data Queries -> SNMP - Interface Statistics -> In/Out Bits with Total Bandwidth" I don't see how to add ifAlias to the "Suggested Values" list.
cpedro
Posts: 5
Joined: Fri Jan 27, 2006 8:30 am

Post by cpedro »

You can add another name under data template and title under graph template and add |query_ifAlias| and push it to the top. That's what I ended up doing.
knobdy
Cacti User
Posts: 495
Joined: Wed Sep 28, 2005 1:39 pm

Post by knobdy »

cpedro wrote:You can add another name under data template and title under graph template and add |query_ifAlias| and push it to the top. That's what I ended up doing.
I don't think I'm following you... can you give more specifics - off-line perhaps?

knobdy at gmail (.) com?
cpedro
Posts: 5
Joined: Fri Jan 27, 2006 8:30 am

Post by cpedro »

knobdy wrote:I don't think I'm following you... can you give more specifics - off-line perhaps?

knobdy at gmail (.) com?
Check your PMs
knobdy
Cacti User
Posts: 495
Joined: Wed Sep 28, 2005 1:39 pm

Post by knobdy »

OMG - please forgive my complete stupidity/ignorance/blindness! :oops:
jkeroes
Posts: 4
Joined: Tue Mar 14, 2006 3:09 pm
Location: Portland, OR

Post by jkeroes »

cpedro wrote:
knobdy wrote:I don't think I'm following you... can you give more specifics - off-line perhaps?
Check your PMs
At our company, we need to do the same thing but with ifName instead of ifAlias. So instead of an off-line reply, could we get a public summary? An example that lists only the things that differ from the "Interface - Traffic" graph template would be really useful.

Thanks,
Joshua
mirghany
Posts: 9
Joined: Wed Mar 22, 2006 5:58 am

Post by mirghany »

Dear jkeroes,
You can go to Data Queries from console ,then SNMP - Interface Statistics ,In/Out Bits:
Under Data Template - Interface - Traffic
put |host_description| - Traffic - |query_ifAlias| - |query_ifName| on the left hand box and title on the right one press add
then you have to move them to the top and save
For the title beeing appear on graph edit Graph Template - Interface - Traffic (bits/sec)
write |host_description| -|query_ifIndex| - |query_ifAlias| - |query_ifName| on the left box and title on the right one...press add
then move the entry to the top
I made that modification to In/Out Bits (64-bit Counters)
as attached ,you can import that XML
Attachments
cacti_graph_template_interface_traffic_bitssec_64_counter.xml
(14.09 KiB) Downloaded 144 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest