This environment is Redhat Linux 6.7, Prometheus 2.2.1, and Node_EXPORTER 1.5.2

introduce

Prometheus is a collection of system monitoring and alarm tools open-source by SoundCloud in 2012, which is also in line with Google’s internal Borgmon thinking, as mentioned in the book “Google SRE”. Use Go language development, suitable for each platform.

The installation

[root@bj1eccap01 ~]# tar - XVZF Prometheus - 2.2.1. Linux - amd64. Tar. Gz
[root@bj1eccap01 ~]# CD Prometheus - 2.2.1. Linux - amd64[root @ bj1eccap01 Prometheus - 2.2.1. Linux - amd64]# ./prometheus --help
usage: prometheus [<flags>]
Copy the code

configuration

The installation package has a default configuration file in YAML format. The default configuration file contains three partitions: global, RULE_Files, and scrape_configs.

Global Controls the global configuration of the Prometheus server. Scrape_interval determines the data fetching interval. Evaluation_interval determines the interval at which data is computed, and Prometheus generates new time series values based on rule_file.

Rule_files Determines the path for saving rule files.

Scrape_config determines the resources monitored by Prometheus. Prometheus also monitors its own health by exposing its own data over HTTP.

Start the

It’s very easy to start

[root @ bj1eccap01 Prometheus - 2.2.1. Linux - amd64]# ./prometheus --config.file=prometheus.yml
Copy the code

After that can browse and view service operation state, open a browser enter http://localhost:9090/graph

Prometheus provides two ways to view metrics the Graph graph directly and metrics the raw monitoring data. You can view it by switching to the Console interface.



Node_exporter installation

Node_exporter collects server monitoring information. The stable version is 1.15.2. Node_exporter monitors on port 9100 by default, and Prometheus obtains information from node_exporter.

[root@bj1eccap01 ~]# tar - XZVF node_exporter - 0.15.2. Linux - amd64. Tar. Gz
[root@bj1eccap01 ~]# CD node_exporter - 0.15.2. Linux - amd64[root @ bj1eccap01 node_exporter - 0.15.2. Linux - amd64]# ./node_exporter
Copy the code

Operations and statistics

Prometheus provides a query language that supports computation and common statistical operations.

Sign of operation

Prometheus supports the following operators.

The operator instructions
+ add
subtraction
* multiply
/ division
% Take touch operation
= = equal
! = Not equal to the
> Is greater than
< Less than
> = Greater than or equal to
< = Less than or equal to
and Logic and
or Logic or
unless Unless you take a complement

Statistical function

The method name introduce
sum sum
min For the minimum
max For maximum
avg Average.
stddev Calculate standard deviation
stdvar
count Calculate the total number of
count_values Count the number of identical values
bottomk Smallest k elements
topk The largest k elements
quantile

This article is the author’s original, if you think this article is helpful to you, please feel free to tip, your support will encourage me to continue to create.

References: 1. Prometheus 2. Prometheus First Step 3