Get Link's Stat Metadata
Returns link's stat metadata.
Request
HTTP Request
Permissions
Path parameters
Parameter | Type | Description |
---|---|---|
id | Stringrequired |
The ID of a link whose metadata should be retrieved. |
Request body
The request body is empty.
Response
Returns metadata that contains headers with the information about the entity and the agent, and payload with metadata for each of the link's stat.
The returned metadata depends on who updated the stat metadata last — the agent or the user with the Set Link's Stat Metadata request. If you set link's metadata with the Set Link's Stat Metadata request, the metadata would lack agent-related fields in the header and the payload would contain only those stats whose metadata was set in that request. If the agents updates the stats later, the metadata would show all fields related to the agent and all stats again.
Headers
The metadata headers contain the following fields:
Parameter | Type | Description |
---|---|---|
entityId | String | The ID of a link whose metadata was retrieved. |
entityType | String | The type of an entity whose metadata was retrieved. For a link, this value is link . |
taskType | String | The probe type. See the Monitoring and checks settings - probes section on the SAYMON wiki for more information. Agent only |
period | Integer | The period between executing the monitoring processes (in milliseconds). Agent only |
timestamp | Integer | Timestamp of when the agent started performing the selected monitoring process. Agent only |
agentId | String | The ID of the agent. Agent only |
agentVersion | String | The version of the agent. Agent only |
agentBuild | String | The build number of the agent. Agent only |
Payload
A metadata for a stat field may contain the following information:
type
— stat's data type. Possible values:STRING
BOOLEAN
BYTE_QUANTITY
TIMESTAMP
PERCENTILE
ID
BINARY
LIST
changeRate
— frequency of data change. Possible values:ALWAYS
— the data changes after every measurement.SOMETIMES
— the data changes from time to time, consecutive measurements will often show equal results.NEVER
— the data either never changes or change probability is negligible.
Example
Request
let login = <...>
let password = <...>
let saymonHostname = <...>
let linkId = <...>
let path = "/node/api/links/" + linkId + "/stat/meta";
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 linkId = <...>
let path = "/node/api/links/" + linkId + "/stat/meta";
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();
Response
{
"entityId": "62d7e5e456d203149a080038",
"entityType": "link",
"taskType": "ping",
"period": 10000,
"timestamp": 1662975657519,
"agentId": "817",
"agentVersion": "4.4.72-SNAPSHOT",
"agentBuild": "bb7f3",
"payload": {
"roundTripMaximum": {
"changeRate": "ALWAYS"
},
"packetsReceived": {
"changeRate": "SOMETIMES"
},
"packetLossPercentile": {
"type": "PERCENTILE",
"changeRate": "SOMETIMES"
},
...
}
}