Windows script for checking SNMP status

Michael Ward mike-ward at utc.edu
Tue Oct 6 16:22:25 CEST 2009


Since I couldn't figure out why SNMP on Windows was crashing on some  
boxes (OSMA, Dell Servers) but not others, I munged someone's script  
to check to see if SNMP is stopped and if so, run it.

I put this is a text file called check-snmp.cmd

@echo off
setlocal
rem http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_24010267.html

set service=SNMP
set state=STOPPED



  for /F "tokens=3 delims=: " %%H in ('sc \\. query "%service%" ^|  
findstr "        STATE"') do (
   if /I "%%H" == "%state%" (
    echo %date%,%time%,%%H
    net start snmp
   )
  )



mjw

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
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