Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#61 Build Instance exports unused servicegroup escalations

open
nobody
None
5
2007-04-10
2007-04-10
Joshua Megerman
No

When I build an instance, it's exporting all of the servicegroup escalations in the service_escalations file, even though it's not exporting the servicegroups because they aren't used for this instance. This causes the pre-flight to fail, because it references non-existant servicegroups. I'm going to take a look at the code, but if anyone can give me pointers on where to look for this, I'd appreciate it. I'd also like to remove unnecessary contacts and contactgroups, but at least they just throw warnings and not errors...

Discussion

  • Logged In: YES
    user_id=216594
    Originator: YES

    And here's the fix - it took some debug code to figure out what to look for, but I got it :) The problem was setting the use flag on the various servicegroups outside the test to see if the servicegroup was actually being used... The patch below shows moving the line inside the if and resolving the problem (verified by checkig both the grouped instance and the main instance).

    --- MonarchFile.pm.orig.2.0.2 2007-04-05 13:56:58.000000000 -0400
    +++ MonarchFile.pm 2007-04-10 11:54:14.000000000 -0400
    @@ -791,8 +791,9 @@
    }
    # for every entry of the service in a service group create an entry for each instance (i.e. label on group)
    foreach my $sg (keys %service_groups) {
    - $use{'servicegroups'}{$sg} = 1;
    +# $use{'servicegroups'}{$sg} = 1;
    if ($service_groups{$sg}{'hosts'}{$host_name{$host}}{$sid}) {
    + $use{'servicegroups'}{$sg} = 1;
    $service_groups{$sg}{'members'} .= "$host,$svcdesc,";
    }
    }