I'm trying to send out a different style of notification for a specific service in Nagios, namely, when a user account gets locked out from AD. I don't need all the excess information associated with the usual emails (e.g. Host the service pertains to, IP address, service status, etc), as all the information I need is given in the SNMP trap sent from Windows in $SERVICEOUTPUT
. However, I can't just change the notify-service-by-email command because I need to use the full output for all the other services.
I need to find a way to either:
Send out an email notification customized to this service
define command{ command_name notify-service-by-email command_line $~LongOutputCommand~$ } define command{ command_name notify-lockouts-by-email command_line $-ShortOutputCommand~$ } define service{ service_description Account Lockouts service_notification notify-lockouts-by-email ... }
Execute an if statement inside the command_line section of the Nagios command:
define command{ command_name notify-service-by-email command_line if [ "$SERVICEDESC" == "Account Lockouts" ]; then $-ShortOutputCommand~$; else $~LongOutputCommand~$; fi }
I don't believe it's possible for Nagios to do the first way because of the way it is programmed, but no matter how I try the second way it doesn't process it as a proper command ("if not recognized", etc).