Skip to content

Instantly share code, notes, and snippets.

@hashimotor
Created March 20, 2012 09:50
Show Gist options
  • Save hashimotor/2133578 to your computer and use it in GitHub Desktop.
Save hashimotor/2133578 to your computer and use it in GitHub Desktop.
NagiosでGmailへ通知を飛ばす
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | env MAILRC=/dev/null from=nagiosadmin@www2203.sakura.ne.jp smtp-use-starttls= smtp=smtp://smtp.gmail.com:587 smtp-auth-user=`cat mail-address` smtp-auth-password=`cat password` smtp-auth=login /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment