<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Rest API for CPU utilization in General Topics</title>
    <link>https://live.paloaltonetworks.com/t5/general-topics/rest-api-for-cpu-utilization/m-p/230787#M66292</link>
    <description>&lt;P&gt;This is actually generated through a collection of things that you can't&amp;nbsp;&lt;EM&gt;easily&lt;/EM&gt; mimic via the API. I guess the real question would be what you are trying to get with this information and why? It's going to be a lot of scripting to get this anywhere close to what you are looking at in the debug console.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Session information:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Can be gathered a few ways; but for those running multiple vsys it's easiest to simply do the following since it breaks down the &amp;lt;current/&amp;gt; number of sessions by &amp;lt;vsys/&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/api/?type=op&amp;amp;cmd=&amp;lt;show&amp;gt;&amp;lt;session&amp;gt;&amp;lt;meter&amp;gt;&amp;lt;/meter&amp;gt;&amp;lt;/session&amp;gt;&amp;lt;/show&amp;gt;&lt;/PRE&gt;&lt;P&gt;If you only have a sole &amp;lt;vsys&amp;gt; then you can simply run the session info and get the value of &amp;lt;num-active/&amp;gt;&lt;/P&gt;&lt;PRE&gt;/api/?type=op&amp;amp;cmd=&amp;lt;show&amp;gt;&amp;lt;session&amp;gt;&amp;lt;info&amp;gt;&amp;lt;/info&amp;gt;&amp;lt;/session&amp;gt;&amp;lt;/show&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Management CPU Utilization:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;There really isn't an easy way to parse the result due to the data structure.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/api/?type=op&amp;amp;cmd=&amp;lt;show&amp;gt;&amp;lt;system&amp;gt;&amp;lt;resources&amp;gt;&amp;lt;/resources&amp;gt;&amp;lt;/system&amp;gt;&amp;lt;/show&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataplane CPU Utilization:&amp;nbsp;&lt;/P&gt;&lt;P&gt;This would depend on how opten you are running this, I provided an hour.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/api/?type=op&amp;amp;cmd=&amp;lt;show&amp;gt;&amp;lt;running&amp;gt;&amp;lt;resource-monitor&amp;gt;&amp;lt;hour&amp;gt;&amp;lt;last&amp;gt;1&amp;lt;/last&amp;gt;&amp;lt;/hour&amp;gt;&amp;lt;/resource-monitor&amp;gt;&amp;lt;/running&amp;gt;&amp;lt;/show&amp;gt;&lt;/PRE&gt;&lt;P&gt;You would have to average a lot of the return results to get the same result that you presented due to how the data is actually strucutred.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Sep 2018 22:04:18 GMT</pubDate>
    <dc:creator>BPry</dc:creator>
    <dc:date>2018-09-13T22:04:18Z</dc:date>
    <item>
      <title>Rest API for CPU utilization</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/rest-api-for-cpu-utilization/m-p/230759#M66287</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to&amp;nbsp;create a Rest API URL to check the CPU utilization on my management and data planes and create a report to monitor over time. Using commands like show running resource-monitor did not give me exactly what I was looking for. I used the &amp;lt;firewall ip&amp;gt;/debug and got the following XML:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;response status="success"&amp;gt;&lt;BR /&gt;&amp;lt;status&amp;gt;&lt;BR /&gt;&amp;lt;stats&amp;gt;&lt;BR /&gt;&amp;lt;mp-cpu-utilization&amp;gt;8&amp;lt;/mp-cpu-utilization&amp;gt;&lt;BR /&gt;&amp;lt;dp-cpu-utilization&amp;gt;17&amp;lt;/dp-cpu-utilization&amp;gt;&lt;BR /&gt;&amp;lt;/stats&amp;gt;&lt;BR /&gt;&amp;lt;/status&amp;gt;&lt;BR /&gt;&amp;lt;/response&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having problems getting it into Rest API URL format and wanted to see if someone more experienced with this could help. Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 19:12:07 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/rest-api-for-cpu-utilization/m-p/230759#M66287</guid>
      <dc:creator>TLineberry</dc:creator>
      <dc:date>2018-09-13T19:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Rest API for CPU utilization</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/rest-api-for-cpu-utilization/m-p/230787#M66292</link>
      <description>&lt;P&gt;This is actually generated through a collection of things that you can't&amp;nbsp;&lt;EM&gt;easily&lt;/EM&gt; mimic via the API. I guess the real question would be what you are trying to get with this information and why? It's going to be a lot of scripting to get this anywhere close to what you are looking at in the debug console.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Session information:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Can be gathered a few ways; but for those running multiple vsys it's easiest to simply do the following since it breaks down the &amp;lt;current/&amp;gt; number of sessions by &amp;lt;vsys/&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/api/?type=op&amp;amp;cmd=&amp;lt;show&amp;gt;&amp;lt;session&amp;gt;&amp;lt;meter&amp;gt;&amp;lt;/meter&amp;gt;&amp;lt;/session&amp;gt;&amp;lt;/show&amp;gt;&lt;/PRE&gt;&lt;P&gt;If you only have a sole &amp;lt;vsys&amp;gt; then you can simply run the session info and get the value of &amp;lt;num-active/&amp;gt;&lt;/P&gt;&lt;PRE&gt;/api/?type=op&amp;amp;cmd=&amp;lt;show&amp;gt;&amp;lt;session&amp;gt;&amp;lt;info&amp;gt;&amp;lt;/info&amp;gt;&amp;lt;/session&amp;gt;&amp;lt;/show&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Management CPU Utilization:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;There really isn't an easy way to parse the result due to the data structure.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/api/?type=op&amp;amp;cmd=&amp;lt;show&amp;gt;&amp;lt;system&amp;gt;&amp;lt;resources&amp;gt;&amp;lt;/resources&amp;gt;&amp;lt;/system&amp;gt;&amp;lt;/show&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataplane CPU Utilization:&amp;nbsp;&lt;/P&gt;&lt;P&gt;This would depend on how opten you are running this, I provided an hour.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/api/?type=op&amp;amp;cmd=&amp;lt;show&amp;gt;&amp;lt;running&amp;gt;&amp;lt;resource-monitor&amp;gt;&amp;lt;hour&amp;gt;&amp;lt;last&amp;gt;1&amp;lt;/last&amp;gt;&amp;lt;/hour&amp;gt;&amp;lt;/resource-monitor&amp;gt;&amp;lt;/running&amp;gt;&amp;lt;/show&amp;gt;&lt;/PRE&gt;&lt;P&gt;You would have to average a lot of the return results to get the same result that you presented due to how the data is actually strucutred.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 22:04:18 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/rest-api-for-cpu-utilization/m-p/230787#M66292</guid>
      <dc:creator>BPry</dc:creator>
      <dc:date>2018-09-13T22:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: Rest API for CPU utilization</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/rest-api-for-cpu-utilization/m-p/230789#M66293</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/43480"&gt;@BPry&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;&lt;STRONG&gt;Management CPU Utilization:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;There really isn't an easy way to parse the result due to the data structure.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/api/?type=op&amp;amp;cmd=&amp;lt;show&amp;gt;&amp;lt;system&amp;gt;&amp;lt;resources&amp;gt;&amp;lt;/resources&amp;gt;&amp;lt;/system&amp;gt;&amp;lt;/show&amp;gt;&lt;/PRE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;With some regex this shouldn't be a problem (here an example that fetches the different CPU values that this output provides in regex capture groups:&lt;/P&gt;&lt;PRE&gt;^top\s-\s\d\d:\d\d:\d\d\sup\s\d{1,3}\sdays,\s\d\d:\d\d,\s\d{1,2}\susers,\sload\saverage:\s(\d{1,3}\.\d{1,3}),\s(\d{1,3}\.\d{1,3}),\s(\d{1,3}\.\d{1,3})\sTasks:\s\d{1,3}\stotal,\s\d{1,3}\srunning,\s\d{1,3}\ssleeping,\s\d{1,3}\sstopped,\s\d{1,3}\szombie\sCpu\(s\):\s(\d{1,3}\.\d{1,3})%us,\s(\d{1,3}\.\d{1,3})%sy,\s(\d{1,3}\.\d{1,3})%ni,\s(\d{1,3}\.\d{1,3})&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Sep 2018 23:19:52 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/rest-api-for-cpu-utilization/m-p/230789#M66293</guid>
      <dc:creator>Remo</dc:creator>
      <dc:date>2018-09-13T23:19:52Z</dc:date>
    </item>
  </channel>
</rss>

