Nodeside:Win32 Nodeside Script HOWTO

From FreeNATS Wiki
Jump to: navigation, search

A quick how-to guide on configuring the VBS nodeside monitor for Windows.

Create Node

Create the node in FreeNATS if required.

Enable "Nodeside Testing" in the options and save. This will display further options.

Enter a NodeKey (alpha-numeric node pseudo-password) if you wish.

Tick "Push Enabled".

Enter the IP address of the node to limit posting of data to that IP if you wish.

Save your settings.

Install node.vbs

Copy the node.vbs and push.bat from the node/windows folder within the FreeNATS distribution.

Edit the push.bat and you can see there are various options you can specify. The line to start the script would look like:

cscript node.vbs //nologo [options]

Where the options you can provide are as follows:

/nodeid:NodeID Required The FreeNATS nodeid for the node
/pushurl:http://FREENATS_URL/nodeside.push.php Required
/nodekey:NodeKey Optional Pass this nodekey if one if specified/required
/nooutput:1 Optional If specified doesn't display XML output

So if we had a node called bob with a key of secret and FreeNATS was installed to http://nms/ then the line would read something like:

cscript node.vbs //nologo /nodeid:bob /pushurl:http://nms/nodeside.push.php /nodekey:secret

If we ran this (either manually or through a .bat or .cmd script) then we should see loads of XML output (unless we specify /nooutput:1) and the result at the bottom, either Push Successful or Push Failed and then the error returned by the FreeNATS server.

Once this push has run once successfully we can return to the FreeNATS interface and edit the options for our node to...

Configure Tests

Once the node has successfully pushed data you should be able to select a wide-number of monitors to add as tests to the node.

There is no guarantee that the tests will fail if they give "dangerous" results although the disk space test will, by default, warn if over 90% and fail if over 95% other tests will always pass (memory for example) so you would need to create complex evaluators if you want them to fail.


Schedule Push

Once the node has pushed data ok and you are happy with your config you need to just schedule the script to run (either with your manual command or via the .bat/.cmd script you have created) at the interval you wish.

You can optionally redirect output from the script by using the pipe option as follows:

cscript node.vbs //nologo [options] > noderun.txt


Remote Windows Testing

You can fetch information from other Win32 hosts over the network if you have the relevant permissions. To do this you can specify the following command-line switches:

/host:hostname
/user:username
/pass:password

If no host is specified then "." is used which connects to the local computer (default operation). If a user is specified then complex authentication is used to a remote host otherwise a direct peer connection is attempted.

You can use this to poll multiple Windows hosts and upload their data into FreeNATS from a single Windows server. For example a script could go:

cscript node.vbs //nologo /nodeid:lion /pushurl:http://nats/nodeside.push.php /nodekey:abcdef /host:lion
cscript node.vbs //nologo /nodeid:bob /pushurl:http://nats/nodeside.push.php /nodekey:ghijkl /host:bob

Could connect to two hosts in turn (lion and bob) and fetch their data then upload that into FreeNATS for each node.