Juniper EX Switch Weathermap Configuration Generator

Support questions about the Network Weather Map plugin

Moderators: Moderators, Developers

Post Reply
Posts: 9
Joined: Sat Feb 07, 2009 7:54 am

Juniper EX Switch Weathermap Configuration Generator

#1 Post by millap » Sun Sep 27, 2015 4:56 pm

Hi All,

We have a customer who has 200 Juniper EX2200 and EX4200 switches (a mix of 2200C, 2200-24T, 2200-48T, 4200-24F and 4200-48T's). They love Weathermap so I've been working to get all of their switches displayed by port ifOperStatus on a per-site basis (there are 200+ sites). Rather than put myself through the agony of building each configuration file manually (even if it is relatively easy once you've got the first of each type done), I wrote some PHP scripts which does it all automatically and thought it would be worthwhile posting them here in-case someone else comes up against such an agonising job :)

Juniper (bless them) don't like SNMP. The ifIndex table has an 'ethernetCsmacd' and 'propVirtual' for each 'ge-x/x/x' interface. Furthermore, depending on the JunOS version you run, have upgraded too, or even if the switch is running from a backup JunOS image, the ifIndex value can change so the script takes this into account if you have to re-generate the Weathermap configuration file.

The scripts use commandline arguments, e.g - <scriptname> <hostname> <community> <ip_address> <cacti ID>

I have a separate shell script which calls a text file containing the switch information.

Text File

Code: Select all

<cactiID> <hostname> <community> <ip_address>

Code: Select all

cat filename.txt | while read one two three four
php /var/www/wmconfex220048t.php $two $three $four $one > /tmp/$two.conf
Output is similar to the following -

ex2200c-example.png (21.7 KiB) Viewed 1249 times
ex2200-24t-example.png (27.15 KiB) Viewed 1249 times
ex2200-48t-example.png (38.44 KiB) Viewed 1249 times
ex4200-24f-example.png (32.02 KiB) Viewed 1249 times
I make no guarantee this will work in your environment, but I've tested it (on 200 switches :P) and it seems to work well. I also make no promises the PHP coding is any good and can't be improved upon either. I'm certainly not an expert. :)

I've included the NODE images I used in the zip file, so the port locations will match.

Hope someone finds it useful.
(146 KiB) Downloaded 152 times

Post Reply