Nodeside:POSIX PHP Nodeside Script HOWTO
This is a quick primer on configuring and deploying the POSIX PHP script for nodeside monitoring of *+[ix|ux] operating systems (Linux, BSD etc).
Decide on Pull or Push
See nodeside testing for a more detailed description
Pulling involves the script being published on the node using a web server such as apache. FreeNATS calls the URL of the nodeside script and "pulls" the data. For full data functionality when using pull in a modern SELinux environment you will probably have to hack the script and use copies of key files which are unaccessible to the apache process.
Pushing involves the script being invoked by a scheduler such as CRON and "pushing" the data via HTTP POST to the FreeNATS server.
Setup the Node in FreeNATS
Create the node and enable nodeside testing. Saving this will display more options.
Enable your chosen method (push or pull).
For the pull method enter the URL of the nodeside script.
Optionally enter a node key (and for the push method an IP address to limit data pushes from).
Configure the Node
Copy both the node/posix/freenats-node.php file and its companion node/posix/config.inc.php to a destination on the node.
Edit the config.inc.php file and fill in the relevant settings including:
- PushTarget (full http URL to http://YOUR_FREENATS/nodeside.push.php if you are using the PUSH method).
You do not need to change the freenats-node.php file itself - any config values in there are defaults and just overwritten by the config.inc.php file
Test the Node
Return to the FreeNATS interface and select "Refresh (Pull) Now". You should see a message that all was successful. If it fails try manually viewing the output to see if the URL you entered was correct.
You may be able to see some output in the system logs as to why it failed if all seems well and you can always run the script manually to generate the XML and see what is up.
Run the script for example:
php -f freenats-node.php
This should display some output and let you know if the push was successful or not.
Configure the Tests
Once the push/pull has run once successfully you will be able to add nodeside tests from the node edit page. Please note these will hardly ever fail whatever the value (as long as some value was returned) so for disk space etc you may well want to setup custom evaluators to alert when under 10% free or whatever.
You will need to configure a scheduler such as CRON to run the script (optionally discarding output) as you see fit.
You can configure an interval in the node edit page (default 15 minutes). Like tests themselves this can only ever be as short an interval as the node's own interval.