prometheus安装全过程

#安装prometheus

wget https://github.com/prometheus/prometheus/releases/download/v2.5.0/prometheus-2.5.0.linux-amd64.tar.gz
tar -xvf prometheus-2.5.0.linux-amd64.tar.gz
cd prometheus-2.5.0.linux-amd64/
mv * /home/work/prometheus/
cd /home/work/prometheus/
mkdir {data,cfg,logs,bin} -p
mv prometheus promtool bin/
mv prometheus.yml cfg/
vim /etc/systemd/system/prometheus.service

[Unit]
Description=Prometheus
Documentation=https://prometheus.io/
After=network.target

[Service]
Type=simple
User=root
ExecStart=/home/work/prometheus/bin/prometheus --config.file=/home/work/prometheus/cfg/prometheus.yml --storage.tsdb.path=/home/work/prometheus/data
Restart=on-failure

[Install]
WantedBy=multi-user.target

vim /home/work/prometheus/cfg/prometheus.yml
View Code

#安装node_exporter

wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.darwin-amd64.tar.gz
tar -zxvf node_exporter-0.17.0-rc.0.linux-amd64.tar.gz -C cd /home/work/prometheus/
cd /home/work/prometheus/
mv node_exporter-0.17.0-rc.0.linux-amd64 node_exporter
vim /etc/systemd/system/node_exporter.service

[Unit]
Description=node_exporter
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
User=root
ExecStart=/home/work/prometheus/node_exporter/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
View Code

#安装grafana

wget https://dl.grafana.com/oss/release/grafana-6.1.3-1.x86_64.rpm 
yum -y localinstall grafana-6.1.3-1.x86_64.rpm
View Code


#安装alertmanager

wget https://github.com/prometheus/alertmanager/releases/download/v0.20.0/alertmanager-0.20.0.linux-amd64.tar.gz 
tar -xvf alertmanager-0.20.0.linux-amd64.tar.gz -C /home/work/prometheus/ 
cd /home/work/prometheus/ && mv alertmanager-0.20.0.linux-amd64/ alertmanager 
cd alertmanager/ 
mkdir {bin,cfg,data} 
mv alertmanager amtool bin/ 
mv alertmanager.yml cfg/ 
vim /usr/lib/systemd/system/alertmanager.service 
[Unit]
Description=alertmanager
Documentation=https://prometheus.io/
After=network.target

[Service]
Type=simple
User=root
ExecStart=/home/work/prometheus/alertmanager/bin/alertmanager \
--config.file=/home/work/prometheus/alertmanager/cfg/alertmanager.yml \
--web.listen-address=10.10.2.17:9093 \
--cluster.listen-address=0.0.0.0:8001 \
--storage.path=/home/work/prometheus/alertmanager/data \
--log.level=info
Restart=on-failure
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
View Code

#安装pushgateway

wget https://github.com/prometheus/pushgateway/releases/download/v1.0.1/pushgateway-1.0.1.linux-amd64.tar.gz
tar xzvf pushgateway-1.0.1.linux-amd64.tar.gz
mv pushgateway-1.0.1.linux-amd64 /home/work/prometheus/pushgateway
./pushgateway &
View Code

猜你喜欢

转载自www.cnblogs.com/tengfei520/p/12109612.html