Skip to content

Get Object's Stat

Returns agent's data (stat) of an object with the specified ID.

Request

HTTP Request

GET /node/api/objects/:id/stat

Permissions

objectPermissions

Path parameters

Parameter Type Description
id String
required
The ID or discovery ID of the object whose stat must be retrieved.

Request body

The request body is empty.

Response

Returns a requested object's stat. See the Stat for more information.

Example

Request

login=<...>
password=<...>
saymon_hostname=<...>
object_id=<...>
url=https://$saymon_hostname/node/api/objects/$object_id/stat

curl -X GET $url -u $login:$password
let login = <...>
let password = <...>
let saymonHostname = <...>
let objectId = <...>
let path = "/node/api/objects/" + objectId + "/stat";
let auth = "Basic " + btoa(login + ":" + password);

let headers = new Headers();
headers.append("Authorization", auth);

let requestOptions = {
    method: "GET",
    headers: headers
};

fetch(saymonHostname + path, requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log("error", error));
const http = require("http");

let login = <...>
let password = <...>
let saymonHostname = <...>
let objectId = <...>
let path = "/node/api/objects/" + objectId + "/stat";
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");

let options = {
    "method": "GET",
    "hostname": saymonHostname,
    "headers": {
        "Authorization": auth
    },
    "path": path
};

let req = http.request(options, function (res) {
    let chunks = [];

    res.on("data", function (chunk) {
        chunks.push(chunk);
    });

    res.on("end", function (chunk) {
        let body = Buffer.concat(chunks);
        console.log(body.toString());
    });

    res.on("error", function (error) {
        console.error(error);
    });
});

req.end();
import requests

login = <...>
password = <...>
saymon_hostname = <...>
object_id = <...>
url = "https://" + saymon_hostname + "/node/api/objects/" + \
    object_id + "/stat"

response = requests.request("GET", url, auth=(login, password))
print(response.text)

Response

{
    "entityId": "5e21b85b308c3c66d64e07c8",
    "entityType": "obj",
    "taskType": "agentWatchdog",
    "period": 60000,
    "timestamp": 1585040374498,
    "agentId": "5e21b85b308c3c66d64e07c8",
    "agentVersion": "4.2.69-SNAPSHOT",
    "agentBuild": "866cc",
    "payload": {
        "runtimeName": "OpenJDK Runtime Environment",
        "runtimeVersion": "1.8.0_242-8u242-b08-0ubuntu3~16.04-b08",
        "totalMemory": 267911168,
        "freeMemory": 226294168,
        "maxMemory": 1830813696,
        "usedHeapMemory": 41617000,
        "usedNonHeapMemory": 36068184,
        "processCpuLoad": 0.0036666666666666666,
        "numberOfThreads": 10,
        "snmpTrapsPerSecond": 0,
        "statNotificationsPerSecond": 0,
        "tasksNumber": 1,
        "hostName": "rossinnotw",
        "networkInterfaces": {
            "IPv6": [
                "fe80:0:0:0:24a9:1aff:fecb:3722%veth3c89613",
                "fe80:0:0:0:f45b:6dff:fe6e:5497%veth9f402c5",
                "fe80:0:0:0:42:ffff:fe77:1b87%docker0",
                "fe80:0:0:0:3e4d:25b:3be:d798%enp4s0"
            ],
            "IPv4": [
                "172.17.0.1",
                "192.168.1.82"
            ]
        }
    }
}

See Also