Endurance

System statistics

Updated

Get the system statistics

Get the Settings for the System Stats

GET /system-stats

Query parameters
period Required hour | day | week | month | year

return the last period of data

type Required cpu | memory | disks | interfaces | connTrack

comma seperated string

curl
curl -X GET "https://appliance.example.com/api/v1/system-stats" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/system-stats';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.get("https://appliance.example.com/api/v1/system-stats", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/system-stats', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Bruno
meta {
  name: Get the system statistics
  type: http
  seq: 1
}

get {
  url: https://{{node-0}}:{{port}}/api/v1/system-stats
  body: none
  auth: bearer
}

auth:bearer {
  token: {{token}}
}
Response
{
  "status": "success",
  "message": "System stats settings",
  "data": []
}

Settings

Get the Settings for the System Stats

GET /system-stats/settings

curl
curl -X GET "https://appliance.example.com/api/v1/system-stats/settings" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/system-stats/settings';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.get("https://appliance.example.com/api/v1/system-stats/settings", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/system-stats/settings', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Bruno
meta {
  name: Get the system statistics settings
  type: http
  seq: 1
}

get {
  url: https://{{node-0}}:{{port}}/api/v1/system-stats/settings
  body: none
  auth: bearer
}

auth:bearer {
  token: {{token}}
}
Response
{
  "status": "success",
  "message": "System Stats Settings",
  "data": []
}

Set System Stats Settings

PUT /system-stats/settings

This change is staged. Send PUT /services/apply to apply it.

Body parameters
enabled boolean Required
interval string Required

How often collectd queries its read plugins. A whole number of seconds, or a single time carrying a unit (s, m or h) such as 5m, from 1 second to 1 hour. The value is echoed back exactly as it was sent.

timeout integer Required

How many read cycles may pass with no update before a value counts as missing. A count of intervals, not a duration, so with an interval of 10 seconds a timeout of 2 means twenty seconds. At least 2, below which collectd will not start.

threads integer Required

How many threads collectd reads its plugins with. At least 1.

logging boolean Required
layer7 boolean Required
interfaces boolean Required
memory boolean Required
load boolean Required
disk boolean Required
curl
curl -X PUT "https://appliance.example.com/api/v1/system-stats/settings" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "enabled": true,
  "interval": "<interval>",
  "timeout": 0,
  "threads": 0,
  "logging": true,
  "layer7": true,
  "interfaces": true,
  "memory": true,
  "load": true,
  "disk": true
}'
PHP
<?php

$url = 'https://appliance.example.com/api/v1/system-stats/settings';
$headers = [
    'Authorization: Bearer ' . $token,
    'Content-Type: application/json',
];

$payload = [
    'enabled' => true,
    'interval' => '<interval>',
    'timeout' => 0,
    'threads' => 0,
    'logging' => true,
    'layer7' => true,
    'interfaces' => true,
    'memory' => true,
    'load' => true,
    'disk' => true,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS => json_encode($payload),
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}
payload = {
    "enabled": true,
    "interval": "<interval>",
    "timeout": 0,
    "threads": 0,
    "logging": true,
    "layer7": true,
    "interfaces": true,
    "memory": true,
    "load": true,
    "disk": true
}

response = requests.put("https://appliance.example.com/api/v1/system-stats/settings", headers=headers, json=payload)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/system-stats/settings', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${token}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "enabled": true,
  "interval": "<interval>",
  "timeout": 0,
  "threads": 0,
  "logging": true,
  "layer7": true,
  "interfaces": true,
  "memory": true,
  "load": true,
  "disk": true
}),
});

const data = await response.json();
Bruno
meta {
  name: Update the system statistics settings
  type: http
  seq: 1
}

put {
  url: https://{{node-0}}:{{port}}/api/v1/system-stats/settings
  body: json
  auth: bearer
}

headers {
  Content-Type: application/json
}

auth:bearer {
  token: {{token}}
}

body:json {
  {
    "enabled": true,
    "interval": "<interval>",
    "timeout": 0,
    "threads": 0,
    "logging": true,
    "layer7": true,
    "interfaces": true,
    "memory": true,
    "load": true,
    "disk": true
  }
}
Response
{
  "status": "success",
  "message": "Successfully set System Stats Settings"
}