2.3 KiB
2.3 KiB
Zabbix PostgreSQL Partitioning Monitoring
This directory contains an extremely efficient, production-ready Zabbix Native Agent 2 monitoring suite designed to track the health of your actively partitioned PostgreSQL database tables.
This template natively leverages the Zabbix Agent 2 backend. It uses a single, highly-optimized master payload query (partitions.get_all.sql) to pull all metrics in bulk over a single database connection, dynamically distributing the numbers to Zabbix using Dependent Items.
Step-by-Step Setup
- Copy the one SQL file (
template/partitions.get_all.sql) into a secure directory on your Agent machine. E.g.,/etc/zabbix/zabbix_agent2.d/postgresql/. - Secure the local Linux permissions so the Zabbix user can strictly read it:
chown -R zabbix:zabbix /etc/zabbix/zabbix_agent2.d/postgresql chmod 644 /etc/zabbix/zabbix_agent2.d/postgresql/*.sql - Open your main
/etc/zabbix/zabbix_agent2.conffile. Scroll to the absolute bottom and add these exact lines to safely establish your custom query module AND a secure named session (e.g.,AWS_RDS):# 1. Enable Loadable Custom Queries (Mandatory in Zabbix 7.4+) Plugins.PostgreSQL.CustomQueriesPath=/etc/zabbix/zabbix_agent2.d/postgresql/ Plugins.PostgreSQL.CustomQueriesEnabled=true # 2. Establish a Secure Backend Session Plugins.PostgreSQL.Sessions.AWS_RDS.Uri=tcp://your-cluster-endpoint.amazonaws.com:5432 Plugins.PostgreSQL.Sessions.AWS_RDS.User=zabbix Plugins.PostgreSQL.Sessions.AWS_RDS.Password=<YOUR_ZABBIX_PASSWORD> Plugins.PostgreSQL.Sessions.AWS_RDS.TLSConnect=verify_full Plugins.PostgreSQL.Sessions.AWS_RDS.TLSCAFile=/etc/zabbix/global-bundle.pem - Restart your agent to lock the session and SSL configurations into memory:
systemctl restart zabbix-agent2 - Import the
zbx_pg_partitions_monitor_agent2.yamltemplate directly into your Zabbix Frontend. - Attach the template to your Host, navigate to its "Macros" tab, and define strictly exactly this one macro:
{$PG.CONNSTRING.AGENT2}:AWS_RDS
(By pointing this macro to the Session name we built in Step 3, you are telling Zabbix to seamlessly abandon all plaintext frontend passwords and rely 100% on the encrypted local session parameters!)