Page tree
Skip to end of metadata
Go to start of metadata

Description

This function enables or disables a service and whether the system monitors it.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/configureservice?service=mysql&monitored=1&enabled=1
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/configureservice?service=mysql&monitored=1&enabled=1
 Command Line
whmapi0 configureservice service=mysql monitored=1 enabled=1

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. 
  • We introduced this functionality in cPanel & WHM version 11.52.0.8.

 Output (JSON)
{
   "result":[
      {
         "status":1,
         "statusmsg":"Enabled monitoring for mysql."
      }
   ]
}
 Output (XML)
<configureservice>
     <result>
          <status>1</status>
          <statusmsg>
          Enabled monitoring for mysql.
          </statusmsg>
     </result>
</configureservice>

   

Parameters

ParameterTypeDescriptionPossible valuesExample
servicestring

Required

The service to configure.

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

mysql
enabledBoolean

Whether to enable the service.

If you do not use this parameter, the function not change the service's enabled status.

  • 1 — Enable the service.
  • 0 — Disable the service.
1
monitoredBoolean

Whether to monitor the service via WHM's Service Status interface (Home >> Server Status >> Service Status).

If you do not use this parameter, the function not change the service's monitoring status.

  • 1 — Monitor the service.
  • 0 — Do not monitor the service.
1

 

Returns

ReturnTypeDescriptionPossible valuesExample
resultarray of hashesAn array of hashes of service status data.This hash includes the status and statusmsg returns. 

status

Boolean

Whether the function succeeded.

The function returns this value in the result hash.

  • 1 — Success.
  • 0 — Failure.
1

statusmsg

string

A message of success or a reason for failure

The function returns this value in the result hash.

A string value.Enabled monitoring for mysql.