zabbix-tools / libzbxpgsql

Monitor PostgreSQL with Zabbix
http://cavaliercoder.com/libzbxpgsql/
Other
158 stars 65 forks source link

Macro's not taking affect? #104

Open linux-guy-217 opened 7 years ago

linux-guy-217 commented 7 years ago

To the best of my knowledge, I have configured everything correctly with regards to the template and OS macros.

PG_CONN is set on the template macros to 'user=monitoring,postgres' PG_CONN is set on the DB host in zabbix to 'host=localhost user=monitoring connect_timeout=10' PG_DB is set on the DB host to the database I would like to monitor

I can run ad-hoc commands and returns data: sudo -u zabbix zabbix_agentd -t pg.db.numbackends[user=monitoring,postgres] zabbix_agentd [80508]: starting agent module libzbxpgsql 1.1.0 zabbix_agentd [80508]: using module configuration file: /etc/zabbix/libzbxpgsql.conf pg.db.numbackends[user=monitoring,postgres] [u|26]

However, if I try to run sudo -u zabbix zabbix-agent -p all of the pg items return an error from PSQL that the zabbix role does not exist.

[m|ZBX_NOTSUPPORTED] [FATAL: role "zabbix" does not exist] zabbix_agentd [80529]: Error: PostgreSQL: FATAL: role "zabbix" does not exist

In my mapping, I have set up zabbix to map to monitoring: TYPE DATABASE USER ADDRESS METHOD local all monitoring peer map=monitoring

MAPNAME SYSTEM-USERNAME PG-USERNAME monitoring zabbix monitoring

The zabbix-agent runs as zabbix on the database server, and is all local.

It almost feels like to me that the zabbix agent is not taking into account the macros that are set?

Any guidance would be much appreciated.

DB Server OS: Ubuntu 16 Zabbix Server & Agent: 3.2 PostgreSQL: 9.5

linux-guy-217 commented 7 years ago

So, I think I have made some progress here, but still looking for some assistance. It turns out I did not have any of the Active Checks parameters set up.

But now I am getting an error about name resolution.

1732:20170901:221837.968 item "HOST_NAME:pg.buffers_backend_fsync[{$PG_CONN},{$PG_DB}]" became not supported: could not translate host name "HOST_NAME,user=monitoring,connect_timeout=10" to address: Temporary failure in name resolution