Ad Widget

Collapse

zabbix-agent2 postgresql не подключается по данным макросов

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • e.repin
    Junior Member
    • Feb 2021
    • 3

    #1

    zabbix-agent2 postgresql не подключается по данным макросов

    Добрый день
    пробуем перейти на мониторинг Postgresql zabbix-agent2, настраивали макросы наследуемые из шаблона в соответствии с документацией

    zabbix-gent2.conf всё по умолчанию кроме таймаута и адреса сервера
    правило обнаружения выдает ошибку не поддерживается:

    Connection failed: failed to connect to `host=localhost user=postgres database=postgres`: dial error (dial tcp [::1]:5432: connect: connection refused).
    Подскажите в какую сторону копать, почему правило обнаружения пытается стучаться по стандартному порту?
  • e.repin
    Junior Member
    • Feb 2021
    • 3

    #2
    Неужели у всех всё работает? И я один с таким столкнулся?

    Comment

    • shkiper
      Senior Member
      • Mar 2016
      • 123

      #3
      вообще он говорит (скорее всего), что нет конфы доступа в файле pg_hba.conf для пользователя postgres ломящегося по сети localhost по ipv6 (кстати) по порту 5432
      постгрес точно на 5433 висит?
      Last edited by shkiper; 25-02-2021, 07:59.

      Comment


      • e.repin
        e.repin commented
        Editing a comment
        Да точно висит на 5433. В pg_hba.conf согласно документации:
        host all zbx_monitor 127.0.0.1/32 trust
        host all zbx_monitor 0.0.0.0/0 md5
        host all zbx_monitor ::0/0 md5
        никаких ошибок доступа в логах постгри нет
    • shkiper
      Senior Member
      • Mar 2016
      • 123

      #4
      ну так-то юзеры разные однако, в ошибке user=postgres, в hba_conf - zbx_monitor, да и порт тоже
      если в макросах zbx_monitor и порт правильный указаны, то похоже заббикс почему то использует значения по умолчанию, похоже что заббикс макросы не видит


      Last edited by shkiper; 03-03-2021, 10:58.

      Comment

      • e.repin
        Junior Member
        • Feb 2021
        • 3

        #5
        Originally posted by shkiper
        ну так-то юзеры разные однако, в ошибке user=postgres, в hba_conf - zbx_monitor, да и порт тоже
        если в макросах zbx_monitor и порт правильный указаны, то похоже заббикс почему то использует значения по умолчанию, похоже что заббикс макросы не видит

        А как это можно обойти? Неужели ни у кого постгря на нестандартных портах не висит?

        Comment

        • a.l.r.e
          Member
          • May 2021
          • 45

          #6
          Столкнулся с тем же самым.
          Включил DebugLevel=5 в zabbix_agent2.conf
          Получил
          Code:
          2021/05/30 14:55:12.633994 received passive check request: 'pgsql.archive["tcp://u20d1h3:5433","zbx_monitor","P@ssw0rd"]' from '172.27.172.130'
          2021/05/30 14:55:12.634054 [1] processing update request (1 requests)
          2021/05/30 14:55:12.634071 [1] adding new request for key: 'pgsql.archive["tcp://u20d1h3:5433","zbx_monitor","P@ssw0rd"]'
          2021/05/30 14:55:12.634082 [1] created direct exporter task for plugin 'Postgres' itemid:0 key 'pgsql.archive["tcp://u20d1h3:5433","zbx_monitor","P@ssw0rd"]'
          2021/05/30 14:55:12.634122 executing direct exporter task for key 'pgsql.archive["tcp://u20d1h3:5433","zbx_monitor","P@ssw0rd"]'
          2021/05/30 14:55:12.645322 [Postgres] Cannot fetch data: ERROR: must be superuser to get directory listings (SQLSTATE 42501).
          2021/05/30 14:55:12.645342 failed to execute direct exporter task for key 'pgsql.archive["tcp://u20d1h3:5433","zbx_monitor","P@ssw0rd"]' error: 'Cannot fetch data: ERROR: must be superuser to get directory listings (SQLSTATE 42501).'
          2021/05/30 14:55:12.645376 sending passive check response: ZBX_NOTSUPPORTED: 'Cannot fetch data: ERROR: must be superuser to get directory listings (SQLSTATE 42501).' to '172.27.172.130'
          2021/05/30 14:55:15.641870 received passive check request: 'pgsql.cache.hit["tcp://u20d1h3:5433"]' from '172.27.172.130'
          2021/05/30 14:55:15.641948 [1] processing update request (1 requests)
          2021/05/30 14:55:15.641971 [1] adding new request for key: 'pgsql.cache.hit["tcp://u20d1h3:5433"]'
          2021/05/30 14:55:15.641979 [1] created direct exporter task for plugin 'Postgres' itemid:0 key 'pgsql.cache.hit["tcp://u20d1h3:5433"]'
          2021/05/30 14:55:15.642009 executing direct exporter task for key 'pgsql.cache.hit["tcp://u20d1h3:5433"]'
          2021/05/30 14:55:15.645130 [Postgres] Connection failed: failed to connect to `host=u20d1h3 user=postgres database=postgres`: server error (FATAL: password authentication failed for user "postgres" (SQLSTATE 28P01)).
          2021/05/30 14:55:15.645161 failed to execute direct exporter task for key 'pgsql.cache.hit["tcp://u20d1h3:5433"]' error: 'Connection failed: failed to connect to `host=u20d1h3 user=postgres database=postgres`: server error (FATAL: password authentication failed for user "postgres" (SQLSTATE 28P01)).'
          2021/05/30 14:55:15.645203 sending passive check response: ZBX_NOTSUPPORTED: 'Connection failed: failed to connect to `host=u20d1h3 user=postgres database=postgres`: server error (FATAL: password authentication failed for user "postgres" (SQLSTATE 28P01)).' to '172.27.172.130'
          2021/05/30 14:55:16.643492 received passive check request: 'pgsql.oldest.xid["tcp://u20d1h3:5433","zbx_monitor"]' from '172.27.172.130'
          2021/05/30 14:55:16.643545 [1] processing update request (1 requests)
          2021/05/30 14:55:16.643561 [1] adding new request for key: 'pgsql.oldest.xid["tcp://u20d1h3:5433","zbx_monitor"]'
          2021/05/30 14:55:16.643569 [1] created direct exporter task for plugin 'Postgres' itemid:0 key 'pgsql.oldest.xid["tcp://u20d1h3:5433","zbx_monitor"]'
          2021/05/30 14:55:16.643600 executing direct exporter task for key 'pgsql.oldest.xid["tcp://u20d1h3:5433","zbx_monitor"]'
          2021/05/30 14:55:16.646462 [Postgres] Connection failed: failed to connect to `host=u20d1h3 user=zbx_monitor database=postgres`: server error (FATAL: password authentication failed for user "zbx_monitor" (SQLSTATE 28P01)).
          2021/05/30 14:55:16.646484 failed to execute direct exporter task for key 'pgsql.oldest.xid["tcp://u20d1h3:5433","zbx_monitor"]' error: 'Connection failed: failed to connect to `host=u20d1h3 user=zbx_monitor database=postgres`: server error (FATAL: password authentication failed for user "zbx_monitor" (SQLSTATE 28P01)).'
          2021/05/30 14:55:16.646594 sending passive check response: ZBX_NOTSUPPORTED: 'Connection failed: failed to connect to `host=u20d1h3 user=zbx_monitor database=postgres`: server error (FATAL: password authentication failed for user "zbx_monitor" (SQLSTATE 28P01)).' to '172.27.172.130'
          2021/05/30 14:55:16.648017 [1] processing update request (1 requests)
          2021/05/30 14:55:17.648822 received passive check request: 'pgsql.replication.process["tcp://u20d1h3:5433","zbx_monitor","P@ssw0rd"]' from '172.27.172.130'
          2021/05/30 14:55:17.648877 [1] processing update request (1 requests)
          2021/05/30 14:55:17.648894 [1] adding new request for key: 'pgsql.replication.process["tcp://u20d1h3:5433","zbx_monitor","P@ssw0rd"]'
          2021/05/30 14:55:17.648902 [1] created direct exporter task for plugin 'Postgres' itemid:0 key 'pgsql.replication.process["tcp://u20d1h3:5433","zbx_monitor","P@ssw0rd"]'
          2021/05/30 14:55:17.648932 executing direct exporter task for key 'pgsql.replication.process["tcp://u20d1h3:5433","zbx_monitor","P@ssw0rd"]'
          2021/05/30 14:55:17.649596 executed direct exporter task for key 'pgsql.replication.process["tcp://u20d1h3:5433","zbx_monitor","P@ssw0rd"]'
          2021/05/30 14:55:17.649634 sending passive check response: '' to '172.27.172.130'
          Похоже, что подключения идут не только с параметрами заданными в macros хоста,
          но и с теми, что указаны в template "PostgreSQL Agent 2"

          Comment

          • dedy
            Senior Member
            • Sep 2018
            • 203

            #7

            (FATAL: password authentication failed for user "zbx_monitor"

            у вас тут явно что в pg_hba не правильно указано

            Comment

            • a.l.r.e
              Member
              • May 2021
              • 45

              #8
              Если бы было так, то не возникло бы

              2021/05/30 14:55:12.645376 sending passive check response: ZBX_NOTSUPPORTED: 'Cannot fetch data: ERROR: must be superuser to get directory listings (SQLSTATE 42501).' to '172.27.172.130'

              Т.е. подключение прошло (когда используется "tcp://u20d1h3:5433","zbx_monitor","P@ssw0rd"), но не хватило прав.

              А вот откуда возникло

              2021/05/30 14:55:15.645161 failed to execute direct exporter task for key 'pgsql.cache.hit["tcp://u20d1h3:5433"]' error: 'Connection failed: failed to connect to `host=u20d1h3 user=postgres database=postgres`: server error (FATAL: password authentication failed for user "postgres" (SQLSTATE 28P01)).'

              ?

              Это больше похоже на discovery.

              Comment

              • dedy
                Senior Member
                • Sep 2018
                • 203

                #9
                посмотрите какие макросы подставляются в правилах дисковеринга и попробуйте запросить их вручную

                Comment

                • a.l.r.e
                  Member
                  • May 2021
                  • 45

                  #10
                  Вот эти items были unsupported, я их сделал disabled, ошибки ушли.
                  Click image for larger version

Name:	items.png
Views:	1120
Size:	285.4 KB
ID:	425750
                  Caption
                  На другом zabbix сервере той же версии на хосте с теми же шаблонами этих items нет.

                  Comment

                  • a.l.r.e
                    Member
                    • May 2021
                    • 45

                    #11
                    дистрибутив один и тот же



                    zabbix/zabbix-server-pgsql:ubuntu-5.2-latest

                    Comment

                    Working...