Test Monitoring Properties
Test monitoring properties using properties from the request body on the link with the specified ID.
Request
Path parameters
Parameter | Type | Description |
---|---|---|
linkId |
String |
The ID of an link where to execute the test. |
Body parameters
Request body uses Property model.
Request body
Request body contains properties that will be used to perform a test 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
}
]
Example
Request
-
Bash
-
JavaScript
-
NodeJS
-
Python
login=<...>
password=<...>
saymon_hostname=<...>
link_id=<...>
url=https://$saymon_hostname/node/api/links/$link_id/monitoring/test
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 linkId = <...>
let path = "/node/api/links/" + linkId + "/monitoring/test";
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 link_id = <...>
let url = "https://" + saymon_hostname + "/node/api/links/" +
link_id + "/monitoring/test";
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 = <...>
link_id = <...>
url = "https://" + saymon_hostname + "/node/api/links/" + \
link_id + "/monitoring/test"
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)