Blog

Monitoring Juniper EX Switches Using SNMP and Opsview

dchatterton's picture

SNMP is an industry standard way to monitor many types of devices and is used by nearly every vendor. In this article, we will cover monitoring Juniper EX switches using SNMP polling. The checks covered will monitor CPU usage, memory usage, and the temperature of the switch, but you can use the following steps to monitor any part of the switch.

To start, we will enable and configure SNMP on the Juniper switch. Let's login to the switch and go to 'edit snmp' mode.

root@jun3200:RE:0% cli
root@jun3200> edit
Entering configuration mode

[edit]
root@jun3200# edit snmp

[edit snmp]

Now that we can edit SNMP, we can add the initial settings. We will need to set the name, description of the device, physical location and contact information.

root@jun3200# set Name "jun3200"

[edit snmp]
root@jun3200# set description "Juniper EX3200-24T"

[edit snmp]
root@jun3200# set location "US Data Center"

[edit snmp]
root@jun3200# set contact "david.chatterton@opsview.com"

[edit snmp]

Next, we will set the SNMP community string and access.

root@jun3200# community public authorization read-only

We can also set which IPs are allowed to connect and block other IPs. If you don't specify which are allowed, then all IPs will have access.

root@jun3200# set client-list list0 172.16.1.0/24

[edit snmp]
root@jun3200# set community public clients 172.16.2.0/24 restrict

[edit snmp]

If you also want to enable traps, you will need to specify the trap-group, port and target IP.

root@jun3200# set trap-group "jun3200-traps" destination-port 162 targets 172.16.1.102

[edit snmp]

Once complete, we can check and commit the changes.

root@jun3200# show
name jun3200;
description "Juniper EX3200-24T";
location US Data Center;
contact "david.chatterton@opsview.com";
client-list list0 {
    172.16.1.0/24;
}
community david.jun3200 {
    authorization read-only;
}
trap-group jun3200-traps {
    targets {
        172.16.1.102;
    }
}
health-monitor {
    interval 300;
    rising-threshold 80;
    falling-threshold 70;
}

[edit snmp]
root@jun3200# commit check
configuration check succeeds

[edit]

root@jun3200# commit
commit complete

[edit]

In order to create checks in Opsview to monitor the Juniper switch, we will need to get the OID of the objects we want to monitor. Juniper's documentation contains a list of mibs for monitoring different objectsas well as details on the thresholds. Juniper's documentation on monitoring some of the chassis sensors can be found here.

To see a full list of OIDs, we can use snmptranslate to get the OID's from each MIB file.  In this case, we will be using the chassis mibs, but this will work with any mib file. First, navigate to the your mib directory.

[root@ov-master ~]# cd /usr/share/snmp/mibs/

Once there, we will use the snmptranslate command to get a full list of mibs. The -Tz flag will give a numeric and labeled list of all the objects and -m will allow you to specify the mib you want to translate. Since this returns a very long list, I have cut down the list to only show mibs containing “Operating”.

