当前位置:网站首页>Prometheus installation

Prometheus installation

2022-07-04 19:57:00 Code Taoist

First, check the current server centos Version of

cat /etc/centos-release

It is divided into centOs6 and 7 Methods ;

【// If yum If not, run the following steps , If you can use it, you don't need to change the source , Upload the installation package manually , You don't have to change it

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

curl -k -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo

yum clean all

yum makecache

One 、 Download the software package on the official website

https://prometheus.io/download/

Upload package :( The installation package file has been installed ,)

prometheus-2.14.0.linux-amd64.tar.gz

Unzip package :

tar xvf prometheus-2.14.0.linux-amd64.tar.gz

mv prometheus-2.14.0.linux-amd64 /usr/local/prometheus

function Prometheus server:

cd /usr/local/prometheus

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

Two 、 To configure Prometheus

stay Prometheus.yml There is a configuration file , We can configure it , Of course, the first installation can also be configured without ;

vim /usr/local/prometheus/prometheus.yml

Verify the configuration file

./promtool check config ./prometheus.yml

To configure service Startup file

centos7 The method is as follows ://

vim  /usr/lib/systemd/system/prometheus.service

Add content

[Unit]

Description=The Prometheus Server

After=network.target

[Service]

Restart=on-failure

ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml

RestartSec=15s

[Install]

WantedBy=multi-user.target

systemctl daemon-reload

systemctl restart prometheus

ss -antl

centos6:

vim /usr/lib/systemd/system/prometheus.service

After entering the file, add the contents in the above command , There are no directories and files to create

sudo chkconfig daemon-reload

service  prometheus restart

3、 ... and 、 start-up prometheus command

/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml &

perhaps

**** ./prometheus

Four 、 On the web http://192.168.0.xxx:9090/targets Access is successful .

原网站

版权声明
本文为[Code Taoist]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/185/202207041740161929.html