Mail Stopped working...

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.
User avatar
ruffsense
Posts: 140
Joined: Thu Apr 11, 2013 12:40 am

Mail Stopped working...

Post by ruffsense »

Can anyone help me out...

I will start from the top....my (commands.cfg)

Code: Select all

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$
	register                       	1
}	

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$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
	register                       	1
}	
my(conatcts.cfg)

Code: Select all

define contact {
        contact_name                    helpdesk
        alias                           Helpdesk
        host_notifications_enabled      1
        service_notifications_enabled   1
        host_notification_period        24x7
        service_notification_period     24x7
        host_notification_options       d,u,r,f,s
        service_notification_options    w,u,c,r,f,s
        host_notification_commands      notify-host-by-email
        service_notification_commands   notify-service-by-email
        email                           [email protected]
        use                             generic-contact
        register                        1
        }
my(contactgroups.cfg)

Code: Select all

define contactgroup {
        contactgroup_name               admins
        alias                           Nagios Administrators
        members                         helpdesk
        register                        1
}
Still is my mail que empty...

Code: Select all

# sendmail -bp
/var/spool/mqueue is empty
                Total requests: 0
Is there something im missin'?
Last edited by ruffsense on Thu Apr 25, 2013 5:48 am, edited 2 times in total.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Mail Stopped working...

Post by slansing »

Can you verified that either the contactgroup displayed, or the contact itself is attached to a host/service that went into a state change that it will notify on?
User avatar
ruffsense
Posts: 140
Joined: Thu Apr 11, 2013 12:40 am

Re: Mail Stopped working...

Post by ruffsense »

slansing wrote:Can you verified that either the contactgroup displayed, or the contact itself is attached to a host/service that went into a state change that it will notify on?
Im a bit a newbie but where can i check that?
User avatar
ruffsense
Posts: 140
Joined: Thu Apr 11, 2013 12:40 am

Re: Mail Stopped working...

Post by ruffsense »

do you mean the nagios.cfg?

cgi_file?
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: Mail Stopped working...

Post by gshergill »

Hi ruffsense,

He means in one of your .cfg files (services.cfg, hosts.cfg, templates.cfg, or wherever you have defined it), can you verify that the contact/contact_group given is attached to the host which went down, i.e. the host you wanted to see the notification for.

Was your notification mails working before?

Thank you.

Kind Regards,

Gary Shergill
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Mail Stopped working...

Post by scottwilkerson »

Correct.

ruffsense, can you post the .cfg for the host/service you expect to get mail for.

Thanks.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
ruffsense
Posts: 140
Joined: Thu Apr 11, 2013 12:40 am

Re: Mail Stopped working...

Post by ruffsense »

scottwilkerson wrote:Correct.

ruffsense, can you post the .cfg for the host/service you expect to get mail for.

Thanks.
They are good. The problem seems that the /var/mail/nagios is empty
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Mail Stopped working...

Post by abrist »

In the core interface, are there any recent notifications listed in the "notifications" page?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
ruffsense
Posts: 140
Joined: Thu Apr 11, 2013 12:40 am

Re: Mail Stopped working...

Post by ruffsense »

abrist wrote:In the core interface, are there any recent notifications listed in the "notifications" page?
Nope is there away i can test the mail in nagios by creating a fake warning are problem?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Mail Stopped working...

Post by slansing »

You can visit the service details page of one of your services and use the "Send custom service notification" button to send a test notification, this will be sent to contacts assigned to the configuration file.
Locked