Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation

Display the Server's Load Average — loadavg

This function will display your server's load average. It displays the average at 3 different points in time: the average of the last minute, the last 5 minutes, and the last 15 minutes. The average value is expressed in decimal form. For example, a value of .18 would mean you were using 18% of your server's computing power.

For more information on load averages, you can visit the Wikipedia article here.

Calling Functions

Using the XML API

To use the XML API to perform the loadavg function from within your custom script:

  • Append the /xml-api/loadavg function call name, plus the required variables (see below), to a URL which includes the address of your server.

  • For example, on a server whose hostname is example.com, you would include the following string in your script: https://example.com:2087/xml-api/loadavg

  • You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.

  • You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.

Using the JSON API

To use the JSON API to perform the loadavg function from within your custom script:

  • Append the /json-api/loadavg function call name, plus the required variables (see below), to a URL which includes the address of your server.

  • For example, on a server whose hostname is example.com, you would include the following string in your script: https://example.com:2087/json-api/loadavg

  • You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.

  • You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.

Variables

Input

None

Output

Show Hide

  • loadavg — Root-level XML tag for the output of the loadavg function.
    • one (float) — The server's load average over the last minute.
    • five (float) — The server's load average over the last 5 minutes.
    • fifteen (float) — The server's load average over the last 15 minutes.

Examples

XML API

Show Hide

Calling https://example.com:2087/xml-api/loadavg in WebHost Manager will produce output similar to:

<loadavg>
       <one>0.17</one>
       <five>0.18</five>
       <fifteen>0.19</fifteen>
</loadavg>

JSON API

Show Hide

Calling https://example.com:2087/json-api/loadavg in WebHost Manager will produce output similar to:

{
   "one":"0.05",
   "five":"0.19",
   "fifteen":"0.20"
}

Topic revision: r3 - 29 Oct 2010 - 15:16:26 - MelanieSeibert