Monitoring with Prometheus

Photo by Christian Paul Stobbe on Unsplash

Within DevOps, businesses need to develop robust monitoring solutions that can provide greater insight into their servers’ health and efficiency. Enter Prometheus.

Prometheus is an open-source monitoring and alerting toolkit which is entirely community-driven. Its core functionality includes scraping, rule processing, and alerting based on time series data.

It gathers and stores this data by scrapping HTTP endpoints on targets via instrumented jobs directly or through an intermediate push gateway. The targets post parseable data on the key-attribute machine. Each scrape is stored as a frame to allow you to query the database to execute graphs and other functions.

This blog runs through the initial steps needed for Prometheus to work.


The first task is to collect the data we want to track and report. We need to ensure that the server has a Prometheus-attainable URL. This is done with pluggable components called exporters, which are agents that obtain metrics from the systems being tracked and provide Prometheus with endpoints for surveying the metrics. One of the most useful exporters is node-exporter, which collects Linux device stats such as CPU, memory, and disk use.

It can be downloaded as a static binary that can be installed from Prometheus downloads page. After you open the node_exporter inside, a broad range of device metrics will be exposed. To see these metrics, visit http://localhost:9100/metrics.


Now we need to make sense of the collected data, which can be done with the Prometheus server. The first step is to install Prometheus and download the latest release.

Prometheus then needs to be correctly configured to access Node Exporter metrics. The file called prometheus.yml contains the configuration that tells Prometheus how and which exporters to scrape.

The file should look like this:

scrape_interval: 15s

- job_name: node
- targets: ['localhost:9100']

Then you can run the following command from within the Prometheus directory

./prometheus --config.file=./prometheus.yml

You can then use Prompheus by visiting: http://localhost:9090/graph



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store