prometheus監控04-AlertManager

你好我叫阿成發表於2024-11-25

1、alertermanager 部署

1.1、使用二進位制包部署AlertManager

  • Alertmanager最新版本的下載地址可以從Prometheus官方網站https://prometheus.io/download/獲取。
[root@basepub-tools ~]# tar xf alertmanager-0.28.0-rc.0.linux-amd64.tar.gz -C /usr/local/
[root@basepub-tools ~]# mv /usr/local/alertmanager-0.28.0-rc.0.linux-amd64/ /usr/local/alertmanager

#讓systemctl管理起來
[root@basepub-tools ~]# cat  /etc/systemd/system/alertmanager.service
[Unit]
Description=alertmanager
After=network.target
[Service]
Type=simple
User=prometheus
EnvironmentFile=/etc/sysconfig/alertmanager.env
ExecStart=/usr/local/alertmanager/alertmanager --config.file=/usr/local/alertmanager/alertmanager.yml  --storage.path=/usr/local/alertmanager/data/ $OPTIONS
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target
[root@basepub-tools ~]# cat /etc/sysconfig/alertmanager.env
OPTIONS=""

[root@basepub-tools ~]# mkdir  /usr/local/alertmanager/data
[root@basepub-tools ~]# chown -R prometheus:prometheus /usr/local/alertmanager/

#啟動alertmanager
[root@basepub-tools ~]# systemctl daemon-reload
[root@basepub-tools ~]# systemctl start alertmanager
[root@basepub-tools ~]# systemctl status alertmanager
● alertmanager.service - alertmanager
   Loaded: loaded (/etc/systemd/system/alertmanager.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2024-11-25 10:43:29 CST; 5s ago
 Main PID: 1652 (alertmanager)
    Tasks: 6
   Memory: 14.5M
   CGroup: /system.slice/alertmanager.service
           └─1652 /usr/local/alertmanager/alertmanager --config.file=/usr/local/alertmanager/a>


訪問alertmanager介面http://192.168.200.176:9093

相關文章