Monitoring Mobile Center with Prometheus and Grafana
Mobile Center have build-in integration with Prometheus for monitoring purposes.
The following guide will help you to configure Prometheus to scrape metrics that MC is exposing.
Mobile Connectors can report metrics to the MC Server and Prometheus can be configured to scrape those metrics.
- Enable Mobile Connectors to report metrics to Prometheus: edit configuraiton file metrics-config.properties (located at /connector/conf folder) and modify the following line:
METRICS_PROMETHEUS_ENABLE=true. Restart the connector service.
- Enable Mobile Center Server to expose metrics to Prometheus: edit setEnv.sh configuration file for linux user (located at /home/<user> directory):
export METRICS_PROMETHEUS_ENABLE=true. Restart the MC service.
- Install Prometheus - there are plenty of guidelines how to do it. See example https://www.enigma14.eu/martin/blog/2017/09/20/prometheus-installation-on-centos-7. It is possible to install Prometheus on the same machine as Mobile Center
- Modify Prometheus configuration file (prometheus.yml) to scrape metrics from MC. Add the follwing section:
- job_name: 'mc_console'
- targets: ['<MC SERVER HOST>:<MC SERVER PORT>']
- Restart Prometheus
- Verify that scrape working: navigate to http://<PROMETHEUS HOST>:9090 and verify metric of "scrape_samples_scraped" - you should receive the data about job mc_console
- Install Grafana as visualization layer and configure it to work with Prometheus (see https://logz.io/blog/prometheus-monitoring/)
Few screenshots are attached for your convinience.
The following metrics are available (example):
- mc_connector: device connectivity gauge (1 - connected, 0 - disconnected)
- mc_connector: device wifi connectivity gauge
- mc_connector: vnc_enabled (actively open remote view on the device)
- mc_console: login_succeded (login to the tool)
- mc_console: reservation_succeded (create reservation for the device)
Please free to share your ideas about what metrics should be exposed there!
Also, there is additional metrics reporting mechanizm using CSV files and statsD daemon (but I'll keep it for a different post).