This article explains how to collect necessary logs automatically when CPU utilization reaches a defined threshold value, in order to discover what is causing it.
When CPU utilization rises unexpectedly, it is difficult to identify what process is causing it. What steps should customers take to diagnose the problem?
lab@EX4200VC> show snmp mib walk jnxOperatingDescr | match Routing jnxOperatingDescr.9.1.0.0 = Routing Engine 0 jnxOperatingDescr.9.2.0.0 = Routing Engine 1
If FPC0 is the primary and you would like to check CPU utilization for primary only, monitor the MIB value jnxOperatingCPU.9.1.0.0 .
The following example will let EX monitor CPU utilization of the primary every 10 seconds to check if it has reached the threshold of 80%.
set snmp rmon alarm 1 interval 10 set snmp rmon alarm 1 variable jnxOperatingCPU.9.1.0.0 set snmp rmon alarm 1 sample-type absolute-value set snmp rmon alarm 1 rising-threshold 80 set snmp rmon alarm 1 rising-event-index 1 set snmp rmon event 1 type log
For detailed information on SNMP RMON, please read the following document. Configuration Statements: Remote Monitoring (RMON)
This example helps you identify when CPU utilization reaches 80% and which process is busy. Once you know which process made CPU busy, add additional commands in this example for further analysis.
set event-options policy test events snmpd_rmon_eventlog set event-options policy test then execute-commands commands "show system uptime |no-more" set event-options policy test then execute-commands commands "show chassis routing-engine |no-more" set event-options policy test then execute-commands commands "show system processes extensive |no-more" set event-options policy test then execute-commands output-filename CPU-GET-HIGH.txt set event-options policy test then execute-commands destination log-for-CPU-GET-HIGH set event-options policy test then execute-commands output-format text set event-options destinations log-for-CPU-GET-HIGH archive-sites /var/log/
Please refer to the following document below for more information on configuring Event Policy.
You can find a collected log file in defined locations such as the output below.
lab@EX4200VC> file list /var/log/ | match CPU EX4200VC_CPU-GET-HIGH.txt_20150508_190342