rbicelli / pfsense-zabbix-template

Zabbix Template for pfSense
Apache License 2.0
246 stars 109 forks source link

Cannot create item: item with the same key "pfsense.value[service_value,captiveportal,status]" already exists. #6

Closed n4bs closed 4 years ago

n4bs commented 4 years ago

we have this 2 error messages in Services Discovery

Cannot create item: item with the same key "pfsense.value[service_value,captiveportal,run_on_carp_slave]" already exists. Cannot create item: item with the same key "pfsense.value[service_value,captiveportal,status]" already exists.

Maybe because my pfsense have 2 captive portal instances!

can anyone help me to change this and monitor 2 captive portal services?

Thanks in advanced. pfsense_zabbix_template_error

rbicelli commented 4 years ago

Hello! I've just made a commit where I added the testing function I used for developing the template. Please checkout it, then call it in a ssh shell without arguments:

php /path/to/script/pfsense_zbx.php

then post the result of "Services" section.

Thanks

n4bs commented 4 years ago

Hello!

with updated php script we have this putput

Services: Array ( [0] => Array ( [name] => lightsquid_web [rcfile] => lighttpd_ls.sh [executable] => lighttpd_ls [description] => Lightsquid Web Server )

[1] => Array
    (
        [name] => vmware-guestd
        [rcfile] => vmware-guestd.sh
        [custom_php_service_status_command] => mwexec("/usr/local/etc/rc.d/vmware-guestd status") == 0;
        [description] => VMware Guest Daemon
    )

[2] => Array
    (
        [name] => vmware-kmod
        [rcfile] => vmware-kmod.sh
        [custom_php_service_status_command] => mwexec("/usr/local/etc/rc.d/vmware-kmod status") == 0;
        [description] => VMware Kernel Modules
    )

[3] => Array
    (
        [name] => zabbix_agentd
        [rcfile] => zabbix_agentd.sh
        [executable] => zabbix_agentd
        [description] => Zabbix Agent Host Monitor Daemon
    )

[4] => Array
    (
        [name] => snort
        [rcfile] => snort.sh
        [executable] => snort
        [description] => Snort IDS/IPS Daemon
    )

[5] => Array
    (
        [name] => squid
        [rcfile] => squid.sh
        [executable] => squid
        [description] => Squid Proxy Server Service
    )

[6] => Array
    (
        [name] => clamd
        [rcfile] => clamd.sh
        [executable] => clamd
        [description] => ClamAV Antivirus
    )

[7] => Array
    (
        [name] => c-icap
        [rcfile] => c-icap.sh
        [executable] => c-icap
        [description] => ICAP Inteface for Squid and ClamAV integration
    )

[8] => Array
    (
        [name] => squidGuard
        [description] => Proxy server filter Service
        [executable] => squidGuard
    )

[9] => Array
    (
        [name] => pfb_dnsbl
        [rcfile] => pfb_dnsbl.sh
        [executable] => lighttpd_pfb
        [description] => pfBlockerNG DNSBL service
    )

[10] => Array
    (
        [name] => pfb_filter
        [rcfile] => pfb_filter.sh
        [executable] => php_pfb
        [description] => pfBlockerNG firewall filter service
    )

[11] => Array
    (
        [name] => radiusd
        [rcfile] => radiusd.sh
        [executable] => radiusd
        [description] => FreeRADIUS Server
    )

[12] => Array
    (
        [name] => dnsmasq
        [description] => DNS Forwarder
    )

[13] => Array
    (
        [name] => ntpd
        [description] => NTP clock sync
    )

[14] => Array
    (
        [name] => syslogd
        [description] => System Logger Daemon
    )

[15] => Array
    (
        [name] => captiveportal
        [zone] => bancosolguest
        [description] => Captive Portal: BancoSolGuest
    )

[16] => Array
    (
        [name] => captiveportal
        [zone] => bs_dti_consultores
        [description] => Captive Portal: BS_DTI_CONSULTORES
    )

[17] => Array
    (
        [name] => dhcpd
        [description] => DHCP Service
    )

[18] => Array
    (
        [name] => dpinger
        [description] => Gateway Monitoring Daemon
    )

[19] => Array
    (
        [name] => bsnmpd
        [description] => SNMP Service
    )

[20] => Array
    (
        [name] => sshd
        [description] => Secure Shell Daemon
    )

)

rbicelli commented 4 years ago

Please checkout the development branch, I added a fix for captive portal. Let me know if it works. Thanks

n4bs commented 4 years ago

i try to run but have errors

/root/scripts: php /root/scripts/pfsense_zbx.php

Parse error: syntax error, unexpected ')', expecting ']' in /root/scripts/pfsense_zbx.php on line 159

need to add ] in this line if (!empty($service['zone')) $id = "." . $service["zone"];

rbicelli commented 4 years ago

Please checkout another time, I've missed a square bracket :-P

n4bs commented 4 years ago

It's running OK

rbicelli commented 4 years ago

Do you mean that captive portal instances are correctly recognized?