PA CPU usage via the API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Please sign in to see details of an important advisory in our Customer Advisories area.

PA CPU usage via the API

Hello All, 

 

In PA Firewall Dashboard we have the system Reousrces widget, were we can see the Management CPU and Data Plane CPU usage, I was trying to do the same using the API, but I'm not sure how PA are calculating the values, 

 

The GUI is sending a POST request to the backed PHP code (DashboardDirect.getSystemResources) to get the values.

 

But we don't have such API available to use, 

 

So for DP CPU usage we can use  *show running resource-monitor*  API and we can calculate the CPU load during the last 60 seconds and we can get a value that is similar to the one in the GUI. 

 

But for the MP it's a bit complicated! *show system resources* API will return a text output of the command itself, and we can get the details from the below part 
*Cpu(s): 51.9%us, 5.4%sy, 1.0%ni, 41.6%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%st*

 

So my concern is how to calcluate the load average from the output, and I'm trying to query the api multiple times but I'm getting the same output each time for a long time!! the below row will never change! any  caching is being done via the API ?!

*Cpu(s): 51.9%us, 5.4%sy, 1.0%ni, 41.6%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%st*

 

Thanks!

 

Mohammad

2 REPLIES 2

L4 Transporter
You could also just query the mp-monitor.log from the API which is going to return in the same format you saw in show running resource-monitor

L0 Member

3 year bump here, trying to achieve the same and noticing the same that it's a backend PHP code call.

[2022/12/20 14:32:22]  ExtDirect_Router  (INFO) 8836928913151289 - -
Call to [PanDirect.run] /DashboardDirect.getSystemResources from router.php
[2022/12/20 14:32:22]  PanDirect  (INFO) 8836928913151289 - -
========= RemoteCall: DashboardDirect.getSystemResources =========
[20-Dec-2022 14:32:22 America/New_York] [2022/12/20 14:32:22]  panui_core\mgmt\MSConnection  (DEBUG) 8836928913151289 - -
socket 40 sending request <request cmd="status" cookie="8836928913151289"/>

[20-Dec-2022 14:32:22 America/New_York] [2022/12/20 14:32:22]  panui_core\mgmt\MSConnection  (DEBUG) 8836928913151289 - -
socket 40 response took 0.072s <response status="success">
<status>
<stats>
<mp-cpu-utilization>3</mp-cpu-utilization>
<dp-cpu-utilization>1</dp-cpu-utilization>
</stats>


You can also get the same info via >show system state | match sys.monitor.s0.mp.exports, unfortunately it returns a non-XML formatted response with a huge amount of text. (credit: https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA10g000000PLKKCA4)

  • 3446 Views
  • 2 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!