Prometheus之Alertmanager部署

一 下载Alertmanager组件

下载地址:https://prometheus.io/download/

root@node-02:~# wget https://github.com/prometheus/alertmanager/releases/download/v0.23.0/alertmanager-0.23.0.linux-amd64.tar.gz

二 装Alertmanager组件

root@node-02:~# tar xf alertmanager-0.23.0.linux-amd64.tar.gz -C /usr/local/
root@node-02:~# ln -sv /usr/local/alertmanager-0.23.0.linux-amd64/ /usr/local/alertmanager
'/usr/local/alertmanager' -> '/usr/local/alertmanager-0.23.0.linux-amd64/'

三 创建alertmanager.service文件

cat >> /lib/systemd/system/alertmanager.service << EOF
[Unit]
Descripton=alertmanager server
Documentation=https://prometheus.io/docs/introduction/overview/
After=network.target

[Service]
Restart=on-failure
WorkingDirectory=/usr/local/alertmanager
ExecStart=/usr/local/alertmanager/alertmanager --config.file=/usr/local/alertmanager/alertmanager.yml

[Install]
WantedBy=multi-user.target
EOF

四 设置开机启动

点击查看代码
root@node-02:~# systemctl enable alertmanager.service 
Created symlink /etc/systemd/system/multi-user.target.wants/alertmanager.service → /lib/systemd/system/alertmanager.service.
root@node-02:~# systemctl start alertmanager.service 
root@node-02:~# systemctl status alertmanager.service 
● alertmanager.service
     Loaded: loaded (/lib/systemd/system/alertmanager.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2021-11-17 22:33:57 CST; 3s ago
       Docs: https://prometheus.io/docs/introduction/overview/
   Main PID: 5761 (alertmanager)
      Tasks: 9 (limit: 2245)
     Memory: 12.1M
     CGroup: /system.slice/alertmanager.service
             └─5761 /usr/local/alertmanager/alertmanager --config.file=/usr/local/alertmanager/alertmanager.yml

Nov 17 22:33:57 node-02 systemd[1]: Started alertmanager.service.
Nov 17 22:33:57 node-02 alertmanager[5761]: level=info ts=2021-11-17T14:33:57.816Z caller=main.go:225 msg="Starting Alertma>
Nov 17 22:33:57 node-02 alertmanager[5761]: level=info ts=2021-11-17T14:33:57.816Z caller=main.go:226 build_context="(go=go>
Nov 17 22:33:57 node-02 alertmanager[5761]: level=info ts=2021-11-17T14:33:57.819Z caller=cluster.go:184 component=cluster >
Nov 17 22:33:57 node-02 alertmanager[5761]: level=info ts=2021-11-17T14:33:57.824Z caller=cluster.go:671 component=cluster >
Nov 17 22:33:57 node-02 alertmanager[5761]: level=info ts=2021-11-17T14:33:57.998Z caller=coordinator.go:113 component=conf>
Nov 17 22:33:58 node-02 alertmanager[5761]: level=info ts=2021-11-17T14:33:57.999Z caller=coordinator.go:126 component=conf>
Nov 17 22:33:58 node-02 alertmanager[5761]: level=info ts=2021-11-17T14:33:58.004Z caller=main.go:518 msg=Listening address>
Nov 17 22:33:58 node-02 alertmanager[5761]: level=info ts=2021-11-17T14:33:58.004Z caller=tls_config.go:191 msg="TLS is dis>
Nov 17 22:33:59 node-02 alertmanager[5761]: level=info ts=2021-11-17T14:33:59.825Z caller=cluster.go:696 component=cluster >

五 验证web界面

 

posted @ 2021-11-17 23:28  小吉猫  阅读(199)  评论(0编辑  收藏  举报