This ZenPack makes it possible to monitor the performance of a PostgreSQL database server, the individual databases, and the tables within those databases.
The features added by this ZenPack can be summarized as follows. They are each detailed further below.
- Discovery of PostgreSQL components.
- Monitoring of PostgreSQL metrics.
GNU General Public License, Version 2, or later
Git Sources (For Cloning)
This is an Open Source ZenPack developed by Zenoss, Inc. Enterprise support for this ZenPack is available to commercial customers with an active subscription.
Version 1.0.13 - Download
- Released on 2023/9/12
- Compatible with Zenoss 6.x, Zenoss Cloud and Service Impact 5.6.1
Version 1.0.12 - Download
- Released on 2020/1/14
- Compatible with Zenoss 6.4.1 - 6.5.0, Zenoss Cloud and Service Impact 5.5.3
The following types of components will be automatically discovered. The attributes and collections will be updated on Zenoss' normal remodeling interval which defaults to every 12 hours.
- Table Count
- Attributes: Name
The following metrics will be collected every 5 minutes by default.
- Metrics: Summaries of all databases and tables.
- Summaries of all tables
- Latency Metrics
- SELECT 1
- Connection Metrics
- Duration Metrics
- Active Transactions (min/avg/max)
- Idle Transactions (min/avg/max)
- Queries (min/avg/max)
- Efficiency Metrics
- Transaction Rollback Percentage
- Tuple Fetch Percentage
- Transaction Rate Metrics
- Tuple Rate Metrics
- Updated/sec, Deleted/sec
- Lock Metrics
- Scan Rate Metrics
- Tuple Rate Metrics
- Sequentially Read/sec
- Index Fetched/sec
- Hot Updated/sec
- Tuple Metrics
- Scan Rate Metrics
Once the PostgreSQL ZenPack is installed you will have the following new configuration properties which should be set either for device classes or individual devices.
- Port where PostgreSQL is listening. Default:
- Whether to use SSL or not. Default:
- Must be a superuser. Default:
- Password for user. No default.
- Default database. Default:
In addition to setting these properties you must add the
zenoss.PostgreSQL modeler plugin to a device class or individual
device. This modeler plugin will discover all databases and tables using
the connectivity information provided through the above settings. Each
database and table will automatically be monitored.
PostgreSQL Server Impact
Zenoss will run the following queries every five (5) minutes. These queries are intended to be lightweight so as to not adversely affect the server's performance.
-- Database statistics - Run once. SELECT d.datname, pg_database_size(s.datid) AS size, numbackends, xact_commit, xact_rollback, blks_read, blks_hit, tup_returned, tup_fetched, tup_inserted, tup_updated, tup_deleted FROM pg_database AS d JOIN pg_stat_database AS s ON s.datname = d.datname WHERE NOT datistemplate AND datallowconn -- Connection statistics - Run once. SELECT datname, xact_start, query_start, backend_start, now() AS now FROM pg_stat_activity -- Lock statistics - Run once. SELECT d.datname, l.mode, l.granted FROM pg_database AS d LEFT JOIN pg_locks AS l ON l.database = d.oid WHERE NOT d.datistemplate AND d.datallowconn -- Table statistics - Run once per database. SELECT relname, pg_relation_size(relid), pg_total_relation_size(relid), seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, last_vacuum, last_autovacuum, last_analyze, last_autoanalyze FROM pg_stat_user_tables
The following queries will be run whenever the PostgreSQL server device is remodeled. This occur once every 12 hours.
-- Database list - Run once. SELECT d.datname, s.datid, pg_database_size(s.datid) AS size FROM pg_database AS d JOIN pg_stat_database AS s ON s.datname = d.datname WHERE NOT datistemplate AND datallowconn -- Table list - Run once per database. SELECT relname, relid, schemaname, pg_relation_size(relid) AS size, pg_total_relation_size(relid) AS total_size FROM pg_stat_user_tables
If the device fails to model PostgreSQL components with the error:
WARNING zen.ZenModeler: Python client creation failed you can either
- Clear the events and remodel the device or
- Set the zSnmpMonitorIgnore property to
- Add Support for PostgreSQL 11.x (ZPS-7185)
- Make PostgreSQL table modeling optional (ZPS-8554)
- Tested with Zenoss Cloud, Zenoss 6.7.0 and Service Impact 5.6.1
- Resolved issue with error in pg8000 library on Ubuntu OS (ZPS-7424)
- Resolved issue with falling data collecting after platform upgrade. (ZPS-6818)
- Tested with Zenoss Cloud, Zenoss 6.4.1, Zenoss 6.5.0 and Service Impact 5.5.3
- Add support for Bi-Directional Replication (ZPS-249)
- Add support variable default database name (ZPS-2767)
- Added zProperties:
- zPostgreSQLDefaultDB: Sets default database for administration data
- Added doc updates for failed modeling (ZEN-29375)
- Tested with Zenoss Resource Manager 5.3.3 ,Zenoss Resource Manager 6.0.1, Zenoss Resource Manager 6.1.0 and Zenoss Resource Manager 4.2.5 RPS 743
- Filter PIDs for lock query (ZEN-15165)
- Guard against locks in PGSQL poller (ZPS-312)
- Handle null data by skipping it (ZEN-14276)
- Update pg8000 lib to 1.9.14 (ZEN-12752)