Prometheus installation
On centos, ubuntu systems steps are as follows:
Download the latest installation package prometheus
# wget https://github.com/prometheus/prometheus/releases/download/v2.12.0/prometheus-2.12.0.linux-amd64.tar.gz
Unzip the downloaded installation
# tar xf prometheus-2.5.0.linux-amd64.tar.gz
The execution file installed into the file / usr / local / bin / directory, to facilitate command can be executed directly (optional)
# cp prometheus-2.5.0.linux-amd64/{prometheus,promtool} /usr/local/bin/
Use promtool prometheus command to view the configuration file syntax is correct
# promtool check config /opt/prometheus-2.12.0.linux-amd64/prometheus.yml
By installing docker
# docker run -d -p 9090:9090 -v /tmp/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
Node exporter installation
Node exporter install the latest installation package
# wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
Download the installation package to decompress
# tar -xf node_exporter-0.18.1.linux-amd64.tar.gz
Into the installation package after decompression, to execute the command cp / usr / local / bin directory
# cp node_exporter /usr/local/bin/
Start service method
Method One: Use the screen command to start
# Screen into prometheus or node_exporter installation directory service will start up
root @ Prometheus: /opt/node_exporter-0.18.1.linux-amd64# Screen -ls
There are Screens ON:
13286.pts-0.Prometheus (09 / 09:52:46 AM 10/2019) (of type Detached)
13129.pts-0.Prometheus (09/10/2019 09:50:09 AM) (of type Detached)
2 in Sockets / RUN / Screen / S-the root.
# in this program into the background, you can screen -r 13286, quit the background, ctrl + ad, the background exit and end the process ctrl + d
Method Two: Use daemonize way