rbicelli / pfsense-zabbix-template

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

Installation advice #170

Closed JeGr closed 3 months ago

JeGr commented 4 months ago

Hi,

am I correct in assuming that the only thing to install really is that line in your README?

curl --create-dirs -o /root/scripts/pfsense_zbx.php https://raw.githubusercontent.com/rbicelli/pfsense-zabbix-template/master/pfsense_zbx.php

If so, I'd suggest a better way to do that, that actually can survive every pfSense Firmware update.

Also as you are per definition relying on the zabbix package, I'd humbly suggest to put an additional if statement around your script, checking for the installed zabbix package, so it stops when not having that installed. For that pfSense has the function is_package_installed($packageName) that can check for e.g. zabbix-agent-xy.

For the installation I suggest not doing some "curl and go" magic, but pointing Users to the Filer package of pfSense. Filer has two big wins for you:

1) it creates a file with a given content and a given UMASK at a specific position in the filesystem 2) it is backed up in config.xml including said file and thus can re-create said file (e.g. your php file) after a restore, system update etc. when the filer package is updated/reinstalled. 3) it can replicate it's content to a standby node in a CARP cluster setting

So the documentation might get a bit longer defining the steps with Filer but the net-benefit is huge as it becomes a hands-off thing that will just work after an update, reinstall etc. as long as you create your PHP script in the package's configuration. :)

If you need help figuring out the specifics, I'm available to help (you can also find me in official netgate forum with the same name and avatar).

Cheers \jens

rbicelli commented 4 months ago

Hello, thanks for the advice. The check for zabbix_agent installed isn't really required. The script itself couldn't do anything without Zabbix agent.

If you like to contribute yuu could test the filer route and create a pull request for the readme.

Thanks