[root@ov-master mibs]# snmptranslate -Tz -m ./mib-jnx-chassis.txt | grep Operating
"jnxOperatingTable"                     "1.3.6.1.4.1.2636.3.1.13"
"jnxOperatingEntry"                     "1.3.6.1.4.1.2636.3.1.13.1"
"jnxOperatingContentsIndex"                     "1.3.6.1.4.1.2636.3.1.13.1.1"
"jnxOperatingL1Index"                   "1.3.6.1.4.1.2636.3.1.13.1.2"
"jnxOperatingL2Index"                   "1.3.6.1.4.1.2636.3.1.13.1.3"
"jnxOperatingL3Index"                   "1.3.6.1.4.1.2636.3.1.13.1.4"
"jnxOperatingDescr"                     "1.3.6.1.4.1.2636.3.1.13.1.5"
"jnxOperatingState"                     "1.3.6.1.4.1.2636.3.1.13.1.6"
"jnxOperatingTemp"                      "1.3.6.1.4.1.2636.3.1.13.1.7"
"jnxOperatingCPU"                       "1.3.6.1.4.1.2636.3.1.13.1.8"
"jnxOperatingISR"                       "1.3.6.1.4.1.2636.3.1.13.1.9"
"jnxOperatingDRAMSize"                  "1.3.6.1.4.1.2636.3.1.13.1.10"
"jnxOperatingBuffer"                    "1.3.6.1.4.1.2636.3.1.13.1.11"
"jnxOperatingHeap"                      "1.3.6.1.4.1.2636.3.1.13.1.12"
"jnxOperatingUpTime"                    "1.3.6.1.4.1.2636.3.1.13.1.13"
"jnxOperatingLastRestart"                       "1.3.6.1.4.1.2636.3.1.13.1.14"
"jnxOperatingMemory"                    "1.3.6.1.4.1.2636.3.1.13.1.15"
"jnxOperatingStateOrdered"                      "1.3.6.1.4.1.2636.3.1.13.1.16"
"jnxOperatingChassisId"                 "1.3.6.1.4.1.2636.3.1.13.1.17"
"jnxOperatingChassisDescr"                      "1.3.6.1.4.1.2636.3.1.13.1.18"
"jnxOperatingRestartTime"                       "1.3.6.1.4.1.2636.3.1.13.1.19"
"jnxOperating1MinLoadAvg"                       "1.3.6.1.4.1.2636.3.1.13.1.20"
"jnxOperating5MinLoadAvg"                       "1.3.6.1.4.1.2636.3.1.13.1.21"
"jnxOperating15MinLoadAvg"                      "1.3.6.1.4.1.2636.3.1.13.1.22"

Here, we can see each OID and their corresponding object. The OID to monitor CPU usage from the snmptranslate matches the one from Juniper's documentation:
1.3.6.1.4.1.2636.3.1.13.1.8

Now, if we try to use this OID by itself in Opsview, it will give an error because there are multiple parts of the device each OID can give information for, so we will need to get an inventory of the switch to see which object we want to monitor. This can be done by looking up the jnxOperatingDescr on the switch.

root@jun3200> show snmp mib walk jnxOperatingDescr
jnxOperatingDescr.1.1.0.0
jnxOperatingDescr.2.1.1.0 = Power Supply: Power Supply 0 @ 0/0/*
jnxOperatingDescr.4.1.1.1 = FAN: Fan 1 @ 0/0/0
jnxOperatingDescr.7.1.0.0 = FPC: EX3200-24T, 8 POE @ 0/*/*
jnxOperatingDescr.8.1.1.0 = PIC: 24x 10/100/1000 Base-T @ 0/0/*
jnxOperatingDescr.8.1.2.0 = PIC: 4x GE SFP @ 0/1/*
jnxOperatingDescr.9.1.0.0 = Routing Engine 0

To complete the OID, we will need to add the last 4 octets found after jnxOperatingDescr. In this case, I will be using .7.1.0.0, but this may differ between devices. The OID to check the CPU usage will now look like: 1.3.6.1.4.1.2636.3.1.13.1.8.7.1.0.0

Now that we have the OID, we can create a check in Opsview. Start by navigating to the Service Check Setting page.

Juniper Network Dashboard

Then, add a new SNMP Polling check.

Juniper Service Checks


On the details tab, you can add the name and other general information for the check. On the SNMP Polling tab, we will set the OID and the thresholds.

Juniper CPU Utilization


This OID returns a percentage and will give a warning if it breaches 75%, and give a critical alert if it goes over 95%. Once you have added the values you want, you can submit your changes and reload Opsview. These steps will work for all other SNMP polling checks with the Juniper switch.

This link provides an Opspack with CPU, memory and tempature monitoring built in. Depending on which object you want to monitor, you might need to edit the last 4 octets in the OID.

On your Opsview system, you will find many standard linux snmp tools such as snmpwalk, snmpget, and snmpgetnext. These tools can all be used to find the MIB's, OID's and information you need to monitor many objects and sensors in your SNMP enabled devices.  Snmpwalk will allow you to query a device for a full tree of information, as well as get granular information on specific OID's. Snmpget will let you get specific information from a remote host based on a OID you provide. To see the next OID in the MIB tree, you can use snmpgetnext. Each command has a full man page with example of how to use each command.

Related articles: