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.
Pikmin
Posts: 80 Joined: Tue Feb 17, 2015 5:32 pm
Post
by Pikmin » Wed Sep 02, 2015 8:19 pm
Hi there,
Can someone assist me with setting up the email monitoring. I'm running core 4.1.1 on Centos 7.
The postfix service is running however I haven't made any changes
Code: Select all
define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
email nagios@localhost <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
Is it enough to change nagios@localhost to my internal exchange address or is there additional steps I need to make
Thanks
I might have posted this in the wrong forum, sorry!
Box293
Too Basu
Posts: 5126 Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:
Post
by Box293 » Wed Sep 02, 2015 10:13 pm
Pikmin wrote: Is it enough to change nagios@localhost to my internal exchange address or is there additional steps I need to make
That will change who the email goes to.
Have a look at the notify-host-by-email and notify-service-by-email commands, this is how the nagios submits the emails.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new
Privacy Policy .
Pikmin
Posts: 80 Joined: Tue Feb 17, 2015 5:32 pm
Post
by Pikmin » Wed Sep 02, 2015 10:39 pm
Thanks Box293
I noticed I didn't have mail installed, which mail doesn't return anything
I have installed mailx and it resides in /usr/bin/mail
Does that mean I should add /usr to /bin/mail below:
commands.cfg
Code: Select all
# '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$\n\nDate/Time:
$LONGDATETIME$\n" | /bin/mail -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\n
Date/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
EDIT: It appears to be working now, I received my first alert
Box293
Too Basu
Posts: 5126 Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:
Post
by Box293 » Wed Sep 02, 2015 11:12 pm
Pikmin wrote: Does that mean I should add /usr to /bin/mail below:
Yes, update the command.
Pikmin wrote: EDIT: It appears to be working now, I received my first alert
Excellent, happy monitoring
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new
Privacy Policy .
Pikmin
Posts: 80 Joined: Tue Feb 17, 2015 5:32 pm
Post
by Pikmin » Thu Sep 03, 2015 12:01 am
Thanks mate
Can be closed as solved