Skip to content

Instantly share code, notes, and snippets.

@craigcalef
Created December 23, 2017 05:23
Show Gist options
  • Save craigcalef/4d96b7d11cb1a5d7a1a920517d04c1e6 to your computer and use it in GitHub Desktop.
Save craigcalef/4d96b7d11cb1a5d7a1a920517d04c1e6 to your computer and use it in GitHub Desktop.
Send host/service notifications from Nagios via AWS SES
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line aws ses send-email --from majordomo@imafuckin.pro --to $CONTACTEMAIL$ --text "***** dev1 Nagios ***** Notification Type: $NOTIFICATIONTYPE$ Host: $HOSTNAME$ State: $HOSTSTATE$ Address: $HOSTADDRESS$ Info: $HOSTOUTPUT$ Date/Time: $LONGDATETIME$" --subject "dev1 $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$" --region us-west-2
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line aws ses send-email --from majordomo@imafuckin.pro --to $CONTACTEMAIL$ --text "***** dev1 Nagios ***** Notification Type: $NOTIFICATIONTYPE$ Service: $SERVICEDESC$ Host: $HOSTALIAS$ Address: $HOSTADDRESS$ State: $SERVICESTATE$ Date/Time: $LONGDATETIME$ Additional Info: $SERVICEOUTPUT$" --subject "dev1 $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" --region us-west-2
}
# You will need to setup and 'verify' the address used in SES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment