I have a Linux host, which I successfully monitor with active agent2 via an active proxy with the "Linux by Zabbix agent active" template.
A PostreSQL database server runs on this linux host, which I would also like to monitor.
I started based on this:
I have successfully completed point 1 and point 2, so I have created zbx_user and modified pg_hba.conf.
With this command, I can access the database with zbx_user on the linux host:
On the Zabbix web interface, "Configuration", "Hosts", click on the linux host. "Templates", "Select", add "PostgreSQL by Zabbix agent 2"
On the "Macros" tab "Inherited and host macros".
I give {$PG.USER} the zbx_monitor and {$PG.PASSWORD} the zbx_monitor user password.
I also tried giving {$PG.URI} this: tcp://localhost:5432.
Unfortunately, Postgres monitoring does not work.
It writes this error message for Postgres items:
It writes similar error messages to the zabbix_agent2.log of the Linux host:
I tried leaving {$PG.URI} out of the macros, but the situation didn't change.
I can ping localhost:
And I can telnet also to the port 5432:
Zabbix version: 6.0.9
OS version: Almalinux 8.6
PostgreSQL version: 14.5
What could be the problem? What am I messing up?
A PostreSQL database server runs on this linux host, which I would also like to monitor.
I started based on this:
I have successfully completed point 1 and point 2, so I have created zbx_user and modified pg_hba.conf.
With this command, I can access the database with zbx_user on the linux host:
Code:
[root@test-zbx-db3 ~]# psql -Uzbx_monitor -W -p5432 -dpostgres Password: psql (14.5) Type "help" for help. postgres=>
On the Zabbix web interface, "Configuration", "Hosts", click on the linux host. "Templates", "Select", add "PostgreSQL by Zabbix agent 2"
On the "Macros" tab "Inherited and host macros".
I give {$PG.USER} the zbx_monitor and {$PG.PASSWORD} the zbx_monitor user password.
I also tried giving {$PG.URI} this: tcp://localhost:5432.
Unfortunately, Postgres monitoring does not work.
It writes this error message for Postgres items:
Code:
Connection failed: failed to connect to `host=localhost user=zbx_monitor database=postgres`: hostname resolving error (lookup localhost: device or resource busy).
Code:
2022/11/02 17:58:16.145707 [Postgres] Connection failed: failed to connect to `host=localhost user=zbx_monitor database=postgres`: hostname resolving error (lookup localhost: device or resource busy)
I can ping localhost:
Code:
[root@test-zbx-db3 ~]# ping localhost PING localhost (127.0.0.1) 56(84) bytes of data. 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.035 ms 64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.024 ms ^C --- localhost ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1047ms rtt min/avg/max/mdev = 0.024/0.029/0.035/0.007 ms [root@test-zbx-db3 ~]#
Code:
[root@test-zbx-db3 ~]# telnet localhost 5432 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. quit Connection closed by foreign host. [root@test-zbx-db3 ~]#
OS version: Almalinux 8.6
PostgreSQL version: 14.5
What could be the problem? What am I messing up?

Comment