rbicelli / pfsense-zabbix-template

Zabbix Template for pfSense
Apache License 2.0
242 stars 107 forks source link

Zabbix 5.0 and PFSense 2.4 #48

Closed ScooterNC closed 3 years ago

ScooterNC commented 4 years ago

I have followed your instructions and used the Zabbix Agent 5.0 on PFSense. I cannot get it to work. If I use the FreeBSD, it connects.

rbicelli commented 4 years ago

Please check issue #26.

ScooterNC commented 4 years ago

I did check that issue before opening this one. Why did you close this?

rbicelli commented 4 years ago

Why did you close this?

Sorry, pushed close and comment instead of Comment.

Please double-check the configuration and post details (screenshots, log, cli results) if you're seeking help.

ScooterNC commented 4 years ago

No worries. I have doubled check everything and it follows the instructions. I will get you the screenshots and captures

ScooterNC commented 4 years ago
Zabbix FreeBSD PFSense Agent 3 PFSense Agent 2 PFSense Agent Zabbix pfsense active

Here are the screenshots. The FreeBSD one shows connection is good so it is something else

rbicelli commented 4 years ago

Have you tried to run the php script via pfsense cli? Does it execute without errors?

ScooterNC commented 4 years ago

I get permission denied. Any ideas? I am logged in as admin

ScooterNC commented 4 years ago

I had to change the permissions of the file and now I get: ./pfsense_zbx.php: cannot open ?php: No such file or directory ./pfsense_zbx.php: /COPYRIGHT: Permission denied ./pfsense_zbx.php: pfsense_zbx.php: not found ./pfsense_zbx.php: Version: not found ./pfsense_zbx.php: 6: Syntax error: newline unexpected (expecting word)

rbicelli commented 4 years ago

You need to login as root via ssh or in console.

ScooterNC commented 4 years ago

I am logged in as root, same issue.

./pfsense_zbx.php: cannot open ?php: No such file or directory ./pfsense_zbx.php: /COPYRIGHT: Permission denied ./pfsense_zbx.php: pfsense_zbx.php: not found ./pfsense_zbx.php: Version: not found ./pfsense_zbx.php: 6: Syntax error: newline unexpected (expecting word)

rbicelli commented 4 years ago

try:

/usr/local/bin/php ./pfsense_zbx.php

ScooterNC commented 4 years ago

I would ask that once we figure this out if we can delete the posts with my info in it that would be great

rbicelli commented 4 years ago

It seems is quite ok. Did you put the script in /root/scripts directory? If the script is in another directory you have to adjust the settings in zabbix agent configuration.

Check the zabbix agent logs also.

ScooterNC commented 4 years ago

it is there:

[2.4.5-RELEASE][root@firewall.kreitler.us]/root/scripts: ls pfsense_zbx.php [2.4.5-RELEASE][root@firewall.kreitler.us]/root/scripts: pwd /root/scripts

how do I check the agent logs?

rbicelli commented 4 years ago

They are usually located in /var/log/zabbix_agentd.log Maybe in pfsense they are located in a different path

ScooterNC commented 4 years ago

Here are the logs. 25500:20200911:094154.244 Starting Zabbix Agent [firewall.kreitler.us]. Zabbix 5.0.1 (revision c2a0b03480). 25500:20200911:094154.244 Enabled features 25500:20200911:094154.244 IPv6 support: YES 25500:20200911:094154.244 TLS support: YES 25500:20200911:094154.244 ** 25500:20200911:094154.244 using configuration file: /usr/local/etc/zabbix44/zabbix_agentd.conf 25500:20200911:094154.244 agent #0 started [main process] 25879:20200911:094154.244 agent #1 started [collector] 26105:20200911:094154.245 agent #2 started [listener #1] 26172:20200911:094154.245 agent #3 started [listener #2] 26242:20200911:094154.245 agent #4 started [listener #3] 25500:20200911:163813.339 Got signal [signal:15(SIGTERM),sender_pid:46040,sender_uid:0,reason:65537]. Exiting ... 25500:20200911:163813.341 Zabbix Agent stopped. Zabbix 5.0.1 (revision c2a0b03480). 47123:20200911:163818.414 Starting Zabbix Agent [firewall.kreitler.us]. Zabbix 5.0.1 (revision c2a0b03480). 47123:20200911:163818.415 Enabled features 47123:20200911:163818.415 IPv6 support: YES 47123:20200911:163818.415 TLS support: YES 47123:20200911:163818.415 ** 47123:20200911:163818.415 using configuration file: /usr/local/etc/zabbix44/zabbix_agentd.conf 47123:20200911:163818.415 agent #0 started [main process] 47388:20200911:163818.415 agent #1 started [collector] 47698:20200911:163818.415 agent #2 started [listener #1] 47729:20200911:163818.416 agent #3 started [listener #2] 48038:20200911:163818.416 agent #4 started [listener #3] 47123:20200911:163959.844 Got signal [signal:15(SIGTERM),sender_pid:3838,sender_uid:0,reason:65537]. Exiting ... 48038:20200911:163959.844 failed to accept an incoming connection: select() failed: [4] Interrupted system call 47123:20200911:163959.845 Zabbix Agent stopped. Zabbix 5.0.1 (revision c2a0b03480).

ScooterNC commented 4 years ago

Looks like when I update the config for the agent it stops and restarts so this log isn't very useful

ScooterNC commented 4 years ago

I changed the template to FreeBSD and it went green and that log didn't show anything

ScooterNC commented 4 years ago

One thing I did notice is that the FreeBSD template reference Template Module Zabbix agent. So I have added that template too and will let you know if anything changes

rbicelli commented 4 years ago

In my setups I've never linked other templates besides this. Please note this is an active template and some requirements must be met in order to perform active checks. I suggest you to try to reconfigure everything from scratch

ScooterNC commented 4 years ago

so I tried that to no avail. I looked at the agent config and it doesnt have any of the user parameters. Shouldnt this file have them?

ScooterNC commented 4 years ago

I uninstalled 5 and installed 4.4 and it shows in the config file now. I will let you know if it starts working.

ScooterNC commented 4 years ago

Nope it shows red for ZBX. Any other ideas? Don’t know if this makes a difference but this is a VM on ESXi

ScooterNC commented 3 years ago

You can close this. Disappointing I cant use it but oh well.

rbicelli commented 3 years ago

You can close this. Disappointing I cant use it but oh well.

I'm sorry but looking to your configuration page in pfsense seems you didn't filled the "Server Active" field, which has to match the zabbix server name defined in zabbix configuration.

See https://www.zabbix.com/documentation/current/manual/appendix/items/activepassive

ScooterNC commented 3 years ago

That worked. I wasnt aware that I had to do that. I am not very well versed in Zabbix but I really appreciate your help.