Perform Object’s Monitoring Check

Poll agent for data using properties provided in the request body.

Request

HTTP Request

POST /node/api/objects/:objectId/monitoring/now

Permissions

objectPermissions & (manage-properties | manage-objects)

Path parameters

Parameter Type Description

objectId

String
required

The ID of an object.

Body parameters

Request body uses Property model.

Request body

Request body contains properties that will be used to perform a monitoring check.

[
    {
        "name": "AgentId",
        "value": "66f14e6a55f73e02aa881125"
    },
    {
        "name": "TaskPeriodValue",
        "destroy": true
    },
    {
        "name": "TaskPeriodUnit",
        "value": "seconds"
    },
    {
        "name": "TaskType",
        "value": "ping"
    },
    {
        "name": "PingHost",
        "value": "example.com"
    },
    {
        "name": "PingPacketsCount",
        "value": "10"
    },
    {
        "name": "PingTimeout",
        "value": "50"
    },
    {
        "name": "PingSrcInterface",
        "destroy": true
    }
]

Response

Response body is empty.

Example

Request

  • Bash

  • JavaScript

  • NodeJS

  • Python

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

curl -X POST $url -u $login:$password \
    -H "Content-Type: application/json" \
    -d @- <<EOF
[
    {
        "name": "AgentId",
        "value": "66f14e6a55f73e02aa881125"
    },
    {
        "name": "TaskPeriodValue",
        "destroy": true
    },
    {
        "name": "TaskPeriodUnit",
        "value": "seconds"
    },
    {
        "name": "TaskType",
        "value": "ping"
    },
    {
        "name": "PingHost",
        "value": "example.com"
    },
    {
        "name": "PingPacketsCount",
        "value": "10"
    },
    {
        "name": "PingTimeout",
        "value": "50"
    },
    {
        "name": "PingSrcInterface",
        "destroy": true
    }
]
EOF
let login = <...>
let password = <...>
let saymonHostname = <...>
let objectId = <...>
let path = "/node/api/objects/" + objectId + "/monitoring/now";
let auth = "Basic " + btoa(login + ":" + password);

let headers = new Headers();
headers.append("Content-Type", "application/json");
headers.append("Authorization", auth);

let data = JSON.stringify([
    {
        "name": "AgentId",
        "value": "66f14e6a55f73e02aa881125"
    },
    {
        "name": "TaskPeriodValue",
        "destroy": true
    },
    {
        "name": "TaskPeriodUnit",
        "value": "seconds"
    },
    {
        "name": "TaskType",
        "value": "ping"
    },
    {
        "name": "PingHost",
        "value": "example.com"
    },
    {
        "name": "PingPacketsCount",
        "value": "10"
    },
    {
        "name": "PingTimeout",
        "value": "50"
    },
    {
        "name": "PingSrcInterface",
        "destroy": true
    }
]);

let requestOptions = {
    method: "POST",
    headers: headers,
    body: data
};

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

let login = <...>
let password = <...>
let saymon_hostname = <...>
let object_id = <...>
let url = "https://" + saymon_hostname + "/node/api/objects/" +
    object_id + "/monitoring/now";

let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
let body = JSON.stringify([
    {
        "name": "AgentId",
        "value": "66f14e6a55f73e02aa881125"
    },
    {
        "name": "TaskPeriodValue",
        "destroy": true
    },
    {
        "name": "TaskPeriodUnit",
        "value": "seconds"
    },
    {
        "name": "TaskType",
        "value": "ping"
    },
    {
        "name": "PingHost",
        "value": "example.com"
    },
    {
        "name": "PingPacketsCount",
        "value": "10"
    },
    {
        "name": "PingTimeout",
        "value": "50"
    },
    {
        "name": "PingSrcInterface",
        "destroy": true
    }
]);

let options = {
    method: "POST",
    url: url,
    headers: {
        Authorization: auth
    },
    json : body
};

request(options, function (error, response, body) {
    if (error) throw new Error(error);
});
import requests
import json

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

body = [
    {
        "name": "AgentId",
        "value": "66f14e6a55f73e02aa881125"
    },
    {
        "name": "TaskPeriodValue",
        "destroy": true
    },
    {
        "name": "TaskPeriodUnit",
        "value": "seconds"
    },
    {
        "name": "TaskType",
        "value": "ping"
    },
    {
        "name": "PingHost",
        "value": "example.com"
    },
    {
        "name": "PingPacketsCount",
        "value": "10"
    },
    {
        "name": "PingTimeout",
        "value": "50"
    },
    {
        "name": "PingSrcInterface",
        "destroy": true
    }
]

response = requests.request("POST", url, json=body, auth=(login, password))
print(response.text)