[racktables-users] SNMP Hack

  • From: Les Jones <lcjones@xxxxxxx>
  • To: racktables-users@xxxxxxxxxxxxx
  • Date: Thu, 10 Jul 2008 18:03:30 -0400

Folks,

Racktables is a god send! Thanks!

Here's a hack I did for the 0.16 version. It may not be the prettiest or the best way to get it done but here you go.

We are a datacenter with numerous Cisco routers in our network. I wanted to be able to do an SNMP System Information and Interface get for our routers like SNMP PortFinder for switches.

So, if anyone is interested, and it's relatively simple to do on your own, I've added an SNMP Interface Finder for Cisco Routers in conjunction with SNMP Port Finder for switches. I think I covered the bases. As always, YMMV! ;)

Be warned, I'm not a coder of anything, but I can drink a beer pretty good! ;) Hope someone finds this useful.
****************************************

Files to change:

inc/navigation.php

Find all lines that include "snmpportfinder"
There are four lines that include snmpportfinder
Added these lines in beneath their respective snmpportfinder lines

$tab['object']['snmpintfinder'] = 'SNMP Interface Finder';
$tabhandler['object']['snmpintfinder'] = 'renderSNMPIntFinder';
$tabextraclass['object']['snmpintfinder'] = 'attn';
$trigger['object']['snmpintfinder'] = 'trigger_snmpintfinder';

*****
Change File inc/triggers.php

At or near line 41 find the SNMP PORT FINDER trigger.

function trigger_snmpportfinder ()
        {
                etc,etc,etc.....
        )

Copy the the function trigger_snmpportfinder section, insert it directly below the original.
Change to....
        function trigger_snmpintfinder ()
        
NOTE NOTE NOTE
        the following line MUST be changed to fit your needs
        if (!object['objtype_id'] !=8)

You must change the ID Number (default is 8) to the object number of your Router objects. Mine happens to be "7". Your's may be different.

*****

Change File inc/interface.php
        
At or near line 3721 find function renderSNMPPortFinder ($object_id = 0)

Copy the entire renderSNMP section and insert immediately beneath the original.

Change function renderSNMPPortFinder ($object_id = 0)
to
function renderSNMPIntFinder ($object_id = 0)

NOTE NOTE NOTE
        the following line MUST be changed
        printLog (doSNMPmining (object_id, $_REQUEST['community']));
        to
        printLog (doSNMPintmining (object_id, $_REQUEST['community']));

*****

COPY inc/snmp.php to inc/snmpint.php

Edit line 3 of snmpint.php from
        function doSNMPmining ($object_id, $community)
        to
        function doSNMPintminig .... etc

You can also edit the list of devices in snmpint.php if you like. It didn't seem to make a difference for me.

I believe that's everything to add an SNMP get option for your Cisco routers.


--
Les Jones
Network Staff
Mikro-data.net
lcjones@xxxxxxx

Other related posts: