Show / Hide Table of Contents

Monitoring

Retrieve Prometheus metrics

Example Request:

curl "https://controller-host:8001/metrics" \
	-X GET \
	-u u_jsmith@example.com_u0VmztKJrwqf:

Example Response:

mte_users{status="active"} 2
mte_http_requests_by_type{method="GET",status_code="200"} 90
mte_http_requests_by_type{method="POST",status_code="200"} 1

Retrieve monitoring results of Prometheus metric values in Prometheus text exposition format.

This endpoint is restricted to the following roles: admin, observer, super admin

HTTP Request

GET /metrics

Request Body

Add "Accept: application/json" to the HTTP header in order to return the metrics in JSON format.

Returns

A list of metrics in the Prometheus text format

# HELP <metric name> <help text>
# TYPE <metric name> <type>
<metric name>{<label name>=<label value>, ...}

Retrieve metrics

Example Request:

curl "https://controller-host:8001/api/v2/metrics" \
	-X GET \
	-u u_jsmith@example.com_u0VmztKJrwqf:

Example Response:

[
    {
        "name": "mte_users",
        "help": "Number of users.",
        "type": "GAUGE",
        "metrics": [
            {
                "labels": {
                    "status": "active"
                },
                "value": "2"
            }
        ]
    },
    {
        "name": "mte_http_requests_by_type",
        "help": "HTTP requests received by the API server, by type.",
        "type": "COUNTER",
        "metrics": [
            {
                "labels": {
                    "method": "GET",
                    "status_code": "200"
                },
                "value": "90"
            },
            {
                "labels": {
                    "method": "POST",
                    "status_code": "200"
                },
                "value": "1"
            }
        ]
    }
]

Retrieve monitoring results of Prometheus metric values.

This endpoint is restricted to the following roles: admin, observer, super admin

HTTP Request

GET /api/v2/metrics

Returns

Returns a list of metric values as an array of PrometheusMetricFamily objects

Name Type Description
array of objects List of PrometheusMetricFamily objects (expanded below)
→ name string Name of the metric being monitored
→ help string Description of the metric
→ type string One of the four PrometheusMetricTypes (listed below)
→ metrics array of objects List of PrometheusMetric objects, depending on the PrometheusMetricType

Prometheus Metric Types

Type Description
Counter A single numerical value that only ever goes up.
Gauge A single numerical value that can arbitrarily go up and down.
Histogram Keeps counts of individual observations from an event or sample stream in configurable buckets and also provides a sum of observations and an observation count.
Summary Tracks individual observations from an event or sample stream and summarizes them in a manner similar to traditional summary statistics: 1. sum of observations, 2. observation count, 3. rank estimations.

Prometheus Counter Metrics

Name Type Description
labels object Custom label object providing more information on the metric value
value string A single numerical value that only ever goes up

Prometheus Gauge Metrics

Name Type Description
labels object Custom label object providing more information on the metric value
value string A single numerical value that can arbitrarily go up and down

Prometheus Histogram Metric

Name Type Description
labels object Custom label object providing more information on the metric value
buckets object Cumulative counters for the observation buckets, determined by an upper inclusive bound
count string The count of all events that have been observed
sum string The sum of all observed values

Prometheus Summary Metric

Name Type Description
labels object Custom label object providing more information on the metric value
quantiles object Streaming φ-quantiles (0 ≤ φ ≤ 1) of observed events
count string The count of all events that have been observed
sum string The sum of all observed values

Retrieve metrics history

Example Request:

curl "https://controller-host:8001/api/v2/metrics/history" \
	-X GET \
	-u u_jsmith@example.com_u0VmztKJrwqf:

Example Response:

[
    {
        "metricFamilies": [
            {
                "name": "mte_users",
                "help": "Number of users.",
                "type": "GAUGE",
                "metrics": [
                    {
                        "labels": {
                            "status": "active"
                        },
                        "value": "2"
                    }
                ]
            },
            {
                "name": "mte_http_requests_by_type",
                "help": "HTTP requests received by the API server, by type.",
                "type": "COUNTER",
                "metrics": [
                    {
                        "labels": {
                            "method": "GET",
                            "status_code": "200"
                        },
                        "value": "90"
                    },
                    {
                        "labels": {
                            "method": "POST",
                            "status_code": "200"
                        },
                        "value": "1"
                    }
                ]
            }
        ],
        "timestamp": "2021-05-19 21:47:16.516497363Z"
    },
    {
        "metricFamilies": [
            {
                "name": "mte_users",
                "help": "Number of users.",
                "type": "GAUGE",
                "metrics": [
                    {
                        "labels": {
                            "status": "active"
                        },
                        "value": "2"
                    }
                ]
            },
            {
                "name": "mte_http_requests_by_type",
                "help": "HTTP requests received by the API server, by type.",
                "type": "COUNTER",
                "metrics": [
                    {
                        "labels": {
                            "method": "GET",
                            "status_code": "200"
                        },
                        "value": "90"
                    },
                    {
                        "labels": {
                            "method": "POST",
                            "status_code": "200"
                        },
                        "value": "1"
                    }
                ]
            }
        ],
        "timestamp": "2021-05-19 21:47:21.517820251Z"
    }
]

Retrieve a history of monitoring results of Prometheus metric values.

This endpoint is restricted to the following roles: admin, observer, super admin

HTTP Request

GET /api/v2/metrics/history

Returns

Returns a list of metric values as an array of PrometheusMetricFamilies objects

Name Type Description
array of objects List of PrometheusMetricFamilies objects (expanded below)
→ metricFamilies array of objects List of PrometheusMetricFamily objects
→ timestamp string Timestamp (in UTC) of when these metrics were observed (see timestamps for formatting)
In This Page
Back to top