Monitoring

E2E Networks nodes and load-balancers are monitored using different metrics to ascertain server health in real-time. It will help you track the operational health of your infrastructure. Monitoring information is graphically represented on the MyAccount portal. Additionally, you can use monitoring API to get monitoring data of your nodes and load balancers like disk space, memory usage, processor load, disk read/write operations, and network traffic statistics.

RealTime Memory & Storage Monitoring API

To get monitoring information regarding any node, send a GET request to the endpoint https://api.e2enetworks.com/myaccount/api/v1/nodes/<$NODE_ID>/monitor/server- health-info/?apikey={{api_key}}

CURL

curl --request GET
'https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/monitor/server-health-
info/' \
--header 'Authorization: Bearer
eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSld........' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{api_key}}'

PHP_CURL

<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL =>
"https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/monitor/server-health
-info/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer
eyJhbGciOiJSUzI1NiIsInR5cCIgOiA........",
"Content-Type: application/json",
"x-api-key: {{api_key}}",
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

PHP_HTTP_REQUEST_2

<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/moni
tor/server-health-info/');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Authorization' => 'Bearer
eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJj........',
'Content-Type' => 'application/json',
'x-api-key' => '{{api_key}}',
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}

PHP_PECL_HTTP

<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>
/monitor/server-health-info/');
$request->setRequestMethod('GET');
$request->setOptions(array());
$request->setHeaders(array(
'Authorization' => 'Bearer
eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJ.......',
'Content-Type' => 'application/json',
'x-api-key' => '{{api_key}}',
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();

NodeJS_Native

var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'GET',
'hostname': 'https://api.e2enetworks.com',
'path': '/myaccount/api/v1/nodes/<<node_id>>/monitor/server-health-info/',
'headers': {
'Authorization': 'Bearer
eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2......',
'Content-Type': 'application/json',
'x-api-key': '{{api_key}}',
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
req.end();

NodeJS Request

var request = require('request');
var options = {
'method': 'GET','url':
'https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/monitor/server-health-
info/',
'headers': {
'Authorization': 'Bearer
eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6.........',
'Content-Type': 'application/json',
'x-api-key': '{{api_key}}',
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

NodeJS Unirest

var unirest = require('unirest');
var req = unirest('GET',
'https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/monitor/server-health-
info/')
.headers({'Authorization': 'Bearer
eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkI.......',
'Content-Type': 'application/json',
'x-api-key': '{{api_key}}',
})
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});

Response Body

{"code":200,"data":{"host_uptime":"8 months 21 days","memory":{"labels":["Free
Memory (GB)","Used Memory
(GB)"],"results":["1.02","11.29"]},"disk":{"labels":["Free Disk Space (GB)","Used Disk
Space (GB)"],"results":["5.87","9.75"]}},"errors":"{}","message":"Success"}