Nagios NSClient Agent Rollout Script

I'm a big fan of Nagios as a monitoring solution in environemnts large and small. The price can't be beat and the community around it is pretty good too. I have a zip attached to this post which contains a script I wrote to deploy the nsclient agent to a list of hosts specified in a text file.

The script requires two utilities from the Sysinternals PSTools package. There are two empty files in the zip named psexec.exe.goeshere and psservice.exe.goeshere. You should delete these and replace them with psexec and psservice from the Sysinternals site.

There is also a folder called DeployFolder in the zip . You need to download nsclient and place all the files in the archive inside of DeployFolder.

Your folder structure should look something like this once all the proper files are in place:

Finally, put the list of machine names in NagiosDeployList.txt one per line.

Run cscript NagiosDeploy.vbs to execute the script.

The script maps the B drive to do the work – you can change this at the top of the script if you have a B drive already. It drops the agent in c:\nagios on the target machines, this can be changed between lines 48 and 53.

The script sets the registry keys for port TCP1248 (nsclient default) and a connection password of "None" (nsclient default). These can be changed as well.

I commented the script pretty well, this shouldn't be hard to modify. I can't guarantee that it will work out of the box for you, I wrote it for a specific task, not to be a polished release product, but I figured why not share it?

This can be customized to roll out NRPE_NT pretty easily as well. I will probably end up baking a similiar script for rolling out updated nrpe_nt config and scripts/binaries.

Your folder structure should look something like this once all the proper files are in place:


Share this post: email it! | digg it! | bookmark it! | live it!

Leave a Reply

Your email address will not be published. Required fields are marked *