Prometheus+grafana+alertmanager 部署文档

grafana

[root@vm5 ~]# wget https://dl.grafana.com/oss/release/grafana-10.0.0.linux-amd64.tar.gz
 
[root@vm5 ~]# tar -xf grafana-10.0.0.linux-amd64.tar.gz

[root@vm5 ~]# mv grafana-10.0.0 /home/grafana

[root@vm5 ~]# cat /usr/lib/systemd/system/grafana.service
[Unit]
Description=Grafana Server
After=network-online.target

[Service]
Restart=on-failure
ExecStart=/home/grafana/bin/grafana-server -config /home/grafana/conf/defaults.ini -homepath /home/grafana

[Install]
WantedBy=multi-user.target


[root@vm5 ~]# systemctl daemon-reload
[root@vm5 ~]# systemctl start grafana
[root@vm5 ~]# systemctl enable grafana

prometheus

https://prometheus.io/download/
[root@vm11 ~]# tar -xf prometheus-2.44.0.linux-amd64.tar.gz

[root@vm11 ~]# mv prometheus-2.44.0 /opt/prometheus
[root@vm11 ~]# cat /usr/lib/systemd/system/prometheus.service
[Unit]
Description=Prometheus server Daemon
After=network.target
[Service]
Type=simple
User=root
Group=root
ExecStart=/opt/prometheus/prometheus --web.listen-address=0.0.0.0:37090 --config.file=/opt/prometheus/prometheus.yml  --storage.tsdb.path=/opt/data/prometheus  --storage.tsdb.retention=15d --web.enable-lifecycle
Restart = on-failure
[Install]
WantedBy=multi-user.target

[root@vm5 ~]# systemctl daemon-reload
[root@vm5 ~]# systemctl start prometheus
[root@vm5 ~]# systemctl enable prometheus

alertmanager

wget https://github.com/prometheus/alertmanager/releases/download/v0.24.0/alertmanager-0.24.0.linux-amd64.tar.gz
tar -xf  alertmanager-0.25.0.linux-amd64.tar.gz 
mv alertmanager-0.25.0.linux-amd64 /opt/alertmanager

vim /etc/systemd/system/alertmanager.service
[Unit]
Description=AlertManager Service
After=network.target

[Service]
Restart=always
ExecStart=/opt/alertmanager/alertmanager --config.file=/opt/alertmanager/alertmanager.yml --web.listen-address=0.0.0.0:33093
Type=simple
User=root
Group=root

[Install]
WantedBy=multi-user.target




systemctl daemon-reload && systemctl start alertmanager && systemctl enable alertmanager

你可能感兴趣的:(prometheus)