Zabbix监控PostgreSQL
发表于:2025-02-02 作者:千家信息网编辑
千家信息网最后更新 2025年02月02日,Zabbix监控PostgreSQL学习 PostgreSQL zabbixZabbix监控PostgreSQL1. 安装libzbxpgsql2. 配置zabbix配置文件zabbix_agentd
千家信息网最后更新 2025年02月02日Zabbix监控PostgreSQL
Zabbix监控PostgreSQL
Zabbix监控PostgreSQL
1. 安装libzbxpgsql
2. 配置zabbix配置文件zabbix_agentd.conf
3. 创建监控用户
4. 导入监控模板
5. 主机链接模板,设置宏变量
因上次用到了PostgreSQL,而所使用的监控又是Zabbix,所以找到了此插件用于Zabbix监控PostgreSQL。
插件网站:PostgreSQL monitoring for Zabbix
Github地址:https://github.com/cavaliercoder/libzbxpgsql
环境:
CentOS6.8
Zabbix3.2.1
PostgreSQL9.5.6
1. 安装libzbxpgsql
根据官方文档进行安装即可。
http://cavaliercoder.com/libzbxpgsql/documentation/module-installation/
rpm -ivh https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-6-x86_64/pgdg-centos95-9.5-3.noarch.rpm
yum -y install postgresql95-libs # 已经安装可忽略
yum -y install libconfig
wget http://cdn.cavaliercoder.com/libzbxpgsql/yum/zabbix32/rhel/6/x86_64/libzbxpgsql-1.1.0-1.el6.x86_64.rpm
[root@im109 packages]# find / -name libzbxpgsql.so
[root@im109 packages]# rpm -ivh --force libzbxpgsql-1.1.0-1.el6.x86_64.rpm
error: Failed dependencies:
libconfig.so.8()(64bit) is needed by libzbxpgsql-1.1.0-1.x86_64
zabbix-agent >= 3.0.0 is needed by libzbxpgsql-1.1.0-1.x86_64
[root@im109 packages]# rpm -ivh --force libzbxpgsql-1.1.0-1.el6.x86_64.rpm --nodeps
Preparing... ########################################### [100%]
1:libzbxpgsql ########################################### [100%]
[root@im109 packages]# find / -name libzbxpgsql.so
/usr/lib64/zabbix/modules/libzbxpgsql.so
[root@im109 packages]# ln -s /usr/lib64/zabbix/modules/libzbxpgsql.so /usr/local/zabbix/lib/
2. 配置zabbix配置文件zabbix_agentd.conf
[root@im109 log]# /usr/local/zabbix/sbin/zabbix_agentd -t pg.modver
zabbix_agentd [21910]: starting agent module libzbxpgsql 1.1.0
zabbix_agentd [21910]: using module configuration file: /etc/zabbix/libzbxpgsql.conf
pg.modver [s|libzbxpgsql 1.1.0, compiled for Zabbix 3.2.3]
[root@im109 log]# /etc/init.d/zabbix-agentd restart
Shutting down Zabbix agent: [ OK ]
Starting Zabbix agent: [ OK ]
3. 创建监控用户
创建一个用户,开放你所要监控的数据库只读权限给它,为了安全,把权限做到最小化。
我用的pgpool-II。
psql -h 10.1.0.115 -U postgres -p9999
Password for user postgres:
psql (9.5.6)
Type "help" for help.
postgres=# CREATE ROLE monitoring WITH LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE;
CREATE ROLE
postgres=# GRANT CONNECT ON DATABASE wiseucmsg TO monitoring;
GRANT
postgres=# alter user monitoring with password 'password';
ALTER ROLE
使用创建的用户能登录查看相应数据库,则可进行下一步。
[root@im109 pgpool-II]# psql -h localhost -U monitoring -p 54321 wiseucmsg
psql (9.5.6)
Type "help" for help.
wiseucmsg=> \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
wiseucmsg | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres +
| | | | | postgres=CTc/postgres+
| | | | | monitoring=c/postgres
(4 rows)
wiseucmsg=>
4. 导入监控模板
模板在Github上有:
https://github.com/cavaliercoder/libzbxpgsql/tree/master/templates
5. 主机链接模板,设置宏变量
{$PG_CONN} => host=localhost port=54321 user=monitoring connect_timeout=10
{$PG_DB} => wiseucmsg
有图形出现,则监控成功。
监控
模板
用户
配置
主机
变量
插件
数据
数据库
文件
权限
链接
最小
安全
成功
又是
图形
地址
官方
文档
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
开电子发票服务器上传地址
吉林网络时间服务器供应商
北京茶优爱互联网科技
全面落实网络安全责任制
新时达二代服务器刷机方法
软件开发与管理专业哪个好
国家网络安全相关图片
哈市网络安全学习
网络安全联动
中山市国滔网络技术有限公司
山西电脑软件开发培训班
超微服务器跳线
互联网养老软件开发专业制作
遵化市网络安全
金博士软件开发有限
c 获取数据库数据并赋值
软件开发 最近 流行
阿里云服务器 云磁盘
三流企业做服务器
打印机必须有服务器吗
数据库batween and
松江区个人软件开发统计
沈阳软件开发怎么样
江苏高品质服务器代理厂家
怎么查数据库是否过期
国家网络安全周新闻联播
阿里云服务器如何配置安全组
荡神志下载软件开发
网络安全稿子1300字
软件开发所用技术