2. Prometheus setup

2.1 Install Prometheus

2.1.1 Create group and user for Prometheus:

root@deploymentmachine:/home# id
uid=0(root) gid=0(root) groups=0(root)
root@deploymentmachine:/home# groupadd --system prometheus
root@deploymentmachine:/home# useradd -s /sbin/nologin --system -g prometheus prometheus

2.1.2 Create directories for Prometheus:

root@deploymentmachine:/home# id
uid=0(root) gid=0(root) groups=0(root)
root@deploymentmachine:/home#  mkdir -p /var/lib/prometheus
root@deploymentmachine:/home# mkdir -p /etc/prometheus/
root@deploymentmachine:/home# cd /etc/prometheus/
root@deploymentmachine:/etc/prometheus# mkdir {rules,rules.d}

2.1.3 Download the latest version from the official repository:

better use api.github.com endpoints...

... and untar for extracting files:

2.4 Move the following files under /usr/local/bin, respectively /etc/prometheus

2.2. Configure Prometheus

2.2.1 Create a systemd file for Prometheus service, with following content:

The configuration file prometheus.yml that has been moved under /etc/prometheus/prometheus.yaml should have the following content:

We will use this file for addition of targets and job_names for our MySQL services

2.2.2 Change ownership and permission of folder /etc/prometheus:

2.2.3. Reload and start the Prometheus service:

2.2.4 Perform checking

a) Check if the port 9090 is listening:

b) Check the status of the service

c) Open a browser of your choice, and see if you can reach Prometheus at Public IP of your Cloud instance, and port 9090:

Last updated