Showing posts with label nrpe. Show all posts
Showing posts with label nrpe. Show all posts

nsclient++ and check IIS7 application pools

It exists well-known script for NSClient++ 3.x to check Internet Information Services (IIS) AppPool status. It uses Windows Management Instrumentation (WMI). I didn't find installation instruction for NSClient++ 4.2 and I would like to share my working config.
  • Just save Check_IISv7_AppPool_State.vbs file into scripts directory 
  • modify setting in nsclient.ini file as stays below 
  • restart nsclient service finally

; 
[/modules]
; NRPE server - A simple server that listens for incoming NRPE connection and handles them.
NRPEServer = 1


[/settings/NRPE/server]
allowed hosts = YOUR.NAGIOS.SERVER.ADDRESS
allow arguments = true
allow nasty characters = true
port = 5666
timeout = 60
use ssl = 1
performance data = 1

[/settings/external scripts]
allow arguments = 1
allow nasty characters = 1
timeout = 60

[/settings/external scripts/scripts]
check_iis_defaultapppool=cscript.exe //nologo //T:60 scripts/Check_IISv7_AppPool_State.vbs DefaultAppPool
check_iis_mypool=cscript.exe //nologo //T:60 scripts/Check_IISv7_AppPool_State.vbs "My New Pool"
check_iis_longrunning=cscript.exe //nologo //T:60 scripts/check_IISv7_long_running.vbs 1000 20000

NOTE: Application Pool name with spaces must be quoted as was described in the previous post!

To check settings from nagios server please execute on remotes host
# /usr/local/nagios/libexec/check_nrpe -H IIS.HOST.IP.ADDRESS -t 60 -p 5666 -c check_iis_mypool

If all settings are correct you should see result
OK! My New Pool: STARTED

Enjoy!

success story: passing arguments with quoted spaces to check_nrpe from nagios.

I have managed to to pass parameter as twice quoted (“ ‘ param value ‘ “) on nagios side and the command was executed, but it happens only from command line, and i can’t pass parameter from nagios config. In my humble opinion less elegant and non-flexible code is better than non-working solution, as a bad peace is better than a good quarrel. At least it work for me and solution was to hardcoded parameter on nrpe side:
filename with special characters must be quoted with double quotes. Check following command first from command line on remote host
# ./check_file_size.sh -v --maxcrit 100000 "/tmp/Some File Name with Spaces.log"

If command returns filename and file size, the next step to add command to NRPE config. Let’s edit nrpe.cfg and add new command

command[check_file_demo]=/usr/local/nagios/libexec/check_file_size.sh -v --maxcrit 100000 "/tmp/Some File Name with Spaces.log"

save file and execute from command line on remote host

./check_nrpe -H 127.0.0.1 -c check_file_demo

when it works you can use check_nrpe command already from nagios server.

Enjoy!

HOWTO: Repair Logitech M325 Mouse

FixIt says that you will find single screw under CE label. It isn't always true.