Hi Guys Hope your well
i have configured email notifications for some time now and happy how its works, im looking to add a little more information to the emails and hopefully somebody can help
here are the current email commands im using im sure there pritty much standard and im using sendmail if that helps any one
# '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$\\nDate/Time:$LONGDATETIME$\n" | /usr/sbin/sendmail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/$Time:$LONGDATETIME$\n" | /usr/sbin/sendmail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
currently i receive an email from nagios@localhost.localdomain which was fine for initial testing but i would like to have this a little more appropriate now for example nagios@domain.com
the other thing is that there is no subject on the email, it would be great if this showed the Host and the issue
any advice would be greatly appreciated
Email Notifications
Re: Email Notifications
Check out /etc/postfix/main.cf and look at the myhostname command, should give you what you are looking for
Re: Email Notifications
Nice one m8 im learning and learning alot but still need a bit of help every now and then, not bad at all tho considering ive got no experiance with linux previously
Re: Email Notifications
Hi mate ive had a quick look but i dont think those settings will effect me as im using sendmail unless u can tell me otherwise lol
Re: Email Notifications
oh yes sendmail... I tend to avoid it like the plague, welcome to the 7th layer of configuration hell. Working from very hazy memory you need to edit /etc/mail/sendmail.mc and add:
MASQUERADE_DOMAIN(domainname)dnl
FEATURE(masquerade_entire_domain)dnl
then recreate the config file: m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
/etc/init.d/sendmail restart
I think that's how you change it with sendmail.
MASQUERADE_DOMAIN(domainname)dnl
FEATURE(masquerade_entire_domain)dnl
then recreate the config file: m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
/etc/init.d/sendmail restart
I think that's how you change it with sendmail.
Re: Email Notifications
Appreciate the Help mate
in the end i made the switch to postfix
in the end i made the switch to postfix
Re: Email Notifications
Probably the easiest solution