Query OCP Agent details on a host

2024-11-06 03:13:28  Updated

Description

You can call this operation to query OCP Agent details on a host.

Call description

Prerequisite

You have the HOST_VIEWER permissions.

Request path

GET /compute/hosts/{hostId}/agent

Request parameters

Parameter Type Required Example value Description
hostId Long Yes 100 The ID of the host.

Response parameters

Parameter Type Description
successful Boolean Indicates whether the request was successful.
timestamp Datetime The timestamp when the server completed the request.
duration Integer The time taken by the server to process the request, in milliseconds.
status Integer An HTTP status code.
traceId String The trace ID of the request. This trace ID is used for troubleshooting.
server String The address of the application server that responded to the request.
data Object For more information, see Data structure of HostAgent.

Data structure of HostAgent

Parameter Type Description
id Long The ID of the OCP Agent.
version String The version of the OCP Agent.
installHome String The installation directory of the OCP Agent.
logHome String The log directory of the OCP Agent.
lastAvailableTime String The last time when the Agent process was active.
hostId Long The ID of the host.
hostInnerIpAddress String The IP address of the host.
status String The status of the Agent process. Valid values: STOPPED and STARTED.
processes Array For more information, see Data structure of HostAgentProcess.
createTime String The creation time.
updateTime String The update time.

Data structure of HostAgentProcess

Parameter Type Description
id Long The ID of the Agent process.
hostId Long The ID of the host.
alias String The alias of the process.
pid Integer The PID of the process.
user String The user of the process.
startCommand String The start command.
ports String The open ports.
elapsedTime Long The total active time of the process, in seconds.
lastActiveTime String The last time when the process was active.
status String The process status. Valid values: STOPPED and STARTED.
operable Boolean Indicates whether the process can be operated by the user.
logFilePattern String The template of log file names.
createTime String The creation time.
updateTime String The update time.

Examples

Sample request

GET /api/v2/compute/hosts/20/agent

Sample response

{
    "data": {
        "createTime": "2021-08-03T14:45:50+08:00",
        "hostId": 20,
        "hostInnerIpAddress": "xxx.xxx.xxx.xxx",
        "id": 2000021,
        "installHome": "/home/admin/ocp_agent",
        "lastAvailableTime": "2021-09-02T17:29:26+08:00",
        "logHome": "/home/admin/ocp_agent/log",
        "processes": [
            {
                "alias": "ocp_agentd",
                "createTime": "2021-08-03T14:45:50+08:00",
                "elapsedTime": 2601817,
                "hostId": 20,
                "id": 181,
                "lastActiveTime": "2021-09-02T17:29:27+08:00",
                "logFilePattern": "/home/admin/ocp_agent/log/ocp_agentd.log*",
                "operable": false,
                "pid": 6337,
                "ports": "",
                "startCommand": "ocp_agentd",
                "status": "STARTED",
                "updateTime": "2021-08-03T14:45:50+08:00",
                "user": "root".
            },
            {
                "alias": "pos_proxy",
                "createTime": "2021-08-03T14:45:50+08:00",
                "elapsedTime": 2601816,
                "hostId": 20,
                "id": 182,
                "lastActiveTime": "2021-09-02T17:29:27+08:00",
                "logFilePattern": "/home/admin/ocp_agent/log/pos_proxy.log*",
                "operable": false,
                "pid": 6434,
                "ports": "62888",
                "startCommand": "pos_proxy",
                "status": "STARTED",
                "updateTime": "2021-08-03T14:45:50+08:00",
                "user": "root".
            },
            {
                "alias": "node_exporter",
                "createTime": "2021-08-03T14:45:50+08:00",
                "elapsedTime": 2601816,
                "hostId": 20,
                "id": 183,
                "lastActiveTime": "2021-09-02T17:29:27+08:00",
                "logFilePattern": "/home/admin/ocp_agent/log/node_exporter.log*",
                "operable": true,
                "pid": 6445,
                "ports": "63000",
                "startCommand": "/home/admin/ocp_agent/agent/node_exporter --web.listen-address=:63000 --no-collector.arp --no-collector.bcache --no-collector.edac --no-collector.textfile --no-collector.time --no-collector.timex --no-collector.uname --no-collector.vmstat --no-collector.xfs --no-collector.zfs --no-collector.cpufreq --no-collector.conntrack --no-collector.entropy --no-collector.ipvs --no-collector.mdadm --no-collector.netclass --no-collector.netstat --no-collector.nfs --no-collector.nfsd --no-collector.pressure --no-collector.sockstat --no-collector.stat",
                "status": "STARTED",
                "updateTime": "2021-08-03T14:45:50+08:00",
                "user": "root".
            },
            {
                "alias": "ocp_exporter",
                "createTime": "2021-08-03T14:45:50+08:00",
                "elapsedTime": 693340,
                "hostId": 20,
                "id": 184,
                "lastActiveTime": "2021-09-02T17:29:27+08:00",
                "logFilePattern": "/home/admin/ocp_agent/log/ocp_exporter.log*",
                "operable": true,
                "pid": 116363,
                "ports": "62889",
                "startCommand": "ocp_exporter",
                "status": "STARTED",
                "updateTime": "2021-08-25T16:53:49+08:00",
                "user": "root".
            },
            {
                "alias": "obstat2",
                "createTime": "2021-08-03T15:02:44+08:00",
                "elapsedTime": 2600802,
                "hostId": 20,
                "id": 185,
                "lastActiveTime": "2021-09-02T17:29:27+08:00",
                "logFilePattern": "/home/admin/ocp_agent/log/obstat2.log*",
                "operable": true,
                "pid": 38429,
                "ports": "",
                "startCommand": "/home/admin/ocp_agent/obagent/obstat2 -o http://xxx.xxx.xxx.xxx:80 -c stress __obproxy__ -f 20",
                "status": "STARTED",
                "updateTime": "2021-08-03T15:03:27+08:00",
                "user": "root".
            },
            {
                "alias": "ob_logtailer",
                "createTime": "2021-08-03T15:02:44+08:00",
                "elapsedTime": 2600802,
                "hostId": 20,
                "id": 186,
                "lastActiveTime": "2021-09-02T17:29:27+08:00",
                "logFilePattern": "/home/admin/ocp_agent/log/ob_logtailer.log*",
                "operable": true,
                "pid": 38468,
                "ports": "",
                "startCommand": "ob_logtailer",
                "status": "STARTED",
                "updateTime": "2021-08-03T15:03:27+08:00",
                "user": "root".
            },
            {
                "alias": "ob_cleaner",
                "createTime": "2021-08-03T15:02:44+08:00",
                "elapsedTime": 0,
                "hostId": 20,
                "id": 187,
                "lastActiveTime": "2021-08-25T17:48:28+08:00",
                "logFilePattern": "/home/admin/ocp_agent/log/ob_cleaner.log*",
                "operable": true,
                "pid": 0,
                "ports": null,
                "startCommand": null,
                "status": "STOPPED",
                "updateTime": "2021-08-25T17:49:28+08:00",
                "user": null
            }
        ],
        "status": "AVAILABLE",
        "updateTime": "2021-09-02T17:29:25+08:00",
        "version": "3.1.0-1928505"
    },
    "duration": 69,
    "server": "a83ad33525",
    "status": 200,
    "successful": true,
    "timestamp": "2021-09-02T17:30:16.752+08:00",
    "traceId": "770210ec54924426"
}

Contact Us