Metrics

Query the collected metrics.

The core can collect metrics about itself, the system it is running on, and about the FFmpeg processes it is executing. This is not enabled by default. Please check the metrics configuration for how to enable it and how often metrics should be collected and for how long metrics should be kept available for querying.

Each metric is collected by a collector, like a topic. Each collector can contain several metrics and each metric can have labels to describe a variant of that metric. Think of used space on a filesystem where the variant is whether it is a disk filesystem or a memory filesystem.

All metrics can be scraped by Prometheus from the /metrics endpoint, if enabled.

List collectors

In order to know which metrics are available and to learn what they mean, you can retrieve a list of all metrics, their descriptions and labels.

Example:

curl http://127.0.0.1:8080/api/v3/metrics \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X GET

Description:

List all known metrics with their description and labels

List all known metrics with their description and labels

GET//api/v3/metrics
Authorization
Response

OK

Body
descriptionstring
labelsarray of string
namestring
Request
const response = await fetch('//api/v3/metrics', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
[
  {
    "description": "text",
    "labels": [
      "text"
    ],
    "name": "text"
  }
]

Query metrics

All collected metrics can be queried by sending a query to the /api/v3/metrics endpoint. This query contains the names of the metrics with the labels you are interested in. Leave out the labels in order to get the values for all labels of that metrics. By default you will receive the last collected value. You can also receive a whole timeseries for each metric and label by providing a timerange and stepsize in seconds.

Example:

curl http://127.0.0.1:8080/api/v3/metrics/ \
   -H 'accept: application/json' \
   -H 'Content-Type: application/json' \
   -X POST \
   -d '{
         "metrics": [
            {
               "name": "cpu_idle"
            }, {
               "name": "mem_free"
            }
         ]
      }'

Description:

Query the collected metrics

Query the collected metrics

POST//api/v3/metrics
Authorization
Body

Metrics query

interval_secinteger (int64)
metricsarray of api.MetricsQueryMetric (object)
timerange_secinteger (int64)
Response

OK

Body
interval_secinteger (int64)
metricsarray of api.MetricsResponseMetric (object)
timerange_secinteger (int64)
Request
const response = await fetch('//api/v3/metrics', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({}),
});
const data = await response.json();
Response
{
  "metrics": [
    {
      "name": "text",
      "values": [
        {
          "ts": "text",
          "value": 0
        }
      ]
    }
  ]
}

Available collectors

CPU
[
    {
        "name": "cpu_idle",
        "description": "Percentage of idle CPU",
        "labels": []
    },
    {
        "name": "cpu_ncpu",
        "description": "Number of logical CPUs in the system",
        "labels": []
    },
    {
        "name": "cpu_other",
        "description": "Percentage of CPU used for other subsystems",
        "labels": []
    },
    {
        "name": "cpu_system",
        "description": "Percentage of CPU used for the system",
        "labels": []
    },
    {
        "name": "cpu_user",
        "description": "Percentage of CPU used for the user",
        "labels": []
    }
]
Memory
[
    {
        "name": "mem_free",
        "description": "Free memory in bytes",
        "labels": []
    },
    {
        "name": "mem_total",
        "description": "Total available memory in bytes",
        "labels": []
    }
]
Disk
[
    {
        "name": "disk_total",
        "description": "Total size of the disk in bytes",
        "labels": [
            "path"
        ]
    },
    {
        "name": "disk_usage",
        "description": "Number of used bytes on the disk",
        "labels": [
            "path"
        ]
    }
]
Filesystem
[
    {
        "name": "filesystem_files",
        "description": "Number of files on the filesystem (excluding directories)",
        "labels": [
            "name"
        ]
    },
    {
        "name": "filesystem_limit",
        "description": "Total size of the filesystem in bytes, negative if unlimited",
        "labels": [
            "name"
        ]
    },
    {
        "name": "filesystem_usage",
        "description": "Number of used bytes on the filesystem",
        "labels": [
            "name"
        ]
    }
]jso
Network
[
    {
        "name": "net_rx",
        "description": "Number of received bytes",
        "labels": [
            "interface"
        ]
    },
    {
        "name": "net_tx",
        "description": "Number of transmitted bytes",
        "labels": [
            "interface"
        ]
    }
]
FFmpeg
[{
    "name": "ffmpeg_process",
    "description": "State of the ffmpeg process",
    "labels": [
        "state"
    ]
}]
Restream IO
[
    {
        "name": "restream_io",
        "description": "Current process IO values by name",
        "labels": [
            "processid",
            "type",
            "id",
            "address",
            "index",
            "stream",
            "media",
            "name"
        ]
    },
    {
        "name": "restream_process",
        "description": "Current process values by name",
        "labels": [
            "processid",
            "state",
            "order",
            "name"
        ]
    },
    {
        "name": "restream_process_states",
        "description": "Current process state",
        "labels": [
            "processid",
            "state"
        ]
    },
    {
        "name": "restream_state",
        "description": "Summarized process states",
        "labels": [
            "state"
        ]
    }
]
Sessions
[
    {
        "name": "session_active",
        "description": "Number of current sessions",
        "labels": [
            "collector"
        ]
    },
    {
        "name": "session_limit",
        "description": "Max. number of concurrent sessions",
        "labels": [
            "collector"
        ]
    },
    {
        "name": "session_maxrxbitrate",
        "description": "Max. allowed receiving bitrate in bit per second",
        "labels": [
            "collector"
        ]
    },
    {
        "name": "session_maxtxbitrate",
        "description": "Max. allowed transmitting bitrate in bit per second",
        "labels": [
            "collector"
        ]
    },
    {
        "name": "session_rxbitrate",
        "description": "Current receiving bitrate in bit per second",
        "labels": [
            "collector"
        ]
    },
    {
        "name": "session_rxbytes",
        "description": "Number of received bytes",
        "labels": [
            "collector"
        ]
    },
    {
        "name": "session_total",
        "description": "Total sessions",
        "labels": [
            "collector"
        ]
    },
    {
        "name": "session_txbitrate",
        "description": "Current transmitting bitrate in bit per second",
        "labels": [
            "collector"
        ]
    },
    {
        "name": "session_txbytes",
        "description": "Number of transmitted bytes",
        "labels": [
            "collector"
        ]
    }
]
Uptime
[
    {
        "name": "uptime_uptime",
        "description": "Current uptime in seconds",
        "labels": []
    }
]

Last updated