Skip to content

WCS integration to Prometheus

Prometheus is the open source monitoring system and time series database. WCS supports Prometheus metric format since build 5.2.416, no WCS setup is needed to integrate with Prometheus monitoring.

WCS metrics collection

To set up Prometheus to collect WCS metrics, the following scrape configuration should be described in prometheus.yml

scrape_configs:
  - job_name: 'flashphoner'
    metrics_path: '/'
    params:
      action: [stat]
      format: [prometheus]
    static_configs:
      - targets: ['WCS_address:8081']

Where

  • WCS_address - WCS server address
  • 8081 - WCS server port to request metrics

As a result, Prometheus should form the following query

http://WCS_address:8081/?action=stat&format=prometheus

and receive WCS statistics metrics in its format.

Since build 5.2.518, metrics of published streams can be requested by the following query

http://WCS_address:8081/?action=stat&format=prometheus&groups=publish_streams

Server instance metrics collection

Server instance where WCS is installed operating system metrics may be collected to Prometheus using Prometheus Node Exporter module. Use the following script to install the module

#!/bin/bash
wget https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz
tar zxvf node_exporter-*.linux-amd64.tar.gz
cd node_exporter-*.linux-amd64
sudo cp node_exporter /usr/local/bin/
sudo useradd --no-create-home --shell /bin/false nodeusr
sudo chown -R nodeusr:nodeusr /usr/local/bin/node_exporter

sudo cat > /etc/systemd/system/node_exporter.service << EOF
[Unit]
Description=Node Exporter Service
Wants=network-online.target
After=network.target

[Service]
User=nodeusr
Group=nodeusr
Type=simple
ExecStart=/usr/local/bin/node_exporter
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable node_exporter
sudo systemctl start node_exporter