Skip to main content

Enabling load balancing server monitoring

Enable monitoring for a load balancing server to get access to client metrics. For example, you can see information about the status of a server status and client count. Monitoring is not required for load balancing to work.

By default, every two minutes the backend receives information about the status of the stream servers and the number of clients from Prometheus.

info

Jobs in Prometheus retrieve data from the streaming server and, in turn, cron jobs in Ministra Pro collect data from Prometheus.

To enable load balancing server monitoring

  1. Enable the collection of metrics
    Modify the monitoring_server.ini configuration file, which contains the details of the Prometheus monitoring server.
    Enable the collection of metrics

  2. Configure the Prometheus job
    Add a Prometheus scrape job to your server configuration.
    Configure the Prometheus job

  3. Add the cron jobs to the Ministra Pro backend server
    Add the cron jobs for updating stream status and client count.
    Add the cron jobs

Enable the collection of metrics

  1. Open the monitoring_server.ini configuration file.

  2. Modify the file to match the following example:

    [monitoring_server]

    monitoring_server[url]='https://prometheus.example.com/api/v1/query'

    ; auth type or empty, currently only 'basic' authorization type is supported

    monitoring_server[auth]=basic

    monitoring_server[user]='basic_auth_login'

    monitoring_server[password]='basic_auth_password'

    monitoring_server[timeout] = 30

    monitoring_server[connect_timeout] = 30

    monitoring_server[read_timeout] = 30

    monitoring_server[job_name] = 'job_name'

    monitoring_server[client_count_metric_name] = 'streamer_clients'

    Where:

    • [url] is the API endpoint for the monitoring server.
    • [user] and [password] are your monitoring server credentials.
    • [job_name] is the name of the metrics collection job.
    • [client_count_metric_name] is the name of the metric.
  3. Save and close the configuration file.

info

If the response from the monitoring server contains no data, the status of the streaming server changes to Down.

If there is no response from the monitoring server, or the response contains an error, the status and number of clients for the specified streaming server do not change.

Configure the Prometheus job

  1. Open the Prometheus configuration file.

  2. Modify the file to match the following example:

info

Make sure the values for the instance labels exactly match the streaming server titles as defined in the Ministra Pro administrator panel.

- job_name: 'job_name'
metrics_path: /streamer/api/v3/config
params:
format: ['openmetrics']
basic_auth:
username: '<flussonic_api_login>'
password: '<flussonic_api_password>'
static_configs:
- targets: ['streamer1.example.com']
labels:
instance: 'Streamer1'
- targets: ['streamer2.example.com']
labels:
instance: 'Streamer2'

Add the cron jobs

  • On the Ministra Pro backend server, add the following jobs:

    • Live status

      php /var/www/ministra_middleware/admin/bin/console mtv:stream-server:monitoring:update-state --live-status=1
    • Client count

      php /var/www/ministra_middleware/admin/bin/console mtv:stream-server:monitoring:update-state --clients-count=1