When you are using Nagios to check a Windows server and you have a lot of different checks you are performing, you can leverage your checks with one check that does it all. Multiple checks with one connection will allow you to save bandwidth and likely system resources on the Windows box. NSClient++ has a function that will allow multiple checks at one time.
NSClient++ Internal Functions
There are a number of internal functions that can be called with the inject command and NRPE and are usually combined with check_nt.
We do provide live Nagios Training classes that are instructor-led and currently the Official Nagios Training!
Following is a list of modules with their functions.
CheckDisk – CheckFileSize, CheckDriveSize
CheckSystem – CheckCPU, CheckUpTime, ChekServiceState, CheckProcState, CheckMem, CheckCounter
CheckeventLog – CheckEventLog
CheckHelpers – CheckAlwaysOk, CheckAlwaysCRITICAL, CheckAlways,WARNING, CheckMultiple
You can use aliases with external commands to do checks. The advantage of setting up the aliases is not so much the alias by itself but it will allow you to use the CheckMultiple function if you want to. Check to see if you can get it to work from the command line on the Nagios server first. If that works you can proceed.
./check_nrpe -H 192.168.5.14 -c CheckCPU -a warn=80 crit=90 time=20m time=10s time=4
OK CPU Load ok.|’20m’=0%;80;90; ’10s’=0%;80;90; ’4′=0%;80;90;
You will need to define Service checks on Nagios server as usual. Note NRPE is used to make the connection and then run the alias that you will set up.
service_description CPU Load
service_description Check Services
service_description Free Space
One the Windows server you will need to edit the “External Alias” section and create or uncomment the aliases that are there with the levels.
alias_cpu=checkCPU warn=80 crit=90 time=5m time=1m time=30s
alias_disk=CheckDriveSize MinWarn=10% MinCrit=5% CheckAll FilterType=FIXED
You also need to verify that the “modules” section has the uncommented “CheckExternalScripts.dll ” as you see below so checks can be made.
Restart your NSCLient++ on the Windows server and nagios on the Nagios server.
If you wanted to perform multiple checks at one time, thus saving network and server resources, you could use the CheckMultiple function. The CheckMultiple function will become an alias for any number of commands that you will want to run. The format should be like this:
alias=alias_name command= command= command=
Remove the aliases that you may have had previously and place them all on the CheckMultiple alias.
alias_multiple=CheckMultiple command=checkCPU warn=80 crit=90 time=5m time=1m time=30s command=CheckDriveSize MinWarn=10% MinCrit=5% CheckAll FilterType=FIXED command=checkServiceState CheckAll
You will need to set up a service on the Nagios server to reflect your settings in the nsc.ini on the windows server.
Here you can see the second line down the Multiple check is running. It checks the number of checks you have entered and then the “bad news rises to the top”. In other words as you can see any issues with one check can trigger the “CRITICAL” state. If you look closely the text specifically says the other checks are OK.