Hi Folks,
Please find some pointers on Using the Enterprise-Specific Utility MIB to Enhance SNMP Coverage, you can try exploring on that front,
https://www.juniper.net/documentation/en_US/junos/topics/task/operational/snmp-best-practices-utility-mib-using.html
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:
content_copy
zoom_out_map
event-options {
generate-event {
1-HOUR time-interval 3600;
}
policy MBUFS {
events 1-HOUR;
then {
event-script check-mbufs.slax; # script stored at /var/db/scripts/event/
}
}
event-script {
file check-mbufs.slax;
}
}
check-mbufs.slax Script
The following example shows the check-mbufs.slax script that is stored under /var/db/scripts/event/:
content_copy
zoom_out_map
------ 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 ------