[Nagios] Changing Alert Email Content

Tadashi Shigeoka ·  Thu, June 5, 2014

Since Nagios alert emails needed to be sent to internal team members (non-engineers) as well, I changed the content to be more understandable.

Nagios | ナギオス

To change the email content, I defined the notify-service-for-member-by-email command based on notify-service-by-email.

define command {
  command_name notify-service-for-member-by-email
  command_line /usr/bin/printf "%b" "サーバーの異常を検知しました。\
\
ステータス: $SERVICESTATE$\
サービス名: $HOSTALIAS$\
ドメイン名: $HOSTADDRESS$\
監視対象: $SERVICEDESC$\
\
■日時: $LONGDATETIME$\
\
■連絡先:\
ステータス「CRITICAL」の場合、至急サーバー管理者へ連絡して下さい。\
\
・重岡: 090-XXXX-XXXX\
\
■追加情報:\
$SERVICEOUTPUT$\
\
" | /bin/mail -s "*Alert* $HOSTALIAS$/$SERVICEDESC$ : ステータス $SERVICESTATE$" $CONTACTEMAIL$
}

Below is the email content:

[Subject / 件名]:
*Alert* codenote/HTTPS : ステータス CRITICAL

[Body / 本文]:
サーバーの異常を検知しました。
(Server anomaly detected.)

ステータス: CRITICAL
(Status: CRITICAL)
サービス名: codenote
(Service Name: codenote)
ドメイン名: codenote.com
(Domain Name: codenote.com)
監視対象: HTTPS
(Monitoring Target: HTTPS)

■日時: Thu Jun 5 06:04:08 UTC 2014
(■Date/Time: Thu Jun 5 06:04:08 UTC 2014)

■連絡先:
(■Contact Information:)
ステータス「CRITICAL」の場合、至急サーバー管理者へ連絡して下さい。
(If status is "CRITICAL", please contact the server administrator immediately.)

・重岡: 090-XXXX-XXXX
(・Shigeoka: 090-XXXX-XXXX)

■追加情報:
(■Additional Information:)
HTTP CRITICAL: HTTP/1.1 200 OK - 146477 bytes in 0.093 second response time

That’s all from the Gemba.