Prometheus+Grafana监控PostgreSQL

本文详细介绍了如何使用Prometheus 2.32.0和Grafana 8.3.3来监控PostgreSQL 13.2数据库。在CentOS 7.6环境下,通过Docker安装Prometheus和Grafana,并配置Postgres Exporter来收集PG数据库的监控指标。最后,展示了如何在Grafana中添加数据源和模板,以便于可视化监控数据。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Prometheus+Grafana监控PostgreSQL

Prometheus:2.32.0
Grafana:8.3.3
PG:13.2
Linux:CentOS7.6
docker:18.06.3

1、安装Prometheus

下载地址;https://prometheus.io/download/

[root@wcbpg ~]# docker images
REPOSITORY                                           TAG                 IMAGE ID            CREATED             SIZE
mambapg13                                            1.0                 bb50c95ef78c        6 hours ago         2.56GB
wcbcentos76                                          1.0                 6877e73a2018        2 weeks ago         1.9GB
wcbpg                                                1.0                 988fc4d35414        2 weeks ago         1.9GB
registry.cn-hangzhou.aliyuncs.com/lhrbest/lhrpgall   1.0                 a726460146fc        7 months ago        3.96GB
centos                                               7.6.1810            f1cb7c7d58b7        2 years ago         202MB
[root@wcbpg ~]# 
[root@wcbpg ~]#docker run -d --name mambaprometheus -h mambaprometheus \
  -p 12222:22 -p 23389:3389 -p 29090:9090 -p 29093:9093 -p 23000:3000 \
  --privileged=true centos:7.6.1810 \
  /usr/sbin/init
108317a2ba8151870f8d38450b9b359742752de0412cf49b4ba7849f3f784f66
[root@wcbpg ~]# pwd
/root
[root@wcbpg ~]# ls -lth
total 79M
-rw-r--r--  1 root root  72M Dec 18 18:59 prometheus-2.32.0.linux-amd64.tar.gz
-rw-r--r--  1 root root   16 Dec  9 23:20 file3.txt
-rw-r--r--  1 root root   37 Dec  9 23:19 file2.txt
drwxr-xr-x  2 root root   31 Dec  8 23:32 data
-rw-r--r--  1
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值