Prometheus from the ground up

Prometheus installation and setup

Prometheus from the ground up

Download  and Install Prometheus

Download | Prometheus
An open-source monitoring system with a dimensional data model, flexible query language, efficient time series database and modern alerting approach.
wget https://github.com/prometheus/prometheus/releases/download/v2.14.0/prometheus-2.14.0.linux-amd64.tar.gz

tar -xvf prometheus-2.14.0.linux-amd64.tar.gz

cd prometheus-2.14.0.linux-amd64

useradd -r prometheus

cp prometheus /usr/local/bin/prometheus
cp promtool /usr/local/bin/promtool
cp tsdb /usr/local/bin/tsdb

mkdir /etc/promethus

chown prometheus:prometheus /etc/prometheus

cp -r console* /etc/prometheus/

chown prometheus:prometheus /etc/prometheus/console*

cp prometheus.yml /etc/prometheus/prometheus.yml

chmod 644 /etc/prometheus/prometheus.yml

Create the service

nano /etc/systemd/system/prometheus.service

systemctl daemon-reload

service start prometheus

service status prometheus

Service File

[Unit]
Description=Prometheus Monitoring System
After=network.target

[Service]
Type=simple
User=prometheus
Group=prometheus
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/usr/local/bin/prometheus \
  --config.file=/etc/prometheus/prometheus.yml \
  --storage.tsdb.path=/var/lib/prometheus \
  --web.console.libraries=/etc/prometheus/console_libraries \
  --web.console.templates=/etc/prometheus/consoles \

PrivateTmp=true
PrivateDevices=true
ProtectHome=true
NoNewPrivileges=true
LimitNOFILE=infinity
ReadWritePaths=/var/lib/prometheus
ProtectSystem=strict
ProtectControlGroups=true
ProtectKernelModules=true
ProtectKernelTunables=true

SyslogIdentifier=prometheus
Restart=always

[Install]
WantedBy=multi-user.target
Example from the digital ocean quick install

Once the service is running you will be able to view the web user interface on port 9090

Prometheus Web Interface