πŸ”—Monitor HTTP RESTful API

Use the CDAP Monitor HTTP RESTful API to examine the CDAP system services used internally by CDAP. Additional details on monitoring can be found in the Administration Manual: Logging and Monitoring.

All methods or endpoints described in this API have a base URL (typically http://<host>:11015 or https://<host>:10443) that precedes the resource identifier, as described in the RESTful API Conventions. These methods return a status code, as listed in the RESTful API Status Codes.

πŸ”—Listing all System Services and their Details

For the detailed information of all available CDAP system services, use:

GET /v3/system/services

The response body will contain a JSON-formatted list of the existing system services:

[
    {
        "name": "appfabric",
        "description": "Service for managing application lifecycle.",
        "status": "OK",
        "logs": "OK",
        "min": 1,
        "max": 1,
        "requested": 1,
        "provisioned": 1
    }
    ...
]

See downloading System Logs for information and an example of using these system services.

HTTP Responses

Status Codes Description
200 OK The event successfully called the method, and the body contains the results

πŸ”—Checking the Status of all System Services

To check the status of all the CDAP system services, use:

GET /v3/system/services/status

HTTP Responses

Status Codes Description
200 OK The event successfully called the method, and the body contains the results

πŸ”—Checking the Status of a System Service

To check the status of a specific CDAP system service, use:

GET /v3/system/services/<service-id>/status

The status of these CDAP system services can be checked:

Service Service ID Description of the service
Metrics metrics Service that handles metrics related HTTP requests
Transaction transaction Service that handles transactions
Streams streams Service that handles stream management
App Fabric appfabric Service that handles application fabric requests
Log Saver log.saver Service that aggregates all system and application logs
Metrics Processor metrics.processor Service that aggregates all system and application metrics
Dataset Executor dataset.executor Service that handles all data-related HTTP requests
Explore Service explore.service Service that handles all HTTP requests for ad-hoc data exploration

Note: The service status checks are more useful when CDAP is running in a distributed cluster mode.

HTTP Responses

Status Codes Description
200 OK The service is up and running
404 Not Found The service is either not running or not found

Example

HTTP Method GET /v3/system/services/metrics/status
Description Returns the status of the metrics service

πŸ”—Container Information of a System Service

If you are trying to debug a CDAP system service, you can retrieve container info for a system service with:

GET /v3/system/services/<service-id>/live-info

where

Parameter Description
service-id Name (ID) of the system service

Note: This returns useful information only for Distributed CDAP installations.

πŸ”—Restarting System Service Instances

To restart all instances of a CDAP system service, you can issue an HTTP POST request to the URL:

POST /v3/system/services/<service-id>/restart

You can restart a particular instance of a system service in CDAP, using its instance id, by issuing an HTTP POST request to the URL:

POST /v3/system/services/<service-id>/instances/<instance-id>/restart
Parameter Description
service-id Name (ID) of the system service whose instances are to be restarted
instance-id Specific instance of a service that needs to be restarted; instance-id runs from 0 to (the number of instances-per-service -1)

HTTP Responses

Status Codes Description
403 Bad Request The service is unavailable because it was not enabled
404 Service not found The service name is not valid
500 Internal error Internal error encountered when processing the request
503 Service Unavailable The service is unavailable. For example, it may not yet have been started

To retrieve details of the last restart attempt made for a particular service, issue an HTTP GET request to the URL:

GET /v3/system/services/<service-id>/latest-restart

The response body will contain a JSON-formatted status of the last restart attempt for that service:

{
    "instanceIds":[0],
    "serviceName":"dataset.executor",
    "startTimeInMs":1437070039984,
    "endTimeInMs":1437070039992,
    "status":"SUCCESS"}
}
Parameter Description
service-id Name (ID) of the system service for which details of last restart are to be retrieved

HTTP Responses

Status Codes Description
404 Service not found The service name is not valid
500 Internal error Internal error encountered when processing the request

πŸ”—Scaling System Services

In distributed CDAP installations, the number of instances for CDAP system services can be queried and changed by using these commands:

GET /v3/system/services/<service-id>/instances
PUT /v3/system/services/<service-id>/instances

with the arguments as a JSON string in the body:

{ "instances" : <quantity> }
Parameter Description
service-id Name (ID) of the system service
quantity Number of instances to be used

Note: In standalone CDAP, trying to set the instances of system services will return a Status Code 400 Bad Request.

Examples

HTTP Method GET /v3/system/services/metrics/instances
Description Determine the number of instances being used for the metrics HTTP service
   
HTTP Method

PUT /v3/system/services/metrics/instances instances

with the arguments as a JSON string in the body:

{ "instances" : 2 }
Description Sets the number of instances of the metrics HTTP service to 2