EyesOfNetworkCommunity / EyesOfNetworkCommunity/notifier
Sending clean notifications via email
- Dominant language
- Perl
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
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
/srv/eyesofnetwork/notifier/log/notifier.log
email-host = /srv/eyesofnetwork/notifier/etc/sendmail.sh $NOTIFICATIONTYPE$ $HOSTNAME$ $HOSTSTATE$ $HOSTADDRESS$ $HOSTOUTPUT$ $LONGDATETIME$ $HOSTSTATE$ $HOSTNAME$ $CONTACTEMAIL$
email-service =/srv/eyesofnetwork/notifier/etc/sendmail.sh $NOTIFICATIONTYPE$ $HOSTNAME$ $HOSTSTATE$ $HOSTADDRESS$ $HOSTOUTPUT$ $LONGDATETIME$ $HOSTSTATE$ $HOSTNAME$ $CONTACTEMAIL$
***************************************************************
****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 '
***** EYESOFNETWORK *****
Notification Type: $1
Host: $2
Address: $4
state: $3
Date/time: $5
Additional Info: $6
'
) | /usr/sbin/sendmail -t
***************************************************************
****the nagios command
$USER3$/bin/notifier.pl -t host -c $USER3$/etc/notifier.cfg -r $USER3$/etc/notifier.rules -T "$LONGDATETIME$" -h "$HOSTNAME$" -e "$HOSTSTATE$" -i "$HOSTADDRESS$" -n "$NOTIFICATIONTYPE$" -C "$CONTACTEMAIL$" -O "$HOSTOUTPUT$" -A "$HOSTGROUPNAME$" -G "$CONTACTGROUPNAMES$" -X "$TIME$" -Y "$HOSTNOTIFICATIONNUMBER$"
Contributor guide
Assessment
This issue has not been assessed yet.