passive checks using nsca/send_nsca addon
Neil
neil-on-nagios at restricted.dyndns.org
Sun Feb 15 20:01:49 CET 2004
Hey guys,
After battling against "checking of windows services or event logs" for 1
week, I was able to make it worked. Now, good thing, I will have a central
log system.
But today, I will be sharing configuration on how to send passive checks
result using send_nsca.exe for win32 to the NSCA daemon running on your
nagios box. This send_nsca.exe utility can be found on the Download Extras
of www.nagios.org
This will be very helpful most especially when the Windows machine you are
monitoring is behind a firewall, load balancer or a NAT device. This is
different from NRPE_NT and check_nrpe since nagios initiates a TCP session
on port 5666 then sends the command to NRPE_NT. I like NRPE_NT too but there
were occasions that I get connection refused even if all the "WATCH OUR FOR"
has been accounted for.
Here you go:
in my /usr/local/nagios/etc/services.cfg
========================================
define service{
name nt-service-template
active_checks_enabled no
passive_checks_enabled 1
parallelize_check 1
obsess_over_service 0
check_freshness 0
freshness_threshold 28800
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
register 0
is_volatile 1
check_period none
max_check_attempts 1
normal_check_interval 5
retry_check_interval 1
contact_groups nt-admins
notification_interval 120
notification_period 24x7
notification_options w,c,r
}
define service{
use nt-service-template ; template
host_name rconxp
service_description w3svc
check_command ""
}
define service{
use nt-service-template ; template
host_name rconxp
service_description wuauserv
check_command ""
}
in my c:\checkservices\check_wuauserv.bat
================================
@echo off
c:\windows\system32\sc query wuauserv |find "STATE"|c:\windows\system32\awk
"{print $4}" > resultfile
call filetovar.bat resultfile
if %result% EQU RUNNING (
echo rconxp:wuauserv:0:Automatic Updates Service is in RUNNING
state|send_nsca -H 10.136.178.237 -d : -c send_nsca.cfg
) else (
echo rconxp:wuauserv:2:Automatic Updates Service is in STOPPED
state|send_nsca -H 10.136.178.237 -d : -c send_nsca.cfg
)
in my c:\checkservices\filetovar.bat
====================================
@echo off
copy sethelp$ + %1 $tmp$.bat > nul
call $tmp$.bat
del $tmp$.bat
in my c:\checkservices\sethelp$ <- this is the magic file :) There is so
much missing in ms shell programming
=====================================
set result=
WARNING: do not press ENTER key after = siqn. Just stop at the = sign and
save it
ANOTHER TIP: You can copy sc.exe on your windows xp to your windows 2000
machine. sc.exe comes with Windows XP. I don't have windows nt 4 so I can't
say that it will work.
Lastly, awk there is not a built in utility in Window$. I just downloaded it
from somewhere. I will leave this for you, you can find it in google. This
is your exercise. hehehe :)
Let me know your feedback.
Neil
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list