[Functionality proposal]Service on host override service on host group

nap naparuba at gmail.com
Wed Apr 8 13:16:31 CEST 2009


Hi,

Here is the patch for those who whant to test.


Gabès Jean

On Tue, Apr 7, 2009 at 10:05 AM, nap <naparuba at gmail.com> wrote:
> Hi,
>
> I'm currently writing a patch (too much ugly for posting for the
> moment...) for allowing a service define on a host override a service
> define on a host group. We can override object property by inheritance
> (template, multiple inheritance, ...). But with services define on
> hosts groups, we cannot change just one or two services. We can modify
> the command to take custom object variables and make exception for a
> host, but it's not easy. Ce can use external command, but if you lose
> the retention.dat, you loose all exceptions. If we can just add a new
> service on the host with the same name, we can simply override the
> "host group" service with a new one, and all expetions are in the
> configuration.
>
> For example, with the "normal" behavior and this definition (srv-1 in
> the host group all-server):
>
> define service{
>        use     generic-service
>        hostgroup_name       all-server
>        service_description     service-test
>        check_command   check_ping
> }
>
> define service{
>        use     generic-service
>        host_name       srv-1
>        service_description     service-test
>        check_command   check_local_disk
> }
>
> The check_ping (host group definition) win. Whatever you put the
> check_local_disk declaration before or after the check_ping one. This
> is because of the skiplist_insert use in
> xodtemplate_duplicate_services (xdata/xodtemplate.c, line 5221) : the
> configuration reads all services in the configurations file, but with
> the xodtemplate_duplicate_service (explode of a service for all hosts
> of a hostgroup) (line 5187), the "host group" services are add in the
> beginning of the list. So, they are sure to won the skiplist_insert
> because the loop add services by the beginning.
>
> I add a is_from_hostgroup boolean parameter to the xodtemplate_service
> structure. This parameter is FALSE at the creation, but put in TRUE
> while a xodtemplate_duplicate_service. I duplicate the loop that add
> services in the skip_list:
> *the first loop add only the "host" services (by looking at
> is_from_hostgroup==FALSE),
> *the second loop add only the "host group" services (by looking at
> is_from_hostgroup==TRUE).
>
> With this modification, the "host group" services arrived after the
> "host" service, so they loose. check_local_disk win.
>
>
> What do you think about this override system? I'm need such behavior
> in my configuration, so I think more people do.
> I know this is not the normal behavior, maybe we can add a new
> nagios.cfg "allow_service_hostgroup_override", but I think this can
> become the new "standard" behavior some day?
>
> If someone is interested by this patch, I'll clean it and I'll post it.
>
> Thanks,
>
>
> Gabès Jean
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: changepriority_service_on_hostgroup.patch
Type: text/x-patch
Size: 4281 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20090408/13d5c977/attachment.bin>
-------------- next part --------------
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list