Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Zabbix Monitoring PostgreSQL

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Zabbix monitoring PostgreSQL learning PostgreSQL zabbix

Zabbix Monitoring PostgreSQL

1. Install libzbxpgsql

two。 Configure zabbix profile zabbix_agentd.conf

3. Create a monitoring user

4. Import Monitoring Templat

5. Host link template, setting macro variables

Since PostgreSQL was used last time, and the monitoring used was Zabbix, this plug-in was found for Zabbix monitoring PostgreSQL.

Plug-in website: PostgreSQL monitoring for Zabbix

Github address: https://github.com/cavaliercoder/libzbxpgsql

Environment:

CentOS6.8

Zabbix3.2.1

PostgreSQL9.5.6

1. Install libzbxpgsql

Install it according to the official documentation.

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 # has been installed and can be ignored

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/

two。 Configure zabbix profile 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. Create a monitoring user

Create a user, give it read-only access to the database you want to monitor, and minimize permissions for security.

I use pgpool-II.

Psql-h 10.1.0.115-U postgres-p9999

Password for user postgres:

Psql (9.5.6)

Type "help" for help.

Postgres=# CREATEROLE 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

If the created user can log in to view the corresponding database, you can proceed to the next step.

[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. Import Monitoring Templat

The templates are available on Github:

Https://github.com/cavaliercoder/libzbxpgsql/tree/master/templates

5. Host link template, setting macro variables

{$PG_CONN} = > host=localhost port=54321 user=monitoring connect_timeout=10

{$PG_DB} = > wiseucmsg

If there is a graph, the monitoring is successful.

Attachment: http://down.51cto.com/data/2366485

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report