ikzelf / zbxdb

Zabbix database monitoring, the easy and extendable way
GNU General Public License v3.0
94 stars 45 forks source link

problems with postgresql monitoring #35

Closed Rembok closed 4 years ago

Rembok commented 4 years ago

Hi

I download the latest version of zbxdb and try to check the postgres where my zabbix is running - but I get an error and don't know what it's about. Could you please help?

To Reproduce Steps to reproduce the behavior: 1.

[zbxdb]
db_url = xx.xxx.xxx.xxx:5432/zabbix
username = zabbix
password =
db_type = postgres
instance_type = rdbms
db_driver = psycopg2
role = normal
out_dir = $HOME/zbxdb_out
hostname = predix-mon-01
checks_dir = etc/zbxdb_checks
site_checks = NONE
sql_timeout = 3
password_enc = emFiYml4
  1. driver version

    Package      Version
    ------------ ----------
    certifi      2019.11.28
    cffi         1.14.0
    chardet      3.0.4
    cryptography 2.8
    cx-Oracle    7.3.0
    ibm-db       3.0.1
    idna         2.9
    ntlm-auth    1.4.0
    pip          20.0.2
    psycopg2     2.8.4
    pycparser    2.20
    PyMySQL      0.9.3
    pyOpenSSL    19.1.0
    pypsrp       0.4.0
    python-tds   1.10.0
    requests     2.23.0
    setuptools   39.0.1
    six          1.14.0
    sqlanydb     1.0.10
    sqlparse     0.3.1
    urllib3      1.25.8
  2. db version postgres (PostgreSQL) 11.6

logs

2020-03-23 15:16:02,224___main___50_problem
Traceback (most recent call last):
  File "/home/zbxdd/zbxdb/bin/zbxdb.py", line 404, in main
    connect_info = db_connections.connection_info(_conn)
  File "/home/zbxdd/zbxdb/bin/dbconnections/postgres.py", line 36, in connection_info
    conn_info['iname'] = _data[0]
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/zbxdd/zbxdb/bin/zbxdb.py", line 820, in <module>
    main()
  File "/home/zbxdd/zbxdb/bin/zbxdb.py", line 785, in main
    err_code, err_msg = driver_errors.db_errorcode(db_driver, dberr)
  File "/home/zbxdd/zbxdb/bin/drivererrors/psycopg2.py", line 8, in db_errorcode
    LOGGER.debug("db_errorcode %s %s\n", excep, excep.pgcode)
AttributeError: 'TypeError' object has no attribute 'pgcode'
ikzelf commented 4 years ago

Hi, I think that this query: select inet_server_addr()||':'||p.setting||':'|| d.setting from pg_settings p, pg_settings d where p.name = 'port' and d.name = 'data_directory'; is not returning data. Does your user zabbix have permission to read these items? What is the output of the query?

ikzelf commented 4 years ago

Did you get this any further?

Rembok commented 4 years ago

Yes, thank you. I`m sorry for delay. I just used a superuser, and those mistakes are gone.