Рет қаралды 16,133
This tutorial helps you to monitor "POSTGRES" DB with "Prometheus & Grafana".
Follow the below steps:
sudo cp postgres_exporter /usr/local/bin
cd /opt/postgres_exporter
sudo nano postgres_exporter.env
DATA_SOURCE_NAME="postgresql://postgres:postgres@192.168.56.106:5432/?sslmode=disable"
sudo useradd -rs /bin/false postgres
vi /etc/systemd/system/postgres_exporter.service
[Unit]
Description=Prometheus exporter for Postgresql
Wants=network-online.target
After=network-online.target
[Service]
User=postgres
Group=postgres
WorkingDirectory=/opt/postgres_exporter
EnvironmentFile=/opt/postgres_exporter/postgres_exporter.env
ExecStart=/usr/local/bin/postgres_exporter --web.listen-address=192.168.56.106:9100 --web.telemetry-path=/metrics
Restart=always
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start postgres_exporter
sudo systemctl enable postgres_exporter
sudo systemctl status postgres_exporter
Steps to perform on Prometheus Server
systemctl stop prometheus
vi /etc/prometheus/prometheus.yml
systemctl start prometheus
systemctl status prometheus