User Tools

Site Tools


Sidebar

prometheus

This is an old revision of the document!


Create rules

sudo vim /etc/prometheus/uptime_rule.uml
..add your rule code here...

Setup Alert Manager

# Create the user for alertmanager
useradd --no-create-home --shell /bin/false alertmanager
# Download alertmanager and extract
wget https://github.com/prometheus/alertmanager/releases/download/v0.23.0/alertmanager-0.23.0.linux-amd64.tar.gz
aunpack ./alertmanager-0.23.0.linux-amd64.tar.gz 
# Move alertmanager and amtool birnaries in place
sudo cp ./alertmanager-0.23.0.linux-amd64/alertmanager /usr/local/bin/
sudo cp ./alertmanager-0.23.0.linux-amd64/amtool /usr/local/bin/
# Ensure that the correct permissions are in place
sudo chown alertmanager:alertmanager /usr/local/bin/alertmanager
sudo chown alertmanager:alertmanager /usr/local/bin/amtool
# Cleanup
rm -rf alertmanager-0.23.0.linux-amd64*
# Configure Alertmanager
## Create the alertmanager directory and configure the global alertmanager configuration
sudo mkdir /etc/alertmanager
vim /etc/alertmanager/alertmanager.yml
# Ensure the permissions are in place
chown alertmanager:alertmanager -R /etc/alertmanager
# Create the alertmanager systemd unit file
sudo vim /etc/systemd/system/alertmanager.service
# Now we need to inform prometheus that we will send alerts to alertmanager to it’s exposed port
sudo vim /etc/prometheus/prometheus.yml
sudo vim /etc/systemd/system/prometheus.service
sudo systemctl daemon-reload
sudo systemctl restart alertmanager.service 
sudo systemctl restart prometheus.service 
sudo systemctl status prometheus.service
sudo systemctl status alertmanager.service 
## Access alertmanager on your endpoint on port 9093
prometheus.1633956980.txt.gz · Last modified: 2021/10/11 05:56 by vissie