PG Overview
This dashboard works with postgres_exporter for prometheus
PostgreSQL_exporter
1.下载和配置
下载文件:postgres_exporter-0.10.0.linux-amd64.tar.gz 解压:
tar -C /opt -xvf postgres_exporter-0.10.0.linux-amd64.tar.gz
cd /opt && mv postgres_exporter-0.10.0.linux-amd64 postgres_exporter
cd postgres_exporter
添加脚本: start.sh
sudo -u postgres DATA_SOURCE_NAME="user=postgres host=/var/run/postgresql/ sslmode=disable" postgres_exporter #需要通过用户postgres启动
添加至systemd:
vim /usr/lib/systemd/system/postgres_exporter.service
[Unit]
Description=postgres_exporter
After=network.target
[Service]
Type=simple
ExecStart=/PATH/TO/start.sh
Restart=on-failure
[Install]
WantedBy=multi-user.target
启动:
systemctl daemon-reload
systemctl start postgres_exporter
systemctl status postgres_exporter
systemctl enable postgres_exporte
2.接入prometheus
edit prometheus.yml
- job_name: "postgresql"
file_sd_configs:
- files:
- targets/postgresql.yml
refresh_interval: 10m
targets/postgresql.yml
- targets: ["10.1xx.1.1xx:9187"]
labels:
instance: 10.1xx.1.1xx_postgresql
targets: "10.1xx.1.1xx:9187"
Data source config
Collector config:
Upload an updated version of an exported dashboard.json file from Grafana
Revision | Description | Created | |
---|---|---|---|
Download |