A
A
Alexey Burlakov2019-07-14 17:53:38
PostgreSQL
Alexey Burlakov, 2019-07-14 17:53:38

How to enable zabbix monitoring of postgres running with docker-compose?

I recently started learning zabbix. To immediately be "as it should", I decided to configure and install as part of the docker-compose assembly. The local zabbix server and the remote zabbix agent work fine, all data is collected and displayed.
I wanted to further connect the monitoring of the PostgreSQL database, located on the same host as the zabbix server.
Everything is running via docker-compose.
I followed the guide from here: https://habr.com/ru/post/234481/
that is, I took the files from the repository https://github.com/lesovsky/zabbix-extensions/
for the zabbix agent, placed them in the right folder - that's all works, UserParameter'y were added.
Stuck on step:

zabbix-get -s 127.0.0.1 -k pgsql.ping['-h 127.0.0.1 -p 5432 -U postgres -d mydb']

(I left the ip and database name as in the example, I used the correct ones, there are no problems with this).
And the problem is that the zabbix-agent service (from which docker-compose) does not contain psql.
Accordingly, it cannot correctly execute UserParameter "pgsql.ping" , which accesses psql.
The question is how to make it so that psql contained in the db container is called from the zabbix-agent container?
(tried to dig towards /var/run/docker.sock, but never figured out how to be able to execute the OS host program from inside the docker container)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel Zamyatin, 2019-07-15
@redflasher

The question is how to make it so that psql contained in the db container is called from the zabbix-agent container?

No way. That's the point of isolating into separate containers. If you need psql in the container with zabbix-agent, then create a custom image from the Dockerfile based on the existing one and install psql there.

V
Vitaly Karasik, 2019-07-15
@vitaly_il1

I wanted to further connect the monitoring of the PostgreSQL database located on the same host as the zabbix server

If I understand the question correctly, then you need to install zabbix-agent on the host where PostgreSQL is.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question