Using Prometheus to monitor the indexes of Linux system

Time:2020-1-19

First, install a detector node Explorer on the Linux system, download the address https://prometheus.io/docs/gu

The detector will regularly expose all hardware indexes and kernel parameters of Linux system to the outside through 9100 port and URL metrics.

Using Prometheus to monitor the indexes of Linux system

Start the node explorer, and it will display listening on the 9100 port:

Using Prometheus to monitor the indexes of Linux system

Enter hostname: 9100 / metrics in the browser to access the parameters collected by node Explorer:

Using Prometheus to monitor the indexes of Linux system

Some examples:

CPU usage time in different working modes: node CPU seconds total

Using Prometheus to monitor the indexes of Linux system

Number of bytes available for file system: node > filesystem > available > bytes

Using Prometheus to monitor the indexes of Linux system

The number of bytes received by the network card: node ﹣ network ﹣ receive ﹣ bytes ﹣ total

Using Prometheus to monitor the indexes of Linux system

Next, Prometheus is used to collect and display the data exposed through node explorer.

Define a job in the prometheus.yml file of the Prometheus installation directory, pointing to the node Explorer running on the Linux system:

Using Prometheus to monitor the indexes of Linux system

Start Prometheus locally and open the following URL:
http://localhost:9090/
Enter node ﹣ CPU ﹣ seconds ﹣ total {mode = “system”} to query the time consumed by all CPUs working in system state on the server:

Using Prometheus to monitor the indexes of Linux system

You can also specify a time window to query only the CPU running data in the past 1 minute:
rate(node_cpu_seconds_total{mode=”system”}[1m])

Using Prometheus to monitor the indexes of Linux system

To get more original articles of Jerry, please pay attention to the public number “Wang Zixi”:
Using Prometheus to monitor the indexes of Linux system