Prometheus for monitoring and alerting

I have talked about how to use tools provided by Azure and AWS for monitoring the health of your applications and servers. But there will be times when you need something opensource to keep you independent of the underlying cloud service provider. Prometheus is one such tool that will help in these cases.

Prometheus is an open-source monitoring and alerting tool. It helps gather metrics in time series data format from various sources and monitor that. Written in Go language, the tool can be combined with Grafana or other consumers to capture and visualize data.

Prometheus architecture
image source https://prometheus.io/docs/introduction/overview/

Image above shows the architecture for Prometheus. Following are the core components

Prometheus Server: The server collects metrics from applications and stores them locally. Data is collected at regular intervals and stored for processing.

PushGateway: There are cases when an endpoint cannot be exposed by the application due to the nature of its work, such as static jobs. The Push gateway captures the data, transforms that data into the Prometheus data format, and then pushes that data onto the Prometheus server.

Alert Manager: Based on collected data, rules can be configured to send alerts in the form of SMS, Email, etc.

Client Libraries: A set of client libraries is provided which can be added to application code for enabling monitoring endpoints.

References: https://prometheus.io/docs/introduction/overview/
https://www.amazon.com/gp/product/B0761Z1W9S