{"id":1803,"date":"2013-09-07T09:31:03","date_gmt":"2013-09-07T08:31:03","guid":{"rendered":"http:\/\/mccltd.net\/blog\/?p=1803"},"modified":"2013-09-07T09:56:32","modified_gmt":"2013-09-07T08:56:32","slug":"cisco-eem-applet-to-measure-cpu-utilisation","status":"publish","type":"post","link":"http:\/\/darenmatthews.com\/blog\/?p=1803","title":{"rendered":"Cisco EEM Applet &#8211; Measure CPU Utilisation"},"content":{"rendered":"<p>This EEM applet reads the Cisco &#8220;cpmCPUTotal5sec&#8221; object variable in the CISCO-PROCESS-MIB and triggers when the threshold exceeds 60 %.\u00a0 Three files are stored on the flash, containing the output of the CLI command &#8220;show process cpu | sorted&#8221; and &#8220;show ip traffic&#8221; as well as the current syslog.<!--more--><\/p>\n<p>event manager applet CPU-HIGH<br \/>\nevent snmp oid 1.3.6.1.4.1.9.9.109.1.1.1.1.3 get-type next entry-op gt entry-val 60 poll-interval 5<br \/>\naction 0.1 cli command &#8220;enable&#8221;<br \/>\naction 0.2 syslog msg &#8220;Capturing high cpu information to flash:&#8221;<br \/>\naction 0.3 cli command &#8220;term length 0&#8221;<br \/>\naction 1.1 cli command &#8220;show process cpu sorted | append flash:EEM_CPU_HIGH&#8221;<br \/>\naction 1.4 cli command &#8220;show ip traffic | append flash:EEM_CURR_TRAFFIC&#8221;<br \/>\naction 1.4 cli command &#8220;show logging | append flash:EEM_SYSLOG&#8221;<br \/>\naction 4.2 syslog msg &#8220;Removing EEM APPLET from running_config&#8221;<br \/>\naction 9.2 cli command &#8220;configure terminal&#8221;<br \/>\naction 9.3 cli command &#8220;no event manager applet CPU-HIGH&#8221;<br \/>\naction 9.4 cli command &#8220;end&#8221;<br \/>\naction 9.5 cli command &#8220;term default length&#8221;<\/p>\n<p>Output from the show processes CPU command on Cisco IOS Software Release 12.0(9):<\/p>\n<p>Router# show processes CPU<\/p>\n<p>CPU Utilisation for five seconds: 2%A\/1%B; one minute: 1%C; five minutes: 1%D<br \/>\nPID\u00a0 Runtime(ms)\u00a0 Invoked\u00a0 uSecs\u00a0\u00a0\u00a0 5Sec\u00a0\u00a0 1Min\u00a0\u00a0 5Min TTY Process<br \/>\n1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 164\u00a0\u00a0\u00a0 137902\u00a0\u00a0\u00a0\u00a0\u00a0 1\u00a0\u00a0 0.00%\u00a0 0.00%\u00a0 0.00%\u00a0\u00a0 0 Load Meter<br \/>\n2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 100\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 119\u00a0\u00a0\u00a0 840\u00a0\u00a0 0.57%\u00a0 0.11%\u00a0 0.02%\u00a0\u00a0 2 Virtual Exec<br \/>\n3\u00a0\u00a0\u00a0\u00a0\u00a0 468644\u00a0\u00a0\u00a0\u00a0 81652\u00a0\u00a0 5739\u00a0\u00a0 0.00%\u00a0 0.04%\u00a0 0.05%\u00a0\u00a0 0 Check heaps<br \/>\n4\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0 0.00%\u00a0 0.00%\u00a0 0.00%\u00a0\u00a0 0 Pool Manager<br \/>\n5\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0 0.00%\u00a0 0.00%\u00a0 0.00%\u00a0\u00a0 0 Timers<br \/>\n6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0 0.00%\u00a0 0.00%\u00a0 0.00%\u00a0\u00a0 0 Serial Background<br \/>\n7\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0 0.00%\u00a0 0.00%\u00a0 0.00%\u00a0\u00a0 0 OIR Handler<br \/>\n8\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0 0.00%\u00a0 0.00%\u00a0 0.00%\u00a0\u00a0 0 IPC Zone Manager<br \/>\n9\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 348\u00a0\u00a0\u00a0 689225\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0 0.00%\u00a0 0.00%\u00a0 0.00%\u00a0\u00a0 0 IPC Periodic Tim<br \/>\n10\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0 0.00%\u00a0 0.00%\u00a0 0.00%\u00a0\u00a0 0 IPC Seat Manager<br \/>\n11\u00a0\u00a0\u00a0\u00a0\u00a0 175300\u00a0\u00a0\u00a0 332916\u00a0\u00a0\u00a0 526\u00a0\u00a0 0.00%\u00a0 0.02%\u00a0 0.00%\u00a0\u00a0 0 ARP Input<br \/>\n12\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3824\u00a0\u00a0\u00a0 138903\u00a0\u00a0\u00a0\u00a0 27\u00a0\u00a0 0.00%\u00a0 0.00%\u00a0 0.00%\u00a0\u00a0 0 HC Counter Timer<br \/>\n13\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0 0.00%\u00a0 0.00%\u00a0 0.00%\u00a0\u00a0 0 DDR Timers<br \/>\n14\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0 0.00%\u00a0 0.00%\u00a0 0.00%\u00a0\u00a0 0 Entity MIB API<br \/>\n15\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0 0.00%\u00a0 0.00%\u00a0 0.00%\u00a0\u00a0 0 SERIAL A&#8217;detect<br \/>\n16\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0 0.00%\u00a0 0.00%\u00a0 0.00%\u00a0\u00a0 0 Microcode Loader<br \/>\n17\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0 0.00%\u00a0 0.00%\u00a0 0.00%\u00a0\u00a0 0 IP Crashinfo Inp<br \/>\n&#8211;&lt;snip&gt;&#8211;<\/p>\n<p>Caution: When you poll SNMP variables, the CPU utilisation is affected. Continually polling at 1-second intervals can peg the CPU at 99 percent.<\/p>\n<p>High CPU detection using CLI:<br \/>\nRouter#sh processes cpu sorted ?<\/p>\n<p>1min\u00a0 Sort based on 1 minute Utilisation<br \/>\n5min\u00a0 Sort based on 5 minutes Utilisation<br \/>\n5sec\u00a0 Sort based on 5 seconds Utilisation<br \/>\n|\u00a0\u00a0\u00a0\u00a0 Output modifiers<br \/>\n&lt;cr&gt;<\/p>\n<p>Router#sh processes cpu sorted 5min<br \/>\nCPU Utilisation for five seconds: 2%\/0%; one minute: 2%; five minutes: 1%<br \/>\nPID Runtime(ms)\u00a0\u00a0\u00a0\u00a0 Invoked\u00a0\u00a0\u00a0\u00a0\u00a0 uSecs\u00a0\u00a0 5Sec\u00a0\u00a0 1Min\u00a0\u00a0 5Min TTY Process<br \/>\n179\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 168\u00a0\u00a0\u00a0 28275159\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0 0.79%\u00a0 0.76%\u00a0 0.77%\u00a0\u00a0 0 HQF Shaper Backg<br \/>\n307\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 160\u00a0\u00a0\u00a0\u00a0 3529216\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0 0.23%\u00a0 0.18%\u00a0 0.16%\u00a0\u00a0 0 PPP manager<br \/>\n5\u00a0\u00a0\u00a0\u00a0\u00a0 141912\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 13430\u00a0\u00a0\u00a0\u00a0\u00a0 10566\u00a0 0.00%\u00a0 0.10%\u00a0 0.11%\u00a0\u00a0 0 Check heaps<br \/>\n308\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 248\u00a0\u00a0\u00a0\u00a0 3529216\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0 0.15%\u00a0 0.09%\u00a0 0.08%\u00a0\u00a0 0 PPP Events<br \/>\n122\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 26424\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5141\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5139\u00a0 0.39%\u00a0 0.24%\u00a0 0.06%\u00a0\u00a0 0 Exec<br \/>\n2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 36\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 22595\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\u00a0 0.07%\u00a0 0.04%\u00a0 0.05%\u00a0\u00a0 0 Load Meter<br \/>\n180\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 44\u00a0\u00a0\u00a0\u00a0 1129318\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0 0.00%\u00a0 0.03%\u00a0 0.02%\u00a0\u00a0 0 RBSCP Background<br \/>\n312\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 16\u00a0\u00a0\u00a0\u00a0 1132266\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0 0.00%\u00a0 0.03%\u00a0 0.02%\u00a0\u00a0 0 FR Broadcast Out<br \/>\n42\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 64\u00a0\u00a0\u00a0\u00a0\u00a0 113310\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0 0.07%\u00a0 0.02%\u00a0 0.00%\u00a0\u00a0 0 Per-Second Jobs<br \/>\n65\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 28\u00a0\u00a0\u00a0\u00a0\u00a0 451871\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0 0.00%\u00a0 0.01%\u00a0 0.00%\u00a0\u00a0 0 Netclock Backgro<br \/>\n273\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1508\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 37676\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 40\u00a0 0.00%\u00a0 0.01%\u00a0 0.00%\u00a0\u00a0 0 OSPF-1 Hello<\/p>\n<p>Total CPU util. comprises process and interrupt percentages. These values are found on the first line of the output:<br \/>\nCPU Utilisation for five seconds: x%\/y%; one minute: a%; five minutes: b%<br \/>\nTotal CPU Utilisation: x%<br \/>\nProcess Utilisation: (x &#8211; y)%<br \/>\nInterrupt Utilisation: y%<br \/>\nProcess Utilisation is the difference between the Total and Interrupt (x and y). The one and five minute Utilisations are exponentially decayed averages (rather than an arithmetic average) therefore recent values have more influence on the calculated average.<\/p>\n<p>References:<br \/>\n&#8220;How to Collect CPU Utilisation on Cisco IOS Devices Using SNMP&#8221;<br \/>\n<a href=\"http:\/\/www.cisco.com\/en\/US\/tech\/tk648\/tk362\/technologies_tech_note09186a0080094a94.shtml\" target=\"_blank\">http:\/\/www.cisco.com\/en\/US\/tech\/tk648\/tk362\/technologies_tech_note09186a0080094a94.shtml<\/a><br \/>\nCisco SNMP Object Navigator for OID cpmCPUTotal5sec: <a href=\"http:\/\/tools.cisco.com\/Support\/SNMP\/do\/BrowseOID.do?local=en&amp;translate=Translate&amp;objectInput=cpmCPUTotal5sec\" target=\"_blank\">http:\/\/tools.cisco.com\/Support\/SNMP\/do\/BrowseOID.do?local=en&amp;translate=Translate&amp;objectInput=cpmCPUTotal5sec<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This EEM applet reads the Cisco &#8220;cpmCPUTotal5sec&#8221; object variable in the CISCO-PROCESS-MIB and triggers when the threshold exceeds 60 %.\u00a0 Three files are stored on the flash, containing the output of the CLI command &#8220;show process cpu | sorted&#8221; and &#8220;show ip traffic&#8221; as well as the current syslog.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[83,67],"tags":[],"_links":{"self":[{"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1803"}],"collection":[{"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1803"}],"version-history":[{"count":10,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1803\/revisions"}],"predecessor-version":[{"id":1805,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1803\/revisions\/1805"}],"wp:attachment":[{"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1803"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/darenmatthews.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}