Changeset 3406

Show
Ignore:
Timestamp:
03/08/10 15:24:59 (2 years ago)
Author:
ligne
Message:

Enable node-side support for dirtyconfig, as discussed in http://munin-monitoring.org/wiki/protocol-dirty-fetch

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/node/lib/Munin/Node/Server.pm

    r3404 r3406  
    2424 
    2525# Services that require the server to support multigraph plugins. 
    26 my @multigraph_services
     26my (@multigraph_services, @dirtyconfig_services)
    2727 
    2828# Which hosts this node's services applies to. Typically this is the 
     
    8989                || (split /\s+/, ($host_name || ''))[1] 
    9090                || $config->{fqdn}; 
    91          
    92         # hostname checks are case in-sensitive,  
    93         # so store everything in lowercase 
    94         $node = lc($node); 
     91 
     92        # hostname checks are case insensitive, so store everything in lowercase 
     93        $node = lc($node); 
    9594 
    9695        print STDERR "\tAdding to node $node\n" if $config->{DEBUG}; 
     
    9998        # Note any plugins that require particular server capabilities. 
    10099        if (grep /^multigraph\s+/, @response) { 
    101             print STDERR "\tAdding to multigraph plugins\n" 
    102                 if $config->{DEBUG}; 
     100            print STDERR "\tAdding to multigraph plugins\n" if $config->{DEBUG}; 
    103101            push @multigraph_services, $service; 
     102        } 
     103        if (grep /^[A-Za-z0-9_]+\.value /, @response) { 
     104            # very dirty plugins -- they do a dirtyconfig even when 
     105            # "not allowed" by their environment. 
     106            print STDERR "\tAdding to dirty plugins\n" if $config->{DEBUG}; 
     107            push @dirtyconfig_services, $service; 
    104108        } 
    105109    } 
     
    217221    my ($session, $server_capabilities) = @_; 
    218222 
    219     my @node_cap = qw( multigraph ); 
     223    my @node_cap = qw/ 
     224        multigraph 
     225        dirtyconfig 
     226    /; 
     227     
    220228    $session->{server_capabilities} = { 
    221229            map { $_ => 1 } split(/ /, $server_capabilities) 
    222230    }; 
     231 
     232    $ENV{MUNIN_CAP_DIRTYCONFIG} = 1 if ($session->{server_capabilities}{dirtyconfig}); 
    223233 
    224234    _net_write($session, sprintf("cap %s\n",join(" ", @node_cap))); 
     
    301311 
    302312    if (exists $nodes{$node}) { 
    303         # remove any plugins that require capabilities the server doesn't provide 
    304313        my @services = @{$nodes{$node}}; 
     314 
     315        # remove any plugins that require capabilities the master doesn't support 
    305316        @services = Munin::Node::Utils::set_difference(\@services, \@multigraph_services) 
    306317            unless $session->{server_capabilities}{multigraph}; 
     318        @services = Munin::Node::Utils::set_difference(\@services, \@dirtyconfig_services) 
     319            unless $session->{server_capabilities}{dirtyconfig}; 
    307320 
    308321        _net_write($session, join(" ", @services));