Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
/usr/bin/printf "%b" "$NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress:$HOSTADDRESS$\nInfo: $HOSTOUTPUT$\nDuration: $HOSTDURATION$\nAlias: $HOSTALIAS$\n\nDate/Time: $LONGDATETIME$ \n" | /usr/bin/mail -s "**SITE1 $NOTIFICATIONTYPE$ Host $HOSTNAME$ is $HOSTSTATE$" $CONTACTEMAIL$ -a "From: someone <some@mail.com>" -a "Content-Type: text/plain; charset=UTF-8"
I just tested this on a freshly setup Debian 9 system running Nagios Core 4.4.5 with the command above as the only host notification handler and when I took the host down with the following text as the message:
From some@mail.com Thu Feb 27 10:12:38 2020
Return-path: <some@mail.com>
Envelope-to: nagios@localhost
Delivery-date: Thu, 27 Feb 2020 10:12:38 -0600
Received: from nagios by debian9x64 with local (Exim 4.89)
(envelope-from <some@mail.com>)
id 1j7Lm9-0003CB-Ur
for nagios@localhost; Thu, 27 Feb 2020 10:12:37 -0600
Subject: **SITE1 PROBLEM Host localhost is DOWN
From: someone <some@mail.com>
Content-Type: text/plain; charset=UTF-8
To: <nagios@localhost>
X-Mailer: mail (GNU Mailutils 3.1.1)
Message-Id: <E1j7Lm9-0003CB-Ur@debian9x64>
Date: Thu, 27 Feb 2020 10:12:37 -0600
PROBLEM
Host: localhost
State: DOWN
Address:127.0.0.1
Info: Здрасти, това тук е тестов текст на кирилица, изпратен от NAGIOS CGI.
Duration: 0d 0h 0m 0s
Alias: localhost
Date/Time: Thu Feb 27 10:12:37 CST 2020