Increase max_check_attemps

Hello everyone
Is there a way to increase max_check_attemps of hostalive just for specific service of host

Or disable notification for a service of specific host permanently?

The issue is in normal situation this specific host has 30% to 60% packet loss which is not important for me. The other services is very important and I need to receive notifications is one of the service goes down
When I add host , by default Icinga2 will add hostalive service and start pinging the host.
So I receive notification every 5 min.
I can not change max_check_attemps in template because it will effect in all hosts.
So I am looking for a way to disable notification on this specific service of host

Thank you for sharing your knowledge with me in advance

Hello everyone
Is there a way to increase max_check_attemps of hostalive just for specific
service of host

a) hostalive is a host check, not a service check

b) yes, simply define max_check_attempts=whatever in the definition for that
host.

Or disable notification for a service of specific host permanently?

Yes, define “enable_notifications=false” for that service check.

The issue is in normal situation this specific host has 30% to 60% packet
loss which is not important for me.

I’m surprised you think that’s not important, but it’s your network :slight_smile:

The other services is very important and I need to receive notifications is
one of the service goes down

Okay, so we seem to be talking about the host check based on ICMP packet
loss, which you’re not too bothered about, versus the service checks for
that host, which you do care about.

When I add host , by default Icinga2 will add hostalive service and start
pinging the host. So I receive notification every 5 min.

Personally I would change the notification interval, because even if there is a
problem you’re interested in knowing about, you don’t want to be told about it
every 5 minutes.

I can not change max_check_attemps in template because it will effect in
all hosts. So I am looking for a way to disable notification on this
specific service of host

All you need to do is define max_check_attempts in that host’s definition, and
it will over-ride the template.

Anything in a template can be over-ridden by re-defining it in the service or
host check based on that template.

Regards,

Antony.

1 Like

Thank you so much for complete explanation

the host packet loss is not important because it is iDrac of Dell server :slight_smile: it doesn’t have effect on service and the service until we will be able to change the card.

I add max_check attempt in service and host

Host.conf

object Host "idrac.xxxx.xxxx.xx"{
import "generic-host"      
display_name="idrac.xxxx.xxxx.xx"
address="x.x.x.x"  
vars.community = "public"
check_command="hostalive"             
max_check_attempts = 10
  check_interval = 4m                 
  retry_interval = 1m    
vars.os = "idrac"        
vars.notification["mail"] = {
groups = [ "icingaadmins" ]
}
}                  

service.conf

apply Service "Server Memory" {
import "generic-service"  
check_command = "dell-idrac"
vars.community = "public"
vars.hardware = "MEM"
max_check_attempts = 5
check_interval = 4m
retry_interval = 1m
assign where host.address && host.vars.os == "idrac"
}
apply Service "Server CPU" {
import "generic-service"
check_command = "dell-idrac"        
vars.community = "public"          
vars.hardware = "CPU"
max_check_attempts = 5
check_interval = 4m  
retry_interval = 1m
assign where host.address && host.vars.os == "idrac"
}
apply Service "Server RAID" {
import "generic-service"
check_command = "dell-idrac"
vars.community = "public"
vars.hardware = "VDISK"
max_check_attempts = 5
check_interval = 4m  
retry_interval = 1m
assign where host.address && host.vars.os == "idrac"
}
apply Service "Server DISK" {
import "generic-service"
check_command = "dell-idrac"
vars.community = "public"
vars.hardware = "DISK"
vars.alert = "-n"
max_check_attempts = 5
check_interval = 4m  
retry_interval = 1m
assign where host.address && host.vars.os == "idrac"
}
apply Service "Server PSU" {
import "generic-service"
check_command = "dell-idrac"
vars.community = "public"
vars.hardware = "PS"
 vars.MIN_MAX= "0.0,2.0"     
max_check_attempts = 5   
check_interval = 4m  
retry_interval = 1m   
assign where host.address && host.vars.os == "idrac"
}                  
apply Service "iDrac Server FAN " {
import "generic-service"
check_command = "dell-idrac"          
vars.community = "public"
vars.hardware = "FAN"               
vars.MIN_MAX = "3500,7000"         
max_check_attempts = 5
check_interval = 4m   
retry_interval = 1m  
assign where host.address && host.vars.os == "idrac"
}
apply Service "Server TEMP" {  
import "generic-service"     
check_command = "dell-idrac"
vars.community = "public"          
vars.hardware = "SENSOR" 
vars.MIN_MAX = "10,70" 
max_check_attempts = 5
check_interval = 4m  
retry_interval = 1m
assign where host.address && host.vars.os == "idrac"
}
apply Service "Server BATTERY" {
import "generic-service"            
check_command = "dell-idrac"      
vars.community = "public"
vars.hardware = "BATTERY"
max_check_attempts = 5
check_interval = 4m   
retry_interval = 1m  
assign where host.address && host.vars.os == "idrac"
}

but the max check attempts is still 4
would you please let me know , where is my issue

Hi Ali,
welcome to the community :slight_smile:

I have edited your post for better readability of the config snippets.

Please use the code formatting (backticks ```) in the future, so that it is easier for people to read :slight_smile:
You find a overview of the editor options here:

back to topic :slight_smile:

And that is correct.
You changed the max_check_attempts for the host object. If you click on the hostname in Icinga Web 2 you will see that they will have changed to 10.
If you want to raise the max_check_attempts of the ping4 service, you will have to edit the service template/apply rule.
I suspect that the ping4 service comes from the example configuration under /etc/icinga2/conf.d/

Be aware that changing the config of the ping4 service will probably change all ping4 services, as it is just an example service check that is distributed to every host object.
I personally don’t use a ping service check generally, just in small doses :wink:

1 Like