Skip to content

Latest commit

 

History

History
97 lines (64 loc) · 3.2 KB

tutorial.md

File metadata and controls

97 lines (64 loc) · 3.2 KB

Tutorials

Prometheus Server

To start the sample application, it does require Prometheus server running to collect the statistics from SRT Prometheus Exporter. There are several ways to install and run Prometheus server, it is up to user to set this up.

  • Run Docker image

    docker pull prom/prometheus
  • Install Debian package

  • Snap pacakge

    sudo snap install prometheus

    Default configuration file would be found at /var/snap/prometheus/<numbers>/prometheus.yml. please, edit the configuration file, so that Prometheus can find the correct url to scrape. If we want to change the command line option for Prometheus, /var/snap/prometheus/<numbers>/daemon_arguments needs to be modified accordingly, and then restart the prometheus snap package.

Sample

sample_overview

Build

sample_srtcaller and sample_srtlistener can be compiled.

cd srt-prometheus-exporter/sample
make

Run

Make sure that current directory is srt-prometheus-exporter/sample because those samples will read the configuration file for SRT Prometheus Exporter with relative path ../config/srt_exporter.yaml.

cd srt-prometheus-exporter/sample
./sample_srtcaller

A sample of SRT source application.

It creates SRT socket and updates SRT socket information to SRT Exporter library. Its SRT Exporter object's name is sample_srt_caller. It tries to connect port 8888 with this SRT socket. Once connection is accepted, this application keeps sending packages to the destination each second.

Access http://127.0.0.1:10027/metrics from a browser to trigger an http request to it manually.

sample_srt_caller

cd srt-prometheus-exporter/sample
./sample_srtlistener

A sample of SRT destination application.

It starts listening to port on 8888 when application started. Once an SRT source wants to connect this port, it accepts the connection and starts receiving packages from this connection. The SRT socket of this connection would be updated to SRT exporter once the connection is established. Thus, SRT socket statistic requested from Prometheus can be collected from SRT library. Its SRT Exporter object's name is sample_srt_listener.

Access http://127.0.0.1:10028/metrics from a browser to trigger an http request to it manually.

sample_srt_listener

Start Prometheus

  • Docker (Recommended)
cd srt-prometheus-exporter
cp -rf ./config/prometheus.yml /tmp/prometheus.yml
docker run -d \
-v /tmp/prometheus.yml:/etc/prometheus/prometheus.yml \
--network=host prom/prometheus \
--web.enable-lifecycle \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/prometheus \
--web.console.libraries=/usr/share/prometheus/console_libraries \
--web.console.templates=/usr/share/prometheus/consoles

You should be able to see, Prometheus dashboard

prometheus_1

and, statistics.

prometheus_2