Notify_RT

This bash script uses the Request Tracker command line client to create tickets when a problem arises and resolve them when the problem clears. It does not require any configuration in the RT server, and can connect to any RT server that can be accessed over http.

Most distributions have the RT command line client already packaged up.

It’s probably compatible with all Nagios versions and their derivatives, but I only have Nagios v3 to test.

This program is designed to be run from Nagios as a command. Example:

define command {
 command_name                    notify-host-rt
 command_line                    /usr/lib/nagios/plugins/notify_rt -m rt_host --RTUSER username --RTPASSWD password \
 --RTSERVER http://rt.example.com/ --RTQUEUE queue_name --HOSTNAME $HOSTNAME$ --HOSTSTATE $HOSTSTATE$ \
 --HOSTPROBLEMID $HOSTPROBLEMID$ --LASTHOSTPROBLEMID $LASTHOSTPROBLEMID$ --HOSTOUTPUT="$HOSTOUTPUT$"
 register                        1
 }
 define command {
 command_name                    notify-service-rt
 command_line                    /usr/lib/nagios/plugins/notify_rt -m rt_service --RTUSER username --RTPASSWD password \
 --RTSERVER http://rt.example.com/ --RTQUEUE queue_name --SERVICEPROBLEMID $SERVICEPROBLEMID$ --LASTSERVICEPROBLEMID $LASTSERVICEPROBLEMID$ \
 --HOSTNAME $HOSTNAME$ --SERVICEDESC "$SERVICEDESC$" --SERVICESTATE $SERVICESTATE$ --SERVICEOUTPUT="$SERVICEOUTPUT$"
 register                        1
 }

-m sets the script to look for either host variables (rt_host) or service variables (rt_service).
Each “–” option sets an environment variable of that name which are used in the script.

Other Options:
–DEBUGLEVEL <1,2,3>       Outputs more information to stderr the higher the number is. Good for command line testing. NOTE: This must be the first “–” option or you will miss some option parsing in the output.
–NAGIOSHOST <string>      Sets the nagioshost in [nagioshost:problemid] in the ticket subject. Defaults to the output of the “hostname” command.

Download Here