Skip to content

Instantly share code, notes, and snippets.

@zaftzaft
Last active February 26, 2018 08:56
Show Gist options
  • Select an option

  • Save zaftzaft/287a1ff333e7facbee21734f24b6ed48 to your computer and use it in GitHub Desktop.

Select an option

Save zaftzaft/287a1ff333e7facbee21734f24b6ed48 to your computer and use it in GitHub Desktop.
v=0.14.0
version=v$v
file=alertmanager-$v.linux-amd64
service=alertmanager
wget https://github.com/prometheus/alertmanager/releases/download/$version/$file.tar.gz \
-O /tmp/$file.tar.gz
systemctl is-enabled $service
if [ $? -eq 0 ]; then
systemctl stop $service
fi
cd /tmp
tar xvf /tmp/$file.tar.gz
cp /tmp/$file/alertmanager /usr/local/bin/alertmanager
cp /tmp/$file/amtool /usr/bin/amtool
tee /usr/lib/systemd/system/${service}.service << EOS
[Unit]
Description=alertmanager
[Service]
Restart=always
ExecStart=/usr/local/bin/alertmanager --config.file /etc/prometheus/alertmanager.yml
[Install]
WantedBy=default.target
EOS
systemctl daemon-reload
systemctl enable $service
systemctl start $service
cd -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment