Child pages
  • WHM API 0 Functions - servicestatus
Skip to end of metadata
Go to start of metadata

Description

This function reports which services are enabled, installed, and monitored on a server.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/servicestatus?service=crond
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/servicestatus?service=crond
 Command Line
whmapi0 servicestatus service=crond


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 0 documentation or run the whmapi0 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi0 command:

    /usr/local/cpanel/bin/whmapi0

 Output (JSON)
{
    "service": [
        {
        "monitored": 0,
        "installed": 1,
        "name": "crond",
        "display_name": "Cron Daemon",
        "enabled": 1
         }
    ],
    "result": {
        "statusmsg": null,
        "status": 1
    }
}
 Output (XML)
<servicestatus>
    <result>
        <status>1</status>
        <statusmsg/>
    </result>
    <service>
        <name>crond</name>
        <display_name>Cron Daemon</display_name>
        <enabled>1</enabled>
        <installed>1</installed>
        <monitored>0</monitored>
    </service>
</servicestatus>

   

Parameters

ParameterTypeDescriptionPossible valuesExample
servicestring

The service for which to view the status.

If you do not use this parameter, the function returns the statuses of all services.

For a list of possible values, read our Service Manager documentation.


mysql

 

Returns

ReturnTypeDescriptionPossible valuesExample
statusBooleanWhether the function succeeded.
  • 1 — Success.
  • 0 — Failure.
1
statusmsgstringA message of success or a reason for failure.A string value.null
servicearray of hashesA hash of service information.This hash includes the namedisplay_nameenabledinstalled, and monitored returns. 

name

string

The service's short name.

The function returns this value in the service hash.

For a list of possible values, read our Service Manager documentation.crond

display_name

string

The service's full name.

The function returns this value in the service hash.

A string value.Cron Daemon

enabled

Boolean

Whether the service is enabled.

The function returns this value in the service hash.

  • 1 — Enabled.
  • 0 — Disabled.
1

installed

Boolean

Whether the service is installed.

The function returns this value in the service hash.

  • 1 — Installed.
  • 0 — Uninstalled.
1

monitored

Boolean

Whether the service is monitored.

The function returns this value in the service hash.

  • 1 — Monitored
  • 0 — Not monitored.
1