Build precise queries to find exactly what you need
Press ESC to close
Join our next live webinar: “Advanced Nagios Monitoring Techniques” – Register Now
Your review has been submitted and is pending approval.
Remotely execute scripts using the nagios event handler
Current Version
Last Release Date
June 24, 2009
Owner
Nagios Exchange
Compatible With
rexec version 1
Sorry for the quick howto, but here goes. If you have any questions, feel free to contact me: kyle[dot]odonnell[at]gmail[dot]com. rexec will only execute on a 'HARD' state ($SERVICESTATETYPE$). rexec currently only supports executing commands via NRPE or SSH. usage: ./rexec hostname ipaddress service severity# state attempt command nscahost [ifcrit#|ifwarn#|ifok#] [nrpe|user@ssh] [debug|nodebug] # rhostname == $HOSTNAME$ # rhostip == $HOSTADDRESS$ # service == $SERVICEDESC$ # severity == $SERVICESTATEID$ (0=ok,1=warn,2=crit,3=unk) # state == $SERVICESTATETYPE$ (hard|soft) # attempt == $SERVICEATTEMPT$ (informational only) # command == command to execute (via ssh or nrpe [provided command is in nrpe.cfg]) # nscahost == send nsca message to update $SERVICEOUTPUT$ that eventhandler has been executed # ifsev == execute this event handler on this severity (0=ok,1=warn,2=crit,4=warn||crit) # proto == which protocol to exec command if ssh get username to exec command as # debug == output to log The rexec script is passed nagios MACROS as well as some user defined options. It evaluates whether or not the event handler should be executed, and by what protocol (nrpe or ssh). The $ifsev variable is what determines when to execute the script; ie, if $SERVICESTATEID$ is 2(critical) and $ifsev is 2(critical), then execute the $command. The value of $ifsev matches the nagios exit codes with one exception: if $ifsev is 4, then rexec will execute the $command on a 1(warning) or 2(critical) state. When rexec executes the $command it will also initiate a send_nsca message to update the UI that the event handler was executed. I also run an send_nsca in the $command script to let me know if it was executed, and what exit code it returned.
You must be logged in to submit a review.
To:
From: