Using the Enterprise-Specific Utility MIB to Enhance SNMP Coverage
Even though the Junos OS has its own built-in performance metrics and monitoring options, you may have a need to have customized performance metrics that suit your special needs. To make it easier for you to monitor such customized data through a standard monitoring system, Junos OS provides you with an enterprise-specific Utility MIB that can store such data and thus extend SNMP support for managing and monitoring the data of your choice.
The enterprise-specific Utility MIB provides you with container objects of the following types: 32-bit counters, 64-bit counters, signed integers, unsigned integers, and octet strings. You can use these container MIB objects to store the data that are otherwise not supported for SNMP operations. You can populate data for these objects either by using CLI commands or with the help of Op scripts and an RPC API that can invoke the CLI commands and populate data for these objects.
The following CLI commands enable you to set and clear Utility MIB object values:
- request snmp utility-mib set instance name object-type <counter | counter 64 | integer | string | unsigned integer> object-value value
- request snmp utility-mib clear instance name object-type <counter | counter 64 | integer | string | unsigned integer>
The instance name option of the request snmp utility-mib <set | clear> command specifies the name of the data instance and is the main identifier of the data. The object-type <counter | counter 64 | integer | string | unsigned integer> option enables you specify the object type, and the object-value value option enables you to set the value of the object.
To automate the process of populating Utility MIB data, you can use a combination of an event policy and event script. The following examples show the configuration for an event policy to run show system buffers every hour and to store the show system buffers data in Utility MIB objects by running an event script (check-mbufs.slax).
Event Policy Configuration
To configure an event policy that runs the show system buffers command every hour and invokes check-mbufs.slax to store the show system buffers data into Utility MIB objects, include the following statements at the [edit] hierarchy level:
check-mbufs.slax Script
The following example shows the check-mbufs.slax script that is stored under /var/db/scripts/event/:
------ script START ------
version 1.0;
ns junos = "http://xml.juniper.net/junos/*/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
ns ext = "http://xmlsoft.org/XSLT/namespace";
match / {
<op-script-results>{
var $cmd = <command> "show system buffers";
var $out = jcs:invoke($cmd);
var $lines = jcs:break_lines($out);
for-each ($lines) {
if (contains(., "current/peak/max")) {
var $pattern = "([0-9]+)/([0-9]+)/([0-9]+) mbufs";
var $split = jcs:regex($pattern, .);
var $result = $split[2];
var $rpc = <request-snmp-utility-mib-set> {
<object-type> "integer";
<instance> "current-mbufs";
<object-value> $result;
}
var $res = jcs:invoke($rpc);
}
}
}
}
------ script END ------
You can run the following command to check the data stored in the Utility MIB as a result of the event policy and script shown in the preceding examples:
user@host> show snmp mib walk jnxUtilData ascii jnxUtilIntegerValue."current-mbufs" = 0 jnxUtilIntegerTime."current-mbufs"
= 07 da 05 0c 03 14 2c 00 2d 07 00 regress@caramels> Related Topics
- Configuring Options on Managed Devices for Better SNMP Response Time
- Configuring SNMP on Devices Running Junos OS
- Managing Traps and Informs
- Monitoring SNMP Activity and Tracking Problems That Affect SNMP Performance on a Device Running Junos OS
- Optimizing the Network Management System Configuration for the Best Results
- Understanding SNMP Implementation in Junos OS
Hide Navigation Pane
Show Navigation Pane
Download
SHA1