in src/helpers.ts [52:80]
export async function getHostData(request: APIRequestContext) {
const currentTime: number = Date.now();
const startTime: number = currentTime - 86400000;
let b = await request.post('api/metrics/snapshot', {
headers: {
"accept": "application/json",
"Authorization": API_KEY,
"Content-Type": "application/json;charset=UTF-8",
"kbn-xsrf": "true",
"x-elastic-internal-origin": "kibana"
},
data: {
"filterQuery": "",
"metrics": [{ "type": "memory" }],
"nodeType": "host",
"sourceId": "default",
"accountId": "",
"region": "",
"groupBy": [],
"timerange": { "interval": "1m", "to": currentTime, "from": startTime, "lookbackSize": 5 },
"includeTimeseries": true,
"dropPartialBuckets": true
}
});
expect(b.status()).toBe(200);
const jsonDataNode = JSON.parse(await b.text());
return jsonDataNode;
}