jbfavre / python-protobix

Very simple python module implementing Zabbix Sender protocol.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parsing failed with several errors.

syphernl opened this issue · comments

commented

Running protobix with it automatically reading the zabbix_agentd.conf results in traceback:

Traceback (most recent call last):
  File "./aamv2.py", line 168, in <module>
    ret = AAMv2().run()
  File "/usr/local/lib/python2.7/dist-packages/protobix/sampleprobe.py", line 281, in run
    self.zbx_config = self._init_config()
  File "/usr/local/lib/python2.7/dist-packages/protobix/sampleprobe.py", line 204, in _init_config
    zbx_config = ZabbixAgentConfig(self.options.config_file)
  File "/usr/local/lib/python2.7/dist-packages/protobix/zabbixagentconfig.py", line 56, in __init__
    tmp_config = configobj.ConfigObj(config_file, list_values=False)
  File "/usr/lib/python2.7/dist-packages/configobj.py", line 1229, in __init__
    self._load(infile, configspec)
  File "/usr/lib/python2.7/dist-packages/configobj.py", line 1318, in _load
    raise error
configobj.ConfigObjError: Parsing failed with several errors.
First error at line 202.

Line 202 of the /etc/zabbix/zabbix_agentd.conf is a userparameter:

UserParameter=updates.count.security,/usr/lib/update-notifier/apt-check 2>&1 | cut -d ';' -f 2

This is actually the second userparameter in the file. If I uncomment this particular line (the 2nd), the next one complain and so on. Parsing only completes whenever all UserParameters have been commented out.

Hello,
Thanks for the report.
Could you please give me the protobix version you're using ?

commented

@jbfavre That would be 1.0.0

Thanks for the information, I will investigate it ASAP.
In the meantime, you can move UserParameter options in separate file in /etc/zabbix/zabbix_agentd.conf.d/my_user_param.conf and use Include options in zabbix_agentd.conf:

#	You may include individual files or all files in a directory in the configuration file.
#	Installing Zabbix will create include directory in /etc/zabbix, unless modified during the compile time.
#
# Mandatory: no
# Default:
Include=/etc/zabbix/zabbix_agentd.conf.d/*.conf```

@jbfavre I have that problem:

Traceback (most recent call last):
  File "neolane.py", line 118, in <module>
    extract_and_send_metrics()
  File "neolane.py", line 111, in extract_and_send_metrics
    send_metrics('lld', metrics)
  File "neolane.py", line 40, in send_metrics
    config = protobix.ZabbixAgentConfig(config_file=zabbix_conf)
  File "/home/kevin/.virtualenvs/kevin/local/lib/python2.7/site-packages/protobix/zabbixagentconfig.py", line 56, in __init__
    tmp_config = configobj.ConfigObj(config_file, list_values=False)
  File "/home/kevin/.virtualenvs/kevin/local/lib/python2.7/site-packages/configobj.py", line 1229, in __init__
    self._load(infile, configspec)
  File "/home/kevin/.virtualenvs/kevin/local/lib/python2.7/site-packages/configobj.py", line 1318, in _load
    raise error
configobj.DuplicateError: Duplicate keyword name at line 309.

It is because I have two same directives in Zabbix my config file:
LoadModule=zabbix_module_docker.so
LoadModule=libzbxpgsql.so

But it is allowed in Zabbix. Can you fix it, please ? Thanks in advance.