can event handler take argument.  I want to have a generic shell script which take argument as to what process needs to start.  I want to restart process via nrpe.  Can someone please verfiy if the following will work or not?  Thanks in advance.<br>
<br><p>
<font color="red"><strong>
<pre>define service{<br>    host_name                       somehost<br>      service_description             HTTP<br>  max_check_attempts              4<br>     event_handler                   restart-process.sh!my_proecess<br>        <i>...other service variables...</i><br>      }<br></pre>
</strong></font>
</p>


<p>
Once the service has been defined with an event handler, we must define
that event handler as a command. Notice the macros in the command line
that I am passing to the event handler - these are important!</p><br><pre>define command{<br>command_name    restart-process.sh<br>command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c restart-process -a $SERVICESTATE$ $STATETYPE$ $SERVICEATTEMPT$ $SERVICEDESC$ 2 $ARG1$<br>
}<br></pre><br>my restart-process.sh<br><br><pre>#!/bin/sh<br><br>maxattempts=$5<br><br>case "$1" in<br>OK)<br>       # The service just came back up, so don't do anything...<br>  ;;<br>WARNING)<br>  # We don't really care about warning states, since the service is probably still running...<br>
        ;;<br>UNKNOWN)<br>  # We don't know what might be causing an unknown error, so don't do anything...<br>       ;;<br>CRITICAL)<br><br>       case "$2" in<br>                <br><br>    SOFT)<br><br><br>             case "$3" in<br>                                <br>
<br>              $maxattempts)<br><br>                       logger -t nrpe-eventhandler "Eventhandler: (Re)starting /etc/init.d/$4 (state=$1, type=$2, attempt=$3)"<br><br>                   output=`sudo /etc/init.d/$4 restart`<br><br>                        `which printf` "%b" "***** Nagios *****\n\nMessage:\tAn init script was invoked (after $3 attempts).\nDate/Time:\t`date`\n\nHostname:\t`uname -n`\nService:\t$4\nCommand:\t/etc/init.d/$4 restart\nOutput:\n\n$output" \<br>
                        | `which mail` -s "** Eventhandler: Restart of '$4' on host '`uname -n`'" $notifee<br>                  <br><br>                    sudo /etc/init.d/$6 restart<br>                   ;;<br>                    esac<br>          ;;<br>                            <br><br>    HARD)<br>         # Call the init script to restart the service.<br>
                sudo /etc/init.d/$6 restart<br>           ;;<br>    esac<br>  ;;<br>esac<br>exit 0<br></pre><br clear="all"><br><br><br>-- <br>Cordially,<br>Shadhin Rahman<br>