zabbix_ipsec_pfsense icon indicating copy to clipboard operation
zabbix_ipsec_pfsense copied to clipboard

Error When Execute zabbix-ipsec.py

Open vinicaires opened this issue 4 years ago • 9 comments

When I call zabbix-ipsec.py script over "zabbix_get -s xxx.xxx.xxx.xxx -k ipsec.discover", I receive next error:

Traceback (most recent call last): File "/usr/local/bin/zabbix-ipsec.py", line 109, in ret = getPayload() File "/usr/local/bin/zabbix-ipsec.py", line 104, in getPayload if conf[-1] == ',': IndexError: string index out of range

I discovered the issue when checking the discovery rules for the host there is an error: "Value should be a JSON object." I use Python 3.7 and ZabbixAgentd 4.0.17. My pfSense version is 2.4.5-RELEASE-p1 (amd64)

You could help me?

Thanks!

vinicaires avatar Dec 15 '20 22:12 vinicaires

the script is Python 2.7, Opnsense have only Python 3.7.9

Python 3.7.9 (default, Oct 20 2020, 22:48:05)
[Clang 8.0.1 (tags/RELEASE_801/final 366581)] on freebsd12
Type "help", "copyright", "credits" or "license" for more information.
>>>

valireality avatar Apr 06 '21 10:04 valireality

Solved:

https://github.com/smejdil/zabbix_ipsec_pfsense/blob/master/scripts/zabbix-ipsec.py

everaldoscabral avatar May 07 '21 13:05 everaldoscabral

Hi, Has anybody tried this on OPNSense firewall for VPN Monitoring ? Thanks ,Hemant

K3Hemant avatar Aug 12 '21 09:08 K3Hemant

No, still not working:

Invalid discovery rule value: cannot parse as a valid JSON object: invalid object format, expected opening character '{' or '[' at: 'Traceback (most recent call last): File "/usr/local/bin/zabbix-ipsec.py", line 126, in <module> ret = getPayload() File "/usr/local/bin/zabbix-ipsec.py

valireality avatar Aug 19 '21 08:08 valireality

@vinicaires @valireality I just fix some erros on zabbix-ipsec.py. Can you try the new script? Please, let me know if is working fine.

alanwds avatar Aug 25 '21 13:08 alanwds

Hi, I have the same issue even if I use your new script. I use pfsense 2.5.2 with python3.8, I just modify the first line of your script to use it.

Traceback (most recent call last):
  File "/usr/local/bin/zabbix-ipsec.py", line 126, in <module>
    ret = getPayload()
  File "/usr/local/bin/zabbix-ipsec.py", line 121, in getPayload
    if conf[-1] == ',':
IndexError: string index out of range

EDIT : I don't use the correct path for IPSEC_CONF. I replace it by IPSEC_CONF = '/var/etc/ipsec/swanctl.conf' but I have always the same issue.

MrDuRadis avatar Sep 29 '21 09:09 MrDuRadis

I have this issue with the python 3.8 version.. did anyone manage to solve the problem?

lbrodrigues avatar Mar 09 '22 18:03 lbrodrigues

Hello,

Has anyone found a solution to the problem?

Traceback (most recent call last): File "/usr/local/bin/zabbix-ipsec.py", line 126, in ret = getPayload() File "/usr/local/bin/zabbix-ipsec.py", line 107, in getPayload data = parseConf().items() File "/usr/local/bin/zabbix-ipsec.py", line 72, in parseConf m = m.group(0) AttributeError: 'NoneType' object has no attribute 'group'

jankyk avatar Apr 14 '23 13:04 jankyk

Hi @jankyk

It is working for me on the latest pfsense version : https://github.com/ecarat237/zabbix_ipsec_pfsense

ecarat237 avatar Apr 14 '23 13:04 ecarat237