[root@bogon opt]# tar xvf alertmanager-0.21.0.linux-amd64.tar.gz
[root@bogon opt]# ln -s alertmanager-0.21.0.linux-amd64 alertmanager
编写服务脚本
cat > /usr/lib/systemd/system/alertmanager.service <<EOF
[Unit]
Description=alertmanager
Documentation=
After=network.target
[Service]
Type=simple
WorkingDirectory=/opt/alertmanager
ExecStart=/opt/alertmanager/alertmanager
ExecStop=/bin/kill -KILL \$MAINPID
ExecReload=/bin/kill -HUP \$MAINPID
KillMode=control-group
Restart=on-failure
RestartSec=3s
[Install]
WantedBy=multi-user.target
EOF
启动
[root@bogon opt]# systemctl enable alertmanager
Created symlink from /etc/systemd/system/multi-user.target.wants/alertmanager.service to /usr/lib/systemd/system/alertmanager.service.
[root@bogon opt]# systemctl start alertmanager
[root@bogon opt]# systemctl status alertmanager