-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Hi to all readers,
I would like to send a clean e-mail with postfix using nagios notifier.As you may have seen, defauts emails are ugly.
I thought bout sending an html email using postfix, shell, and perl. Here are the files i used. 2 files that i have modified (notifier.cfg and a new shell file i created and put in /srv/eyesofnetwork/notifier/etc ) All files have 777 permissions as i am just testing it.
By defaut, i received emails starting with "eyesofnetwork" (please don't count the number of "*", if you are used to EON, you may know what i' talking about). I then added the 2 files below, gave them 777 permissions, and changed the nagios command (see below). I then received a notification starting with "Nagios" (again, please don't count the number or ""). It means EOn wasn't using the same command (eon_host_notifier and notify_by_email_host). Why another command was used ? i still don't know.
I used theses commands in command line interface, using values instead ot arguments ($1 ->9 ) and it worked perfectly.
Where is the problem pleasE ?
**** notifier.pl
0
<log_file>/srv/eyesofnetwork/notifier/log/notifier.log</log_file>
email-host = /srv/eyesofnetwork/notifier/etc/sendmail.sh
email-service =/srv/eyesofnetwork/notifier/etc/sendmail.sh
****sendmail.sh
#!/bin/sh
(
echo "To: $9
echo "Subject: Host $7 alert for $8 !"
echo "Content-Type: text/html"
echo "MIME-Version: 1.0"
echo ""
echo -e '
Notification Type: $1
Host: $2
Address: $4
state: $3
Date/time: $5
Additional Info: $6
' ) | /usr/sbin/sendmail -t
****the nagios command