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 (with Metadata) — systemloadavg

This function is only available in versions 11.27/11.28+.

This function will calculate and return the system's load average.

Calling Functions

Using the XML API

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

  • Append the /xml-api/=systemloadavg= 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/=systemloadavg=

  • 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 systemloadavg function from within your custom script:

  • Append the /json-api/=systemloadavg= 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/=systemloadavg=

  • 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

  • api.version (integer) — The XML API version number. You should always set this value to 1.

Output

  • result — The results container.
  • data — The data container.
  • one — The load average over the last minute.
  • five — The load average over the last 5 minutes.
  • fifteen — The load average over the last 15 minutes.
  • metadata — The metadata container.
  • result (boolean) — A boolean value that indicates success or failure.
    • 1 — Indicates success
    • 0 — inidcates failure
  • reason (string) — A string value that contains a message of success or a reason for failure.
  • version (integer) — An integer value that contains the version number of the XML API used for the function, in this case 1.
  • command (string) — The function that was just called. In this case, systemloadavg.

Examples

XML API

Calling this URL in WebHost Manager:

https://example.com:2087/xml-api/systemloadavg?api.version=1

will produce output similar to:

<result>
   <data>
      <one>0.01</one>
      <five>0.00</five>
      <fifteen>0.00</fifteen>
   </data>
   <metadata>
      <result>1</result>
      <reason>OK</reason>
      <version>1</version>
      <command>systemloadavg</command>
   </metadata>
</result>

JSON API

Calling this URL in WebHost Manager:

https://example.com:2087/json-api/systemloadavg?api.version=1

will produce output similar to:

{
      "data":{
         "one":"0.01",
         "five":"0.01",
         "fifteen":"0.00"
      },
      "metadata":{
         "result":1,
         "reason":"OK",
         "version":1,
         "command":"systemloadavg"
      }
   }

Topic revision: r7 - 29 Oct 2010 - 15:16:06 - MelanieSeibert
AllDocumentation/AutomationIntegration.XmlSystemLoadAvg moved from Sandbox.XmlSystemLoadAvg on 02 Sep 2010 - 19:23 by Main.JustinSchaefer