adubkov/py-zabbix

Error using py-zabbix with python 3

jschaeff opened this issue · 1 comments

Hi,

thanks for your work on this very usefull API.
I'm porting some monitoring code from python 2 to python 3, and I get this error only when executing the script with python 3:

configparser.DuplicateOptionError: While reading from '<???>' [line 300]: option 'userparameter' in section 'root' already exists

My zabbix-agent.conf is fine as for zabbix-agent. I don't see any warning or error on his side. As a matter of fact, on line 300, appears the second "UserParameter" option on my config file.
The documentation says "there can be several UserParameter in the file" : https://www.zabbix.com/documentation/3.4/manual/appendix/config/zabbix_agentd

I could'nt find anything on the web about this problem, hence this issue post.

Thanks for your help !

A quick and dirty hack would be to use the "strict=False" option from configparser:

https://docs.python.org/3/library/configparser.html#customizing-parser-behaviour

This may be acceptable, because we rely on zabbix-agent to check for the configuration validity. So than unwanted multiple options are unlikely.