Hi there,
I have succesfully installed Nagios and am monitoring a test box.
My only problem now is figuring out how to configure Nagios to send mail notifications to my exchange email.
I have tried hundreds of sites and cant seem to find a straight forward enough way on how to do this. I am trying to install packages as suggested on other forums but i am quite a newbie in linux and fear damaging something in the o/s.
Can anyone help me with this? Im in desperate need to get an alert so i can move forward. It is so critical for my business environment to get a POC going.
Thanks,
Configuring mail in exchange
Re: Configuring mail in exchange
Lots of questions, starting with:
Can you send mail to yourself from your linux box?
- if not install the postfix package. It usually works out of the box.
Have you configured your contact details in the nagios contacts.cfg and setup notification options
for your services/hosts?
Just a start, but it'll give me something to work from .......
Can you send mail to yourself from your linux box?
- if not install the postfix package. It usually works out of the box.
Have you configured your contact details in the nagios contacts.cfg and setup notification options
for your services/hosts?
Just a start, but it'll give me something to work from .......
-
celtictech
- Posts: 2
- Joined: Tue Feb 15, 2011 7:16 pm
Re: Configuring mail in exchange
I apologize if I am taking over this thread but I am in the same boat!!
I cannot for the life of me get an email to hit my exchange.
The Nagios server IP address is a "allowed" address in the Exch and i can send an email via telnet from the console
Config files are as follows:
define host{
use windows-server ; Inherit default values from a template
host_name cc-fl-dc2 ; The name we're giving to this host
alias Secondary DC ; A longer name associated with the host
address 192.168.26.15 ; IP address of the host
hostgroups dell-servers
contact_groups admins
}
define service{
use generic-service
host_name cc-fl-dc2
service_description NSClient++ Version
contact_groups admins
check_command check_nt!CLIENTVERSION
}
# hostgroup for Dell servers
define hostgroup {
hostgroup_name dell-servers
alias Our Company Name
members cc-fl-dc2
}
define contact{
contact_name My Name
use generic-contact
alias My Name
email [email protected]
}
define contactgroup{
contactgroup_name admins
alias Administrators
members My Name
}
Contact Template:
# Generic contact definition template - This is NOT a real contact, just a template!
define contact{
name generic-contact ; The name of this contact template
service_notification_period 24x7 ; service notifications can be sent anytime
host_notification_period 24x7 ; host notifications can be sent anytime
service_notification_options w,u,c,r,f,s ; send notifications for all service states, flapping events, and scheduled downtime events
host_notification_options d,u,r,f,s ; send notifications for all host states, flapping events, and scheduled downtime events
service_notification_commands notify-service-by-email ; send service notifications via email
host_notification_commands notify-host-by-email ; send host notifications via email
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
}
Commands.cfg (i have tried usr/bin/mail /bin/mail usr/bin/mailx /bin/mailx):
# '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" | /usr/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\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
Could someone please enlighten me this has been driving me nuts for days now!!!! (And nights too)
Thanks in advance
I cannot for the life of me get an email to hit my exchange.
The Nagios server IP address is a "allowed" address in the Exch and i can send an email via telnet from the console
Config files are as follows:
define host{
use windows-server ; Inherit default values from a template
host_name cc-fl-dc2 ; The name we're giving to this host
alias Secondary DC ; A longer name associated with the host
address 192.168.26.15 ; IP address of the host
hostgroups dell-servers
contact_groups admins
}
define service{
use generic-service
host_name cc-fl-dc2
service_description NSClient++ Version
contact_groups admins
check_command check_nt!CLIENTVERSION
}
# hostgroup for Dell servers
define hostgroup {
hostgroup_name dell-servers
alias Our Company Name
members cc-fl-dc2
}
define contact{
contact_name My Name
use generic-contact
alias My Name
email [email protected]
}
define contactgroup{
contactgroup_name admins
alias Administrators
members My Name
}
Contact Template:
# Generic contact definition template - This is NOT a real contact, just a template!
define contact{
name generic-contact ; The name of this contact template
service_notification_period 24x7 ; service notifications can be sent anytime
host_notification_period 24x7 ; host notifications can be sent anytime
service_notification_options w,u,c,r,f,s ; send notifications for all service states, flapping events, and scheduled downtime events
host_notification_options d,u,r,f,s ; send notifications for all host states, flapping events, and scheduled downtime events
service_notification_commands notify-service-by-email ; send service notifications via email
host_notification_commands notify-host-by-email ; send host notifications via email
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
}
Commands.cfg (i have tried usr/bin/mail /bin/mail usr/bin/mailx /bin/mailx):
# '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" | /usr/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\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
Could someone please enlighten me this has been driving me nuts for days now!!!! (And nights too)
Thanks in advance
-
celtictech
- Posts: 2
- Joined: Tue Feb 15, 2011 7:16 pm
Re: Configuring mail in exchange
Ha - I just mine sorted out - it was in the postfix.cf
I adjusted these 2 lines, adding my exchange IP for the relay host and adding the subnet to the mynetworks
relayhost = 192.168.26.4
mynetworks = 127.0.0.0/8 192.168.26.0/24 [::ffff:127.0.0.0]/104 [::1]/128
Emails are flowing now - too many LOL
I adjusted these 2 lines, adding my exchange IP for the relay host and adding the subnet to the mynetworks
relayhost = 192.168.26.4
mynetworks = 127.0.0.0/8 192.168.26.0/24 [::ffff:127.0.0.0]/104 [::1]/128
Emails are flowing now - too many LOL
-
trungleviet
- Posts: 35
- Joined: Sat Mar 03, 2012 11:36 am
- Location: Hanoi - Vietnam
- Contact:
Re: Configuring mail in exchange
Dear Celtictech,
I am a new Nagios and Linux,
When you config postfix on Linux machine, do you need to set dns server on it. And do you need to join that Linux machine into AD (if you are using AD)?
Many thanks you,
Trung Le Viet
I am a new Nagios and Linux,
When you config postfix on Linux machine, do you need to set dns server on it. And do you need to join that Linux machine into AD (if you are using AD)?
Many thanks you,
Trung Le Viet
Re: Configuring mail in exchange
I don't think you need to do either of these things.trungleviet wrote:When you config postfix on Linux machine, do you need to set dns server on it. And do you need to join that Linux machine into AD (if you are using AD)?
-
trungleviet
- Posts: 35
- Joined: Sat Mar 03, 2012 11:36 am
- Location: Hanoi - Vietnam
- Contact:
Re: Configuring mail in exchange
Yes, thanks for your reply, i configured nagioscore to send email to exchange but i met an error like below:agriffin wrote:I don't think you need to do either of these things.
"emailaddress" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
I rechecked the commands.cfg, contacts.cfg and mains.cfg (postfix) carefully but didn't see any error.
Could you please advice me how to fix this problem?
Many thanks for your supports.
Re: Configuring mail in exchange
See your other thread here.