How to Install Prometheus for System Monitoring on Ubuntu 18.04

How to Install Prometheus for System Monitoring on Ubuntu 18.04

Prometheus is an open source monitoring and alerting toolkit originally developed by SoundCloud. Prometheus joined the Cloud Native Computing Foundation in 2016. Prometheus has many metrics needed to monitor the system and can be combined with Grafana for visualization.

0.Create User

Create users for Prometheus and node_exporter.

Create a prometheus folder.

Set user and group ownership folder.

1.Download Prometheus

Download and extract Prometheus.

Copy the prometheus and promtool folders.

Set user and group ownership for prometheus and promtool.

Copy the consoles and console_libraries folders.

Set user and group ownership of consoles and console_libraries folders.

2.Configure Prometheus

Creating configuration files for prometheus.

Contents of prometheus.yml. At the target enter the server’s IP address.

Set user and group ownership prometheus.yml

3.Prometheus Service

Create service for prometheus.

Fill in the prometheus.service file.

Activate prometheus service.

4.Download Node Exporter

Download and extract the Node Exporter.

Copy node_exporter. Set node_exporter user and group ownership.

5.Node Exporter Service

Create service for node_exporter.

Fill in the node_exporter.service file.

Activate node_exporter service.

6.Configure Prometheus for Exporter Nodes

Open the prometheus.yml configuration file.

Add jobs for node_exporter.

The final result file prometheus.yml.

Restart prometheus.

7.Adding Node Exporter

Prometheus can access metrics that are on other servers that have Node Exporter installed by adding the IP address in the configuration prometheus.yml. The IP address is installed in the job_name: ‘node_exporter’ – targets section.

8.Access Prometheus

Browse http://SERVER-IP:9100/metrics to see which metrics are queries that can be run.

Metric
Metrics

Browse http:// SERVER-IP:9090/graph to run the query metrics and visualize them in graphical form. Enter Expression, then click the Execute button to run the query metric, and click the Graph tab to display the query results in graphical form.

Prometheus Graph
Prometheus Graph

Example query
Total memory.

Available memory.

Free space on partitions /.

Leave a Reply

Your email address will not be published. Required fields are marked *