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

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 ""

[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

[edit snmp]
root@jun3200# set community public clients 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

[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 "";
client-list list0 {;
community david.jun3200 {
    authorization read-only;
trap-group jun3200-traps {
    targets {;
health-monitor {
    interval 300;
    rising-threshold 80;
    falling-threshold 70;

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


root@jun3200# commit
commit complete


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"                     ""
"jnxOperatingEntry"                     ""
"jnxOperatingContentsIndex"                     ""
"jnxOperatingL1Index"                   ""
"jnxOperatingL2Index"                   ""
"jnxOperatingL3Index"                   ""
"jnxOperatingDescr"                     ""
"jnxOperatingState"                     ""
"jnxOperatingTemp"                      ""
"jnxOperatingCPU"                       ""
"jnxOperatingISR"                       ""
"jnxOperatingDRAMSize"                  ""
"jnxOperatingBuffer"                    ""
"jnxOperatingHeap"                      ""
"jnxOperatingUpTime"                    ""
"jnxOperatingLastRestart"                       ""
"jnxOperatingMemory"                    ""
"jnxOperatingStateOrdered"                      ""
"jnxOperatingChassisId"                 ""
"jnxOperatingChassisDescr"                      ""
"jnxOperatingRestartTime"                       ""
"jnxOperating1MinLoadAvg"                       ""
"jnxOperating5MinLoadAvg"                       ""
"jnxOperating15MinLoadAvg"                      ""

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:

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. = Power Supply: Power Supply 0 @ 0/0/*
jnxOperatingDescr. = FAN: Fan 1 @ 0/0/0
jnxOperatingDescr. = FPC: EX3200-24T, 8 POE @ 0/*/*
jnxOperatingDescr. = PIC: 24x 10/100/1000 Base-T @ 0/0/*
jnxOperatingDescr. = PIC: 4x GE SFP @ 0/1/*
jnxOperatingDescr. = 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 ., but this may differ between devices. The OID to check the CPU usage will now look like:

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: