Get Link's Metrics History

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

Retrieves link's metric history.
Permissions: linkPermissions.

Request parameters

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.

Response description

...

Examples

Request examples

Bash
JavaScript
NodeJS
Python
1
login=<...>
2
password=<...>
3
saymon_hostname=<...>
4
link_id=<...>
5
url=https://$saymon_hostname/node/api/links/$link_id/history
6
7
curl -X GET $url -u $login:$password -G \
8
--data-urlencode "metrics=packetsTransmitted" \
9
--data-urlencode "from=1580906276000"
Copied!
1
let login = <...>
2
let password = <...>
3
let saymonHostname = <...>
4
let linkId = <...>
5
6
let queryParams = "metrics=packetsTransmitted" +
7
"&" + "from=1580906276000";
8
9
let path = "/node/api/links/" + linkId + "/history" + "?" + queryParams;
10
let auth = "Basic " + btoa(login + ":" + password);
11
12
let headers = new Headers();
13
headers.append("Authorization", auth);
14
15
let requestOptions = {
16
method: "GET",
17
headers: headers
18
};
19
20
fetch(saymonHostname + path, requestOptions)
21
.then(response => response.text())
22
.then(result => console.log(result))
23
.catch(error => console.log("error", error));
Copied!
1
const http = require("http");
2
const querystring = require("querystring");
3
4
let login = <...>
5
let password = <...>
6
let saymonHostname = <...>
7
let linkId = <...>
8
9
let queryParams = querystring.stringify({
10
metrics : "packetsTransmitted",
11
from : "1580906276000"
12
});
13
14
let path = "/node/api/links/" + linkId + "/history" + "?" + queryParams;
15
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
16
17
let options = {
18
"method": "GET",
19
"hostname": saymonHostname,
20
"headers": {
21
"Authorization": auth
22
},
23
"path": path
24
};
25
26
let req = http.request(options, function (res) {
27
let chunks = [];
28
29
res.on("data", function (chunk) {
30
chunks.push(chunk);
31
});
32
33
res.on("end", function (chunk) {
34
let body = Buffer.concat(chunks);
35
console.log(body.toString());
36
});
37
38
res.on("error", function (error) {
39
console.error(error);
40
});
41
});
42
43
req.end();
Copied!
1
import requests
2
3
login = <...>
4
password = <...>
5
saymon_hostname = <...>
6
link_id = <...>
7
url = "https://" + saymon_hostname + "/node/api/links/" + \
8
link_id + "/history"
9
10
params = {
11
"metrics": "packetsTransmitted",
12
"from": "1580906276000"
13
}
14
15
response = requests.request("GET", url, auth=(login, password), params=params)
16
print(response.text)
Copied!

Response example

1
[
2
{
3
"metric": "packetsTransmitted",
4
"tags": {
5
"entity": "link5e7df795f988c426bb37215e"
6
},
7
"aggregateTags": [],
8
"dps": [
9
[
10
1585314019413,
11
4
12
],
13
...
14
]
15
}
16
]
Copied!
Last modified 11mo ago