ODT Export
 

PostgreSQL UserParameters

Please add your findings here.

More info about the views that are usable in postgres can be found at

Note all examples assume that the username the zabbix_server daemon runs as (typically “zabbix”) has access to PostgreSQL and can access a database titled the same as the user (again typically “zabbix”) If this is not the case you'll need to adjust the psql command to specify credentials and/or an accessible database name.

Server specific examples

  • Get the PostgreSQL version
UserParameter=psql.version,psql --version|head -n1
  • Get the total number of Server Processes that are active
UserParameter=psql.server_processes,psql -t -c "select sum(numbackends) from pg_stat_database"
  • Get the total number of commited transactions
UserParameter=psql.tx_commited,psql -t -c "select sum(xact_commit) from pg_stat_database"
  • Get the total number of rolled back transactions
UserParameter=psql.tx_rolledback,psql -t -c "select sum(xact_rollback) from pg_stat_database"

Database specific examples

  • Get the size of a Database (in bytes)
UserParameter=psql.db_size[*],psql -t -c "select pg_database_size('$1')"
  • Get number of active connections for a specified database
UserParameter=psql.db_connections[*],psql -t -c "select numbackends from pg_stat_database where datname = '$1'"
  • Get number of tuples returned for a specified database
UserParameter=psql.db_returned[*],psql -t -c "select tup_returned from pg_stat_database where datname = '$1'"
  • Get number of tuples fetched for a specified database
UserParameter=psql.db_fetched[*],psql -t -c "select tup_fetched from pg_stat_database where datname = '$1'"
  • Get number of tuples inserted for a specified database
UserParameter=psql.db_inserted[*],psql -t -c "select tup_inserted from pg_stat_database where datname = '$1'"
  • Get number of tuples updated for a specified database
UserParameter=psql.db_updated[*],psql -t -c "select tup_updated from pg_stat_database where datname = '$1'"
  • Get number of tuples deleted for a specified database
UserParameter=psql.db_deleted[*],psql -t -c "select tup_deleted from pg_stat_database where datname = '$1'"
  • Get number of commited/rolled back transactions for a specified database
select xact_commit from pg_stat_database where datname = '<dbname>'
select xact_rollback from pg_stat_database where datname = '<dbname>'
 
howto/monitor/db/postgresql.txt · Last modified: 2010/02/20 20:25 by yatesy
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki