ikzelf / zbxdb

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

ValueError when trying to run zbxdb.py #51

Closed ksalman closed 4 years ago

ksalman commented 4 years ago

Describe the bug I am trying to run zbxdb against the configuration file and it fails with ValueError

To Reproduce Steps to reproduce the behavior:

  1. cfg file obfuscate entries like address, username and password
    [zbxdb]
    db_url = //192.168.100.103/MSSQLSERVER
    username = zabbix
    password = zabbix
    db_type = mssql
    server = 192.168.100.103
    server_port = 1433
    db_name = master
    db_driver = pytds
    role = normal
    out_dir = $HOME/zbxdb_out
    hostname = testhost
    checks_dir = etc/zbxdb_checks
    site_checks = NONE
    cafile = $HOME/somecapemfile
    instance_type = rdbms
    password_enc = emFiYml4

Expected behavior No error

logs

~/zbxdb/zbxdb/bin/zbxdb.py -vc zbxdb.ms.cfg
Falling back to default logging config
WARNING:__main__:Changing loglevel from 20 to 10
DEBUG:__main__:log level 10
WARNING:__main__:start python-3.6.8 zbxdb-2.07 pid=24746 Connecting ...

WARNING:__main__:zbxdb found db_type=mssql, driver pytds; checking for driver

CRITICAL:__main__:problem
Traceback (most recent call last):
  File "/var/lib/zabbix/zbxdb/zbxdb/bin/zbxdb.py", line 832, in <module>
    main()
  File "/var/lib/zabbix/zbxdb/zbxdb/bin/zbxdb.py", line 315, in main
    " does not exist in the "+_config['checks_dir']+" directory")
ValueError: db_type mssql does not exist in the etc/zbxdb_checks directory

mssql /does/ exist in etc/zbxdb_checks

ls -l zbxdb_checks
total 4
drwxr-xr-x. 2 zabbix zabbix   27 Sep  2 19:40 cockroach
drwxr-xr-x. 2 zabbix zabbix   28 Sep  2 19:40 db2
drwxr-xr-x. 2 zabbix zabbix   72 Sep  2 19:52 mssql
drwxr-xr-x. 2 zabbix zabbix   48 Sep  2 19:40 mysql
drwxr-xr-x. 2 zabbix zabbix 4096 Sep  2 19:40 oracle
drwxr-xr-x. 2 zabbix zabbix  130 Sep  2 19:40 postgres
ikzelf commented 4 years ago

Could it be that there exist none printable characters in the db_type parameter value? Is the listed directory ~/zbxdb/etc/zbxdb_checks/ or is it ~/etc/zbxdb_checks/ ? The etc directory is taken relative to $ZBXDB_HOME, which default is $HOME.

ikzelf commented 4 years ago

Did you get this working?

ikzelf commented 4 years ago

I assume this works now.