Derive service settings from hosts definition

Vladislav Staroselskiy vstaroselskiy at dataraker.com
Mon Jul 30 20:31:48 CEST 2012


Hello!

Is there any way to derive certain service options from the host definition? Is there any default inheritance behavior for it?

I.e.:
--- cut ---
define service {
        use                                 production-service
        hostgroup_name          ping
        contacts                        derive_from_host
        contact_groups            derive_from_host
        notification_period      derive_from_host
        notifications_enabled  derive_from_host
        notification_interval    derive_from_host
}
--- cut ---

Below I will try to describe the actual problem, which lead me to this question. I have a number of services and hosts, tied up to 
each other via hostgroups (logically grouped by a service type). It's pretty convenient to manage them this way. For example:

--- cut ---
define host{
        use                     production-host
        host_name        server1
        address              192.168.0.1
        hostgroups         ping,linux,web,mysql,snmp,nrpe
}
[...number of other hosts with similar definitions...]
define hostgroup {
        hostgroup_name          ping
        alias                               ICMP Ping Group
}
[...number of other hostgroups...]
define service {
        use                             production-service
        hostgroup_name                  ping
        service_description              PING
        check_command                   check_ping!200.0,20%!500.0,60%
}
[...number of other services, related to defined hostgroups...]
--- cut ---

>From alerting prospective, all my environment can be grouped into "production", "development", "qa" and "dummy", where each group 
has it's own contact list and notification options (matching for both service and host checks). So, I have 4 different host 
templates and 4 service templates with properly defined contacts and notification options (i.e. 
"production-host/production-service", "dev-host/dev-service", etc.).

What is killing me at this moment, is the fact, that in order to send proper service alerts to these groups, I also have to keep 4 
(nearly identical !) sets of services and hostgroups:

--- cut ---
define host{
        use                     dev-host
        host_name        dev-server1
        address              192.168.1.1
        hostgroups         dev-ping,dev-linux,dev-web,dev-mysql,dev-snmp,dev-nrpe
}
[...number of other hosts with similar definitions...]
define hostgroup {
        hostgroup_name          dev-ping
        alias                               ICMP Ping Group for Development
}
[...number of other "dev" hostgroups...]
define service {
        use                                         dev-service
        hostgroup_name                  dev-ping
        service_description              PING
        check_command                   check_ping!200.0,20%!500.0,60%
}
[...number of other services, related to "dev" hostgroups...]

[...also repeated twice for "qa" and "dummy" groups...]
--- cut ---

I really wish, service notification/contact options could be derived from hosts definitions to avoid this mess. If anyone has a 
suggestion on how to better organize it, I would also appreciate your feedback.


Vlad.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list