Ad Widget

Collapse

Template DB PostgreSQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jvlavl
    Member
    • Sep 2015
    • 37

    #1

    Template DB PostgreSQL

    Hello,

    Can someone help me with this issue.

    I want to monitor my Postgressql database server which is running on version 11

    I'm running Zabbix server version 5.0.1
    On the server that is running Postgress the agent is version 4.0.11

    I followed the guideline in this link https://www.zabbix.com/integrations/postgresql

    Copied the postgresql folder including all the .sql files to /var/lib/zabbix/postgresql/
    placed the template_db_postgresql.conf as userparameter_postgresql.conf in /etc/zabbix/zabbix_agentd.d/
    restarted the agent.

    cat /etc/zabbix/zabbix_agentd.d/userparameter_postgresql.conf
    UserParameter=pgsql.bgwriter[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.bgwriter.sql"
    UserParameter=pgsql.connections.sum[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.connections.sum.sql"
    UserParameter=pgsql.connections[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.connections.sql"
    UserParameter=pgsql.connections.prepared[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.connections.prepared.sql"
    UserParameter=pgsql.dbstat.sum[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.dbstat.sum.sql"
    UserParameter=pgsql.dbstat[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.dbstat.sql"
    UserParameter=pgsql.transactions[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.transactions.sql"
    UserParameter=pgsql.config.hash[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.config.hash.sql"
    UserParameter=pgsql.wal.stat[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.wal.stat.sql"
    UserParameter=pgsql.locks[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.locks.sql"
    UserParameter=pgsql.queries[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -v tmax=$5 -f "/var/lib/zabbix/postgresql/pgsql.query.time.sql"
    UserParameter=pgsql.uptime[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.uptime.sql"
    UserParameter=pgsql.cache.hit[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.cache.hit.sql"
    UserParameter=pgsql.scans[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.scans.sql"
    UserParameter=pgsql.frozenxid[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.frozenxid.sql"
    UserParameter=pgsql.discovery.db[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.discovery.db.sql"
    UserParameter=pgsql.db.size[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -c "SELECT pg_database_size('$5')"
    UserParameter=pgsql.ping[*], pg_isready -h "$1" -p "$2" -U "$3" -d "$4"
    UserParameter=pgsql.ping.time[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.ping.time.sql"
    UserParameter=pgsql.version[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -c "SELECT version();"
    UserParameter=pgsql.replication.count[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -c "SELECT count(*) FROM pg_stat_replication"
    UserParameter=pgsql.replication.recovery_role[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.replication.recovery_role.sql"
    UserParameter=pgsql.replication.lag.sec[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.replication.lag.sql"
    UserParameter=pgsql.replication.status[*], psql -qtAX -h "$1" -p "$2" -U "$3" -d "$4" -f "/var/lib/zabbix/postgresql/pgsql.replication.status.sql"

    but data is not retrieved I get the following errors
    see attached screenshot

    doing the zabbix_get command give the following output on the zabbix server

    zabbix_get -s 10.x.x.x -k pgsql.wal.stat["127.0.0.1","5432","zabbix","postgres"]
    ZBX_NOTSUPPORTED: Unsupported item key.

    on the monitored host I get the following
    2 Requested [pgsql.wal.stat[127.0.0.1,5432,zabbix,postgres]]

    /var/lib/zabbix/postgresql]#
    total 84
    drwxr-xr-x 2 root root 4096 Jun 30 08:52 .
    drwxr-xr-x 3 root root 23 Jun 30 08:36 ..
    -rw-r--r-- 1 root root 492 Jun 30 08:40 pgsql.bgwriter.sql
    -rw-r--r-- 1 root root 81 Jun 30 08:40 pgsql.cache.hit.sql
    -rw-r--r-- 1 root root 371 Jun 30 08:41 pgsql.config.hash.sql
    -rw-r--r-- 1 root root 43 Jun 30 08:42 pgsql.connections.prepared.sql
    -rw-r--r-- 1 root root 1367 Jun 30 08:43 pgsql.connections.sql
    -rw-r--r-- 1 root root 1357 Jun 30 08:44 pgsql.connections.sum.sql
    -rw-r--r-- 1 root root 314 Jun 30 08:45 pgsql.dbstat.sql
    -rw-r--r-- 1 root root 549 Jun 30 08:45 pgsql.dbstat.sum.sql
    -rw-r--r-- 1 root root 236 Jun 30 08:46 pgsql.discovery.db.sql
    -rw-r--r-- 1 root root 510 Jun 30 08:47 pgsql.frozenxid.sql
    -rw-r--r-- 1 root root 1297 Jun 30 08:47 pgsql.locks.sql
    -rw-r--r-- 1 root root 18 Jun 30 08:48 pgsql.ping.time.sql
    -rw-r--r-- 1 root root 3256 Jun 30 08:48 pgsql.query.time.sql
    -rw-r--r-- 1 root root 735 Jun 30 08:49 pgsql.replication.lag.sql
    -rw-r--r-- 1 root root 32 Jun 30 08:49 pgsql.replication.recovery_role.sql
    -rw-r--r-- 1 root root 490 Jun 30 08:50 pgsql.replication.status.sql
    -rw-r--r-- 1 root root 259 Jun 30 08:51 pgsql.scans.sql
    -rw-r--r-- 1 root root 1425 Jun 30 08:51 pgsql.transactions.sql
    -rw-r--r-- 1 root root 67 Jun 30 08:52 pgsql.uptime.sql
    -rw-r--r-- 1 root root 702 Jun 30 08:52 pgsql.wal.stat.sql

    Can anyone help me getting this going?

    Thanks

    Attached Files
Working...