Home Directory Addons Monitoring Agents rexec - Nagios EventHanlder

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

rexec - Nagios EventHanlder

Rating
0 votes
Favoured:
0
Hits
127903
Files:
FileDescription
rexec-1.0.tgzrexec version 1
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Remotely execute scripts using the nagios event handler
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.