Monitoring OMRS
Setting up system monitoring for openmrs
What is System Monitoring?
System monitoring involves tracking and analyzing various aspects of a computer system's performance and health to ensure it operates efficiently and securely. This includes:Resource Utilization,Performance Metrics,Health Checks,Logs and Alerts,Security Monitoring.
OpenMRS System monitoring using Prometheus and grafana
Prerequisites
Docker
Docker swarm
Grafana for visualization
Prometheus for collecting and storing metric data
Note:All the above should be installed on the monitoring server
An exporter for exposing metrics.This should be installed on a server having openmrs.
Setup Instructions
Prepare a monitoring server,this should be separate from the server running openmrs.
Setup grafana and Prometheus on your monitoring server.Grafana is used for visualization and prometheus is used for collecting and storing metrics.
For a quick installation of grafana and prometheus,you can clone https://github.com/I-TECH-UW/digi-monitoring to your monitoring server that already has the grafana and prometheus setup.
Startup the services by running mk.sh on your terminal
This starts,the reverse proxy,prometheus and grafana
Reverse proxy
Acts as an intermediary between clients and backend servers, a reverse proxy can hide the internal network structure from the outside world.
Prometheus
For storing time-series data.
Grafana
Creates dashboards and visualizations for various types of data sources, including time-series data.
Monitor the Target Server ie the server that is running openmrs.
To monitor that target server,make sure you have an exporter installed on the target server .
These exporters collect particular metrics from the target systems and deliver them in a Prometheus-readable way.
Examples of exporters: i) Node exporter which enables you to measure various machine resources such as memory, disk and CPU utilization,
ii) cAdvisor for container-based metrics.
For our guide,we shall concentrate on node exporter so as to capture some metrics around the memory,disk and cpu utilization for the server running openmrs.
Install node exporter on the openmrs server,instructions can be found here ie using docker https://last9.hashnode.dev/how-to-download-and-run-node-exporter-using-docker
Or for a linux machine that is not running docker https://docs.techdox.nz/node-exporter/
Expose the url for the node exporter as seen in the node exporter setup instructions
Configure the node exporter with prometheus
Configure the url of the node exporter exposed in the above step within your prometheus.yml file under the repository you cloned on step c.
For example as seen here: https://github.com/I-TECH-UW/digi-monitoring/blob/63ce1c38afc43cc2d582a119cf75968697af8c0d/monitoring/prometheus/prometheus.yml#L27
f) Restart the prometheus service using docker restart <serviceName>
Visualize and Analyze Metrics
Access your grafana instance and create the monitoring dashboard
From this point you can see the metrics from your dashboard for the openmrs server you are monitoring
Expected Behavior After Installation
You should be able to access the grafana ui after installation
You should be able to view metrics of the target instance on your dashboard after signing in to grafana