Get All Custom Tasks
Returns all custom monitoring tasks (probes).
Custom tasks are executed by SAYMON Agents. |
Response
Returns a list of all custom tasks in the system.
Custom tasks have the following fields:
Field | Type | Description |
---|---|---|
id |
String |
ID of the probe. ID should be a path to the probe script. |
title |
String |
Title of the task. |
icon |
String |
The icon used in the web interface. |
args |
Array<Object> |
An array of probe arguments. See description of each field in Probe Arguments section. |
excludeForClasses |
Array<String> |
An array of class IDs. This probe isn’t shown for objects of these classes. |
Probe Arguments
Field | Type | Description |
---|---|---|
id |
String |
Argument passed to the script. |
name |
String |
Name of the argument. |
description |
String |
Description of the argument. |
required |
Boolean |
Is this a required field. |
type |
String |
Type of the argument. Possible values are |
options |
Array<Object> |
An array of dropdown options. Only available for |
options.value |
String |
Option value. |
options.description |
String |
Option description. |
Example
Request
-
Bash
-
JavaScript
-
NodeJS
-
Python
login=<...>
password=<...>
saymon_hostname=<...>
url=https://$saymon_hostname/node/api/monitoring-custom-tasks
curl -X GET $url -u $login:$password
let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/monitoring-custom-tasks";
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 path = "/node/api/monitoring-custom-tasks/";
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 = <...>
url = "https://" + saymon_hostname + "/node/api/monitoring-custom-tasks"
response = requests.request("GET", url, auth=(login, password))
print(response.text)
Response
[
{
"title": "Custom probe example",
"icon": "fa fa-folder fa-fw",
"excludeForClasses": [
1,
2
],
"args": [
{
"name": "Unnamed (positional) argument"
},
{
"name": "Named argument",
"id": "--name"
},
{
"name": "Argument with description",
"description": "Argument description",
"id": "--description"
},
{
"name": "Argument with default value",
"description": "Argument description",
"id": "--defval",
"default": "default_value"
},
{
"name": "Required argument",
"description": "This field is required to fill in",
"id": "--required",
"required": true
},
{
"name": "Type - Text",
"description": "This and all above fields have got text type",
"id": "--text",
"type": "text"
},
{
"name": "Type - Text Area",
"description": "This field is text area. \nIt is resizable in most browsers. \nAnd allows to enter multiline texts.",
"id": "--textarea",
"type": "textarea"
},
{
"name": "Type - Checkbox",
"description": "This is the checkbox type",
"id": "--checkbox",
"type": "checkbox"
},
{
"name": "Type - Password",
"description": "This is the password field",
"id": "--pass",
"default": "qwerty",
"type": "password"
},
{
"name": "Type - Select",
"description": "This is the select type. This description is not displayed in the web interface. Use description for each option instead.",
"id": "--select",
"default": "option2",
"type": "select",
"options": [
{
"description": "== Not selected =="
},
{
"value": "option1",
"description": "OK"
},
{
"description": "== Divider =="
},
{
"value": "option2",
"description": "Warning"
},
{
"value": "description"
}
]
}
]
}
{
"title": "Check SSH",
"icon": "fa fa-folder fa-fw",
"args": [
{
"name": "Host IP-address or DNS name"
},
{
"name": "Port",
"id": "-p"
}
],
"id": "Extras/check_ssh.sh"
},
...
]