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.
Code: Select all
<cactiID> <hostname> <community> <ip_address>
Output is similar to the following -
Code: Select all
#!/bin/sh cat filename.txt | while read one two three four do php /var/www/wmconfex220048t.php $two $three $four $one > /tmp/$two.conf done
EX2200C EX2200-24T EX2200-48T EX4200-24F I make no guarantee this will work in your environment, but I've tested it (on 200 switches ) 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.