- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
04-30-2019 07:18 AM
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
05-03-2019 06:56 AM
12-20-2022 11:39 AM
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] [41m ExtDirect_Router [0m (INFO) 8836928913151289 - - Call to [PanDirect.run] /DashboardDirect.getSystemResources from router.php [2022/12/20 14:32:22] [42m PanDirect [0m (INFO) 8836928913151289 - - ========= RemoteCall: DashboardDirect.getSystemResources ========= [20-Dec-2022 14:32:22 America/New_York] [2022/12/20 14:32:22] [41m panui_core\mgmt\MSConnection [0m (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] [41m panui_core\mgmt\MSConnection [0m (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)
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!