Snmp windows check

Script : check_snmp_win.pl

Last update : Jan 11 2007

Description :

Checks by snmp v1 or v3 windows specific health monitoring (service state for now).

Works on Windows server (2000, 2003) maybe XP and NT.

Vérifie par snmp v1 ou v3 si un(des) service Windows tournent.

Service checks

The plugin checks if there if the Windows service(s) he gets as input are running.
You can provide multiple services, comma separated :
-n <service1>,<service2>

The script will return :
OK : if <service1> is found (and active) and <service2> is found (and active).
WARNING : if <service1> and <service2> match more than 2 active services.
CRITICAL : if <service1> OR <service2> don't match any active service.

-N <number> : will return OK if <number> of active services matches the filter

-s : will show all active services instead of the non active ones only

Requirements :

- Perl in /usr/bin/perl - or just run 'perl script'
- Net::SNMP
- file 'utils.pm' in plugin diretory

Dowload latest version : 0.6

Configurations examples

Examples :

All examples below are considering the script is local directory. Host to be checked is with snmp community "public".

If multiple interfaces are selected, all must be up to get an OK result

Get help

./check_snmp_win.pl -h

snmpv3 login ./check_snmp_win.pl -H -l login -x passwd

Check if at least one process matching dns is running

./check_snmp_win.pl -H -C public -n dns

Result example :

1 services active (matching "dns") : OK

Check if at least 3 process matching dns are running

./check_snmp_win.pl -H -C public -n http -N 2

Result example :
(<=2 will return warning, 0 critical)
1 services active (matching "dns") : CRITICAL
Check if dns and ssh services are running ./check_snmp_win.pl -H -C public -n dns,ssh

Result example :

"dns" active, "ssh" active : OK
Check if dns and toto services are running ./check_snmp_win.pl -H -C public -n dns,toto
Result example :
"toto" not active : CRITICAL


Changelog : On CVS repository on sourceforge : http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/.

Output of check_snmp_win.pl -h

SNMP Windows Monitor for Nagios version 0.6
GPL licence, (c)2004-2005 Patrick Proy

Usage: check_snmp_win [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd) [-p <port>] -n <name>[,<name2] [-T=service] [-r] [-s] [-N=<n>] [-t <timeout>] [-V]
-v, --verbose
print extra debugging information (and lists all services)
-h, --help
print this help message
-H, --hostname=HOST
name or IP address of host to check
-C, --community=COMMUNITY NAME
community name for the host's SNMP agent (implies SNMP v1 or v2c with option)
-2, --v2c
Use snmp v2c
-l, --login=LOGIN
Login for snmpv3 authentication (implies v3 protocol with MD5)
-x, --passwd=PASSWD
Password for snmpv3 authentication
-p, --port=PORT
SNMP port (Default 161)
-T, --type=service
Check type :
- service (default) checks service
-n, --name=NAME[,NAME2...]
Comma separated names of services (perl regular expressions can be used for every one).
By default, it is not case sensitive.
-N, --number=<n>
Compare matching services with <n> instead of the number of names provided.
-s, --showall
Show all services in the output, instead of only the non-active ones.
-r, --noregexp
Do not use regexp to match NAME in service description.
-t, --timeout=INTEGER
timeout for SNMP in seconds (Default: 5)
-V, --version
prints version number
Note :
The script will return
OK if ALL services are in active state,
WARNING if there is more than specified (ex 2 service specified, 3 active services matching),
CRITICAL if at least one of them is non active.
The -n option will allows regexp in perl format
-n "service" will match 'service WINS' 'sevice DNS' etc...
It is not case sensitive by default : WINS = wins

This project is hosted on :
SourceForge.net Logo

Nagios and the Nagios logo are registered trademarks of Ethan Galstad.