Hi!
I have scratched my head the last couple of days trying to get the PostgreSQL plugin for agent2 to work.
We have a Zabbix server --> Active proxy --> Active agent setup
The agent config file:
hostname=db1.emil-systest1.domtst.se
Server=proxy1.zabbix1.mgmt.dom.se
ServerActive=proxy1.zabbix1.mgmt.dom.se
LogFile=/var/log/zabbix/zabbix_agent2.log
Include=/etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf
ControlSocket=/tmp/agent.sock
/etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf:
Path to external plugin executable.
#
# Mandatory: yes
# Default:
Plugins.PostgreSQL.System.Path=/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql
Everything else in this file default settings.
Template "PostgreSQL by Zabbix agent 2" is associated to the host together with template "Linux by Zabbix agent active".
The template "Linux by Zabbix agent active" is working and we are getting values from it.
We have the following macros for the Postgres template:
{$PG.DATABASE}=emil
{$PG.URI}=tcp://localhost:5432
{$PG.USER}=pgwatch2
{$PG.PASSWORD}=xxx
I can login with h=localhost via psql on the database server with user pgwatch2 without any problems.
pg_hba.conf for pgwatch2 looks like this:
# TYPE DATABASE USER ADDRESS METHOD
host all pgwatch2 localhost md5
ost all pgwatch2 127.0.0.1/32 md5
No Postgres data in Zabbix UI at all.
No visible errors in the UI.
No errors in the Zabbix Server, Zabbix Proxy or the Zabbix agent2 logfiles.
It's just like the postgresql monitoring does not take place at all.
Output from zabbix_agent2 -R metrics |grep pgsql.:
pgsql.archive: Returns info about size of archive files.
pgsql.autovacuum.count: Returns count of autovacuum workers.
pgsql.bgwriter: Returns JSON for sum of each type of bgwriter statistic.
pgsql.cache.hit: Returns cache hit percent.
pgsql.connections: Returns JSON for sum of each type of connection.
pgsql.custom.query: Returns result of a custom query.
pgsql.db.age: Returns age for specific database.
pgsql.db.bloating_tables: Returns percent of bloating tables for each database.
pgsql.db.discovery: Returns JSON discovery rule with names of databases.
pgsql.db.size: Returns size in bytes for specific database.
pgsql.dbstat: Returns JSON for sum of each type of statistic.
pgsql.dbstat.sum: Returns JSON for sum of each type of statistic for all database.
pgsql.locks: Returns collect all metrics from pg_locks.
pgsql.oldest.xid: Returns age of oldest xid.
pgsql.ping: Tests if connection is alive or not.
pgsql.queries: Returns queries statistic.
pgsql.replication.count: Returns number of standby servers.
pgsql.replication.lag.b: Returns replication lag with Master in byte.
pgsql.replication.lag.sec: Returns replication lag with Master in seconds.
pgsql.replication.process: Returns flush lag, write lag and replay lag per each sender process.
pgsql.replication.process.discovery: Returns JSON with application name from pg_stat_replication.
pgsql.replication.recovery_role: Returns postgreSQL recovery role.
pgsql.replication.status: Returns postgreSQL replication status.
pgsql.uptime: Returns uptime.
pgsql.wal.stat: Returns JSON wal by type.
At startup of agent2 I can see in the logfile that the PostgreSQL plugin is loaded:
023/05/10 10:46:57.530411 using plugin 'PostgreSQL' (/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql) providing following interfaces: exporter, runner, configurator
Does anyone have a clue about why this is not working?
/Regards
/Rickard Hökros
I have scratched my head the last couple of days trying to get the PostgreSQL plugin for agent2 to work.
We have a Zabbix server --> Active proxy --> Active agent setup
The agent config file:
hostname=db1.emil-systest1.domtst.se
Server=proxy1.zabbix1.mgmt.dom.se
ServerActive=proxy1.zabbix1.mgmt.dom.se
LogFile=/var/log/zabbix/zabbix_agent2.log
Include=/etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf
ControlSocket=/tmp/agent.sock
/etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf:
Path to external plugin executable.
#
# Mandatory: yes
# Default:
Plugins.PostgreSQL.System.Path=/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql
Everything else in this file default settings.
Template "PostgreSQL by Zabbix agent 2" is associated to the host together with template "Linux by Zabbix agent active".
The template "Linux by Zabbix agent active" is working and we are getting values from it.
We have the following macros for the Postgres template:
{$PG.DATABASE}=emil
{$PG.URI}=tcp://localhost:5432
{$PG.USER}=pgwatch2
{$PG.PASSWORD}=xxx
I can login with h=localhost via psql on the database server with user pgwatch2 without any problems.
pg_hba.conf for pgwatch2 looks like this:
# TYPE DATABASE USER ADDRESS METHOD
host all pgwatch2 localhost md5
ost all pgwatch2 127.0.0.1/32 md5
No Postgres data in Zabbix UI at all.
No visible errors in the UI.
No errors in the Zabbix Server, Zabbix Proxy or the Zabbix agent2 logfiles.
It's just like the postgresql monitoring does not take place at all.
Output from zabbix_agent2 -R metrics |grep pgsql.:
pgsql.archive: Returns info about size of archive files.
pgsql.autovacuum.count: Returns count of autovacuum workers.
pgsql.bgwriter: Returns JSON for sum of each type of bgwriter statistic.
pgsql.cache.hit: Returns cache hit percent.
pgsql.connections: Returns JSON for sum of each type of connection.
pgsql.custom.query: Returns result of a custom query.
pgsql.db.age: Returns age for specific database.
pgsql.db.bloating_tables: Returns percent of bloating tables for each database.
pgsql.db.discovery: Returns JSON discovery rule with names of databases.
pgsql.db.size: Returns size in bytes for specific database.
pgsql.dbstat: Returns JSON for sum of each type of statistic.
pgsql.dbstat.sum: Returns JSON for sum of each type of statistic for all database.
pgsql.locks: Returns collect all metrics from pg_locks.
pgsql.oldest.xid: Returns age of oldest xid.
pgsql.ping: Tests if connection is alive or not.
pgsql.queries: Returns queries statistic.
pgsql.replication.count: Returns number of standby servers.
pgsql.replication.lag.b: Returns replication lag with Master in byte.
pgsql.replication.lag.sec: Returns replication lag with Master in seconds.
pgsql.replication.process: Returns flush lag, write lag and replay lag per each sender process.
pgsql.replication.process.discovery: Returns JSON with application name from pg_stat_replication.
pgsql.replication.recovery_role: Returns postgreSQL recovery role.
pgsql.replication.status: Returns postgreSQL replication status.
pgsql.uptime: Returns uptime.
pgsql.wal.stat: Returns JSON wal by type.
At startup of agent2 I can see in the logfile that the PostgreSQL plugin is loaded:
023/05/10 10:46:57.530411 using plugin 'PostgreSQL' (/usr/sbin/zabbix-agent2-plugin/zabbix-agent2-plugin-postgresql) providing following interfaces: exporter, runner, configurator
Does anyone have a clue about why this is not working?
/Regards
/Rickard Hökros
zabbix_get does not care of your agent type..
Comment