Endurance

Prometheus

The Prometheus endpoint the appliance exposes its metrics on.

Prometheus

GET /prometheus

Get the Prometheus settings

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

$url = 'https://appliance.example.com/api/v1/prometheus';
$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/prometheus", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/prometheus', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Response
{
  "status": "success",
  "message": "Prometheus settings",
  "data": {
    "serviceIPId": "111-111-111-111",
    "nodeEnabled": true,
    "nodePort": 9101,
    "layer7Enabled": true,
    "layer7Port": 9101
  }
}

PUT /prometheus

Set Prometheus setting

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

Body parameters
serviceIPId string Required
nodeEnabled boolean Required
nodePort integer Required
layer7Enabled boolean Required
layer7Port integer Required
curl
curl -X PUT "https://appliance.example.com/api/v1/prometheus" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "serviceIPId": "<serviceIPId>",
  "nodeEnabled": true,
  "nodePort": 0,
  "layer7Enabled": true,
  "layer7Port": 0
}'
PHP
<?php

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

$payload = [
    'serviceIPId' => '<serviceIPId>',
    'nodeEnabled' => true,
    'nodePort' => 0,
    'layer7Enabled' => true,
    'layer7Port' => 0,
];

$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 = {
    "serviceIPId": "<serviceIPId>",
    "nodeEnabled": true,
    "nodePort": 0,
    "layer7Enabled": true,
    "layer7Port": 0
}

response = requests.put("https://appliance.example.com/api/v1/prometheus", headers=headers, json=payload)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/prometheus', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${token}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "serviceIPId": "<serviceIPId>",
  "nodeEnabled": true,
  "nodePort": 0,
  "layer7Enabled": true,
  "layer7Port": 0
}),
});

const data = await response.json();
Response
{
  "status": "success",
  "message": "Set Prometheus setting"
}