<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7653.2">
<TITLE>Re: [Nagios-users] Monitoring Windows Eventviewer</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=2 FACE="Courier New">>Dear All,</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">>Would anyone have experience in checking the windows eventviewer for certain events, or turning nagios red in case of ERRORs ?</FONT></P>

<P><FONT SIZE=2 FACE="Courier New">>What script are you using ? preferably something that can simply interact with NSClient</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">We do this using the NSClient++ agent (</FONT><A HREF="file://www.nsclient.org"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">www.nsclient.org</FONT></U></A><FONT SIZE=2 FACE="Courier New">).  It checks the event logs and filters them based on criteria you define, alerting when the number of hits you specify is reached (i.e. when the system log has 1 or more events with an ID of XXXX within the last 10 minutes send alerts).  Here is an example we use to monitor for a specific Oracle error.  In the example we check the "application" log of the server every "60" minutes for events with an ID of "20" with event type of "Error" containing a string in the text of the message "Can not allocate log", check turns critical after 1 matching event is found that is time stamped within the last "65" minutes.</FONT></P>
<BR>

<P><FONT SIZE=2 FACE="Courier New">Checkcommands.cfg:</FONT>

<BR><FONT SIZE=2 FACE="Courier New">define command{</FONT>

<BR><FONT SIZE=2 FACE="Courier New">        command_name    check_eventlogs</FONT>

<BR><FONT SIZE=2 FACE="Courier New">        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c checkEventLog -a filter=new $ARG1$ MaxWarn=$ARG2$ MaxCrit=$ARG3$ filter-generated=\$ARG4$ $ARG5$ truncate=$ARG6$</FONT></P>

<P><FONT SIZE=2 FACE="Courier New"># Desc:</FONT>

<BR><FONT SIZE=2 FACE="Courier New">#       $ARG1$ = event logs to check (i.e. file=system file=application)</FONT>

<BR><FONT SIZE=2 FACE="Courier New">#       $ARG2$ = Warning level (i.e. number of hits to generate a warning response)</FONT>

<BR><FONT SIZE=2 FACE="Courier New">#       $ARG3$ = Critical level (i.e. number of hits to generate a critcal response)</FONT>

<BR><FONT SIZE=2 FACE="Courier New">#       $ARG4$ = Time period (i.e. 1 day is '1d' 30 hours is '>30h')</FONT>

<BR><FONT SIZE=2 FACE="Courier New">#       $ARG5$ = Filters (i.e. filter-eventID==9009 filter-eventSource=Tcpip) see </FONT><A HREF="http://www.nsclient.org/nscp/wiki/CheckEventLog/CheckEventLog"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Courier New">http://www.nsclient.org/nscp/wiki/CheckEventLog/CheckEventLog</FONT></U></A><FONT SIZE=2 FACE="Courier New"> for detailed info</FONT></P>

<P><FONT SIZE=2 FACE="Courier New">#       $ARG6$ = Amount of data to return in characters (i.e. truncate=150)</FONT>

<BR><FONT SIZE=2 FACE="Courier New">#       Example: check_nrpe -H server_name_here -p 5666 -c checkEventLog -a filter=new file=system MaxWarn=1 MaxCrit=1 filter-generated=\>30h filter+eventID==10002 descriptions truncate=138</FONT></P>

<P><FONT SIZE=2 FACE="Courier New">        }</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">Services.cfg:</FONT>

<BR><FONT SIZE=2 FACE="Courier New">define service{</FONT>

<BR><FONT SIZE=2 FACE="Courier New">        use                             standard-srv</FONT>

<BR><FONT SIZE=2 FACE="Courier New">        service_description             eventlog: Oracle archive log errors</FONT>

<BR><FONT SIZE=2 FACE="Courier New">        check_command                   check_eventlogs!file=application!1!1!>65m!filter+eventID==20 filter+eventType==error filter+message=substr:"Can not allocate log"!100</FONT></P>

<P><FONT SIZE=2 FACE="Courier New">        normal_check_interval           60</FONT>

<BR><FONT SIZE=2 FACE="Courier New">        notification_options            w,c</FONT>

<BR><FONT SIZE=2 FACE="Courier New">        contact_groups                  apps</FONT>

<BR><FONT SIZE=2 FACE="Courier New">        host_name                       server1, server2</FONT>

<BR><FONT SIZE=2 FACE="Courier New">        }</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">HTH, </FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">-greg</FONT>
</P>
<BR>
<BR>

</BODY>
</HTML>