LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-11-2016, 11:42 PM   #1
dexfcoss
LQ Newbie
 
Registered: Apr 2016
Posts: 13

Rep: Reputation: Disabled
nagios email notification problem


Hi all,
I am using nagios 4.2 to monitor our local servers. But we face some problem on email notification function. if i set the host 'max_check_attempts' > 1, nagios will never send email notification to contact groups. If set the 'max_check_attempts' = 1, everything is normal. Email notification will send immediately if any service down. However, we don't want too many false alarm and want to set the max_check_attempts to 2. Can anyone help me? I am using amazon ec2 linux instance. Thanks. Below is the config of nagios.



host1.cfg

define hostgroup{
hostgroup_name hostgroup1
alias hostgroup1
}

define host {
use linux-server
host_name host1
hostgroups hostgroup1
alias host1
address xx.xx.xx.xx
register 1
}

define service{
host_name host1
service_description PING
check_command check_ping!150.0,20%!500.0,60%
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
}

define service{
use generic-service
host_name host1
service_description Server HTTP URL available check
check_command check_http! -H xxxxxxxxxxxx -u xxxxxxxxxxxxxx -w 8
max_check_attempts 2
check_interval 2
check_period 24x7
}



contacts.cfg

define contact{
contact_name nagiosadmin
use generic-contact
alias Nagios Admin

email xxxxxxxxxxxxxxxx
service_notification_commands notify-service-by-email
host_notification_commands notify-service-by-email
}



define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagiosadmin
}


templates.cfg

define contact{
name generic-contact
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r,f,s
host_notification_options d,u,r,f,s
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
register 0
}


Best Regards,
Kelvin

Last edited by dexfcoss; 08-11-2016 at 11:44 PM.
 
Old 08-12-2016, 02:42 AM   #2
dexfcoss
LQ Newbie
 
Registered: Apr 2016
Posts: 13

Original Poster
Rep: Reputation: Disabled
Hi all,
There are some additional information in nagios.log. I found that the status of service changed to 'HARD' but still no SERVICE NOTIFICATION. But the host check is normal. What am I doing wrong here?


[1470986558] SERVICE ALERT: xxxxxxxxx;PING;CRITICAL;SOFT;1;PING CRITICAL - Packet loss = 100%
[1470986588] HOST ALERT: xxxxxxxxx;DOWN;SOFT;1;PING CRITICAL - Packet loss = 100%
[1470986650] SERVICE ALERT: xxxxxxxxx;Server HTTP URL available check;CRITICAL;SOFT;1;CRITICAL - Socket timeout
[1470986678] SERVICE ALERT: xxxxxxxxx;PING;CRITICAL;HARD;2;PING CRITICAL - Packet loss = 100%
[1470986678] HOST ALERT: xxxxxxxxx;DOWN;SOFT;2;PING CRITICAL - Packet loss = 100%
[1470986768] HOST ALERT: xxxxxxxxx;DOWN;SOFT;3;PING CRITICAL - Packet loss = 100%
[1470986770] SERVICE ALERT: xxxxxxxxx;Server HTTP URL available check;CRITICAL;HARD;2;CRITICAL - Socket timeout
[1470986800] HOST ALERT: xxxxxxxxx;DOWN;SOFT;4;PING CRITICAL - Packet loss = 100%
[1470986890] HOST ALERT: xxxxxxxxx;DOWN;SOFT;5;PING CRITICAL - Packet loss = 100%
[1470986948] HOST ALERT: xxxxxxxxx;DOWN;SOFT;6;PING CRITICAL - Packet loss = 100%
[1470987038] HOST ALERT: xxxxxxxxx;DOWN;SOFT;7;PING CRITICAL - Packet loss = 100%
[1470987128] HOST ALERT: xxxxxxxxx;DOWN;SOFT;8;PING CRITICAL - Packet loss = 100%
[1470987150] SERVICE ALERT: xxxxxxxxx;Server HTTP URL available check;CRITICAL;SOFT;1;CRITICAL - Socket timeout
[1470987150] SERVICE ALERT: xxxxxxxxx;Server HTTP URL available check;CRITICAL;SOFT;1;CRITICAL - Socket timeout
[1470987160] HOST ALERT: xxxxxxxxx;DOWN;SOFT;9;PING CRITICAL - Packet loss = 100%
[1470987250] HOST ALERT: xxxxxxxxx;DOWN;HARD;10;PING CRITICAL - Packet loss = 100%
[1470987250] HOST NOTIFICATION: nagiosadmin;xxxxxxxxx;DOWN;notify-service-by-email;PING CRITICAL - Packet loss = 100%
 
Old 08-13-2016, 03:31 AM   #3
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,806

Rep: Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207
But you get the Host DOWN notification?
It looks like its soft state blocks the service notifications.
If you stop http while ping still works then you should get the service notification.
 
1 members found this post helpful.
Old 08-15-2016, 02:18 AM   #4
dexfcoss
LQ Newbie
 
Registered: Apr 2016
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by MadeInGermany View Post
But you get the Host DOWN notification?
It looks like its soft state blocks the service notifications.
If you stop http while ping still works then you should get the service notification.
It seems that you are right. If only http down, nagios will send the service notification to us. So this is the nagios default function that will ignore the service notification if the host is down? Thanks.
 
Old 08-15-2016, 09:27 AM   #5
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,806

Rep: Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207
Yes, I think the service alert suppression is a feature.
Normally you have a dozen service checks per host, and you want to only get the Host DOWN notification.
For example see this article
 
1 members found this post helpful.
Old 08-17-2016, 03:14 AM   #6
dexfcoss
LQ Newbie
 
Registered: Apr 2016
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by MadeInGermany View Post
Yes, I think the service alert suppression is a feature.
Normally you have a dozen service checks per host, and you want to only get the Host DOWN notification.
For example see this article
Well, i think the host down notification is enough. Thanks MadeInGermany
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Nagios and email Sound notification kwaslee Linux - Software 3 05-28-2012 06:17 PM
Nagios - email notification - How to receive alert email? kumaran1983 Linux - Newbie 4 10-20-2011 06:12 AM
Nagios Email Notification zoomzatag Linux - Newbie 4 07-20-2011 04:23 AM
HELP! Nagios email notification using Postfix tagzfernando Linux - Newbie 14 02-16-2011 08:08 PM
HELP! Nagios email notification using Postfix tagzfernando Linux - Networking 2 02-15-2011 03:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration