email alerts

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.
Locked
rkobliski
Posts: 21
Joined: Fri Jan 27, 2012 4:04 pm
Location: Rincon, GA

email alerts

Post by rkobliski »

My first setup and everything works great except emal alerts, i get them but the include everyone.
[email protected]; [email protected]; [email protected]; [email protected]; [email protected];

see list for complete listings

how do i stop this???
Attachments
email problems.txt
list of sent to on email
(948 Bytes) Downloaded 303 times
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: email alerts

Post by jsmurphy »

Are you able to provide an example of your contact definitions and host/service definition? Nagios doesn't by default send to all contacts, so there has to be something somewhere in your configuration that is causing this behaviour.
rkobliski
Posts: 21
Joined: Fri Jan 27, 2012 4:04 pm
Location: Rincon, GA

Re: email alerts

Post by rkobliski »

my hostgroups.cfg is not being use. hostgroups.cfg~


###############################################################################
###############################################################################
#
# CONTACTS
#
###############################################################################
###############################################################################

# Just one contact defined by default - the Nagios admin (that's you)
# This contact definition inherits a lot of default values from the 'generic-contact'
# template which is defined elsewhere.

define contact{
contact_name Ray ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Ray Kobliski ; Full name of user

email [email protected] <***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}



###############################################################################
###############################################################################
#
# CONTACT GROUPS
#
###############################################################################
###############################################################################

# We only have one contact in this simple configuration file, so there is
# no need to create more than one contact group.

define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members Ray
}




Commands.cfg file below

# '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\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}

using the generic template for the email:


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 n ; send notifications for all service states, flapping events, and scheduled downtime events
# service_notification_options w,u,c,r,f,s ; send notifications for all service states, flapping events, and scheduled downtime events
host_notification_options n ; send notifications for all host 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!
(have it disabled for now because of problem)


Thanks for any help on this
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: email alerts

Post by jsmurphy »

Are you also able to provide a service or host definition that has experienced a problem and has sent an email to all members and not just you?
rkobliski
Posts: 21
Joined: Fri Jan 27, 2012 4:04 pm
Location: Rincon, GA

Re: email alerts

Post by rkobliski »

If i replace $CONTACTEMAIL$ in the commands.cfg with my email address it works. I can work with this solution till i find a fix for the other problem. So if i can find where it pulls the info for the contacts ( which i thought was just me) i should be able to fix this right?
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: email alerts

Post by jsmurphy »

Yes, this is why I am suggesting that you check your host or service definitions to ensure that additional contacts aren't defined there or in the templates.
Locked