Prometheus

Perform the following steps:

  1. Log in to the Prometheus guest instance:
vagrant ssh prometheus
  1. Inside the guest instance, drop to the root:
sudo -i
  1. Add all the guests' addresses to the instance host's file:
cat <<EOF >/etc/hosts
127.0.0.1 localhost
192.168.42.10 prometheus.prom.inet prometheus
192.168.42.11 grafana.prom.inet grafana
192.168.42.12 alertmanager.prom.inet alertmanager


# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
EOF

 

  1. Create a new system user:
useradd --system prometheus
  1. Go into /tmp and download the Prometheus archive:
cd /tmp
curl -sLO "https://github.com/prometheus/prometheus/releases/download/v2.9.2/prometheus-2.9.2.linux-amd64.tar.gz"
  1. Uncompress the archive:
tar zxvf prometheus-2.9.2.linux-amd64.tar.gz
  1. Place every file in its correct location:
install -m 0644 -D -t /usr/share/prometheus/consoles prometheus-2.9.2.linux-amd64/consoles/*

install -m 0644 -D -t /usr/share/prometheus/console_libraries prometheus-2.9.2.linux-amd64/console_libraries/*

install -m 0755 prometheus-2.9.2.linux-amd64/prometheus prometheus-2.9.2.linux-amd64/promtool /usr/bin/

install -d -o prometheus -g prometheus /var/lib/prometheus

install -m 0644 -D /vagrant/chapter03/configs/prometheus/prometheus.yml /etc/prometheus/prometheus.yml

install -m 0644 -D /vagrant/chapter03/configs/prometheus/first_rules.yml /etc/prometheus/first_rules.yml

 

  1. Add a systemd unit file for the Prometheus service:
install -m 0644 /vagrant/chapter03/configs/prometheus/prometheus.service /etc/systemd/system/

systemctl daemon-reload
  1. Enable and start the Prometheus service:
systemctl enable prometheus
systemctl start prometheus

You should now have the Prometheus HTTP endpoint available on your host.

  1. Exit the root account and then the Vagrant user account:
exit

exit
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.11.98