PA CPU usage via the API

Reply

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

L4 Transporter

Re: PA CPU usage via the API

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
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 Live Community as a whole!

The Live Community thanks you for your participation!