Skip to content

Get Link's Metrics History

Retrieves link's metric history.

Request

HTTP Request

GET /node/api/links/:id/history

Permissions

linkPermissions

Path parameters

Parameter Type Description
id String
required
The ID of a link whose metrics history should be retrieved.

Query parameters

Parameter Type Description
downsample String
optional
A down-sampling parameter. For example, 1m-avg or 1h-avg denote
"one minute average" and "one hour average" accordingly.
from String
required
A lower-bound timestamp of metrics' values.
metrics String
required
A comma-separated list of metrics to be retrieved.
timezone String
optional
A timezone of metrics' values. For example, Europe/Moscow.
Use this parameter if a server's timezone doesn't match your
local one and you need to get metrics without time shift.
to String
optional
An upper-bound timestamp of metrics' values.

Request body

The request body is empty.

Response

Work in Progress

This topic is a work in progress and may be incomplete.

Examples

Request examples

login=<...>
password=<...>
saymon_hostname=<...>
link_id=<...>
url=https://$saymon_hostname/node/api/links/$link_id/history

curl -X GET $url -u $login:$password -G \
    --data-urlencode "metrics=packetsTransmitted" \
    --data-urlencode "from=1580906276000"
let login = <...>
let password = <...>
let saymonHostname = <...>
let linkId = <...>

let queryParams = "metrics=packetsTransmitted" +
    "&" + "from=1580906276000";

let path = "/node/api/links/" + linkId + "/history" + "?" + queryParams;
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");
const querystring = require("querystring");

let login = <...>
let password = <...>
let saymonHostname = <...>
let linkId = <...>

let queryParams = querystring.stringify({
    metrics : "packetsTransmitted",
    from : "1580906276000"
});

let path = "/node/api/links/" + linkId + "/history" + "?" + queryParams;
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 = <...>
link_id = <...>
url = "https://" + saymon_hostname + "/node/api/links/" + \
    link_id + "/history"

params = {
    "metrics": "packetsTransmitted",
    "from": "1580906276000"
}

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

Response example

[
    {
        "metric": "packetsTransmitted",
        "tags": {
            "entity": "link5e7df795f988c426bb37215e"
        },
        "aggregateTags": [],
        "dps": [
            [
                1585314019413,
                4
            ],
            ...
        ]
    }
]