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

Service Status — servicestatus

This function tells you which services (daemons) are installed and enabled on, and monitored by, your server.

Calling Functions

Using the XML API

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

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

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

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

  • 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

The following input parameter is optional:

  • service (string) — This parameter allows you to specify a single service whose status you wish to see.

Output

Show Hide
  • servicestatus — Root-level XML tag for the output of the servicestatus function.
    • result — Container for the results of the function call.
      • status — The status of the function call.
        • 1 — success.
        • 0 — failure.
      • statusmsg — Detailed message about the status of the call.
    • service — Container for the service status information.
      • name — Short name of the service.
      • display_name — Full name of the service.
      • enabled — Whether the service is enabled on the server.
        • 1 — yes.
        • 0 — no.
      • installed — Whether the service is installed on the server.
        • 1 — yes.
        • 0 — no.
      • monitored — Whether the service's status is being monitored.
        • 1 — yes.
        • 0 — no.

Examples

XML API

Show Hide

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

<servicestatus>
     <result>
          <status>1</status>
          <statusmsg/>
     </result>
     <service>
          <name>clamd</name>
          <display_name>ClamAV Daemon</display_name>
          <enabled>1</enabled>
          <installed>0</installed>
          <monitored>0</monitored>
     </service>
     <service>
          <name>cpanellogd</name>
          <display_name>cPanel Log and Bandwidth Processor</display_name>
          <enabled>1</enabled>
          <installed>1</installed>
          <monitored>1</monitored>
     </service>
     <service>
          <name>cpdavd</name>
          <display_name>cPanel DAV Daemon</display_name>
          <enabled>1</enabled>
          <installed>1</installed>
          <monitored>0</monitored>
     </service>
     <service>
          <name>cpsrvd</name>
          <display_name>cPanel Daemon</display_name>
          <enabled>1</enabled>
          <installed>1</installed>
          <monitored>1</monitored>
     </service>
</servicestatus>

JSON API

Show Hide

Calling the following function in WebHost Manager: https://example.com:2087/json-api/servicestatus will produce output similar to:

{
   "result":{
      "status":1,
      "statusmsg":null
   },
   "service":[
      {
         "display_name":"ClamAV Daemon",
         "installed":0,
         "enabled":1,
         "monitored":0,
         "name":"clamd"
      },
      {
         "display_name":"cPanel Log and Bandwidth Processor",
         "installed":1,
         "enabled":1,
         "monitored":1,
         "name":"cpanellogd"
      },
      {
         "display_name":"cPanel DAV Daemon",
         "installed":1,
         "enabled":1,
         "monitored":0,
         "name":"cpdavd"
      },
   ]
}

Topic revision: r8 - 09 Mar 2011 - 15:04:02 - MelanieSeibert