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.
amprantino
Posts: 140 Joined: Thu Apr 18, 2013 8:25 am
Location: libexec
Post
by amprantino » Thu Jul 28, 2016 2:41 am
I am using a cumulative service definition for all hosts:
Code: Select all
define service{
use generic-service
host_name server1,servr2,server3.....,serverN
service_description REACHABLE
is_volatile 0
check_period 24x7
max_check_attempts 5
normal_check_interval 10
retry_check_interval 2
contact_groups sys-admins
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_ping!900.0,60%!1500.0,79%
}
Suddenly, a request arrived asking a new contact_group to be added for server2 and server5.
Is there a way to add it without creating a separate service definition for these two servers?
ssax
Dreams In Code
Posts: 7682 Joined: Wed Feb 11, 2015 12:54 pm
Post
by ssax » Thu Jul 28, 2016 2:14 pm
My recommendation would be to define the contact groups on the host and not on the services so they would be inherited by the service for each host.
https://assets.nagios.com/downloads/nag ... tance.html
Like this:
Code: Select all
define service{
use generic-service
host_name server1,servr2,server3.....,serverN
service_description REACHABLE
is_volatile 0
check_period 24x7
max_check_attempts 5
normal_check_interval 10
retry_check_interval 2
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_ping!900.0,60%!1500.0,79%
}
Code: Select all
define host {
host_name server1
use linux-server
alias localhost
contact_groups sys-admins
address 127.0.0.1
register 1
}
define host {
host_name server2
use linux-server
alias localhost
contact_groups sys-admins,other-contact-group
address 127.0.0.1
register 1
}
define host {
host_name server5
use linux-server
alias localhost
contact_groups sys-admins,other-contact-group
address 127.0.0.1
register 1
}
amprantino
Posts: 140 Joined: Thu Apr 18, 2013 8:25 am
Location: libexec
Post
by amprantino » Wed Oct 19, 2016 2:40 am
Probably I am doing something wrong:
host definition
Code: Select all
define host {
host_name server1
alias server1_alias
address 192.168.1.1
parents myparent
check_command check-host-alive
max_check_attempts 2
process_perf_data 0
retain_nonstatus_information 1
notification_interval 120
notification_period 24x7
notification_options d,u,r
contact_groups group1,group2
contacts user1,user2
}
service definition
Code: Select all
define service{
use generic-service
host_name server1
service_description Service1_definition
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 60
retry_check_interval 1
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_command
}
When the service is down, only the contacts in "generic-service" will get the notification.
Am I missing something here?
amprantino
Posts: 140 Joined: Thu Apr 18, 2013 8:25 am
Location: libexec
Post
by amprantino » Wed Oct 19, 2016 4:56 am
I had to remove "use generic-service" under service definition
rkennedy
Posts: 6579 Joined: Mon Oct 05, 2015 11:45 am
Post
by rkennedy » Wed Oct 19, 2016 1:17 pm
Just to make sure - were you able to get this resolved? It looks like the template may have been inheriting when you did not want it to.
Former Nagios Employee
amprantino
Posts: 140 Joined: Thu Apr 18, 2013 8:25 am
Location: libexec
Post
by amprantino » Wed Oct 19, 2016 1:28 pm
Yes, exactly.
Also, can you please define if +contacgroup or -contactgrop are working inside a contact definition?
avandemore
Posts: 1597 Joined: Tue Sep 27, 2016 4:57 pm
Post
by avandemore » Wed Oct 19, 2016 4:09 pm
I'm not sure I understand your question. Does this document help?
Object Definitions
If not, can you rephrase the question?
Previous Nagios employee
avandemore
Posts: 1597 Joined: Tue Sep 27, 2016 4:57 pm
Post
by avandemore » Thu Oct 20, 2016 12:41 pm
This is our offical documentation for
Object Inheritance
The url you linked to may or may not contain correct information. At the very least, its reported posting date is prior to any currently supported version.
Previous Nagios employee
amprantino
Posts: 140 Joined: Thu Apr 18, 2013 8:25 am
Location: libexec
Post
by amprantino » Thu Oct 20, 2016 12:49 pm
Yes,
are those +/- supported in nagios?
Because I couldn't find in the official documentation