Changeset 1494
- Timestamp:
- 02/26/08 23:37:49 (4 years ago)
- Files:
-
- people/jo/multilevel-groups-2/server/Munin.pm.in (modified) (3 diffs)
- people/jo/multilevel-groups-2/server/munin-graph.in (modified) (1 diff)
- people/jo/multilevel-groups-2/server/munin-limits.in (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
people/jo/multilevel-groups-2/server/Munin.pm.in
r1493 r1494 413 413 # Parameters: 414 414 # - $hash: A hash ref to search 415 # - $field: The name of the field to search for 415 # - $field: The name of the field to search for, or a regex 416 416 # - $avoid: [optional] Stop traversing further down if this field is found 417 417 # Returns: … … 424 424 my $res = []; 425 425 426 if (ref ($field) ne "Regexp") { 427 if ($field =~ /^\^/) { 428 $field = qr/^$field$/; 429 } else { 430 $field = qr/$field/; 431 } 432 } 433 426 434 if (ref ($hash) eq "HASH") { 427 435 ::logger ("Debug: Searching for $field in " . join ('::', @{munin_get_node_loc ($hash)})); … … 429 437 next if $key =~ /^#%#/; 430 438 last if defined $avoid and $key eq $avoid; 431 if ($key eq$field) {439 if ($key =~ $field) { 432 440 push @$res, $hash; 433 441 } elsif (ref ($hash->{$key}) eq "HASH") { people/jo/multilevel-groups-2/server/munin-graph.in
r1353 r1494 540 540 $field = munin_get_node ($service, [$fname]); 541 541 542 next if !process_field ($field);542 next if (!defined $field or !$field or !process_field ($field)); 543 543 logger ("DEBUG: Processing field \"$fname\" [".munin_get_node_name($field)."].") if $DEBUG; 544 544 people/jo/multilevel-groups-2/server/munin-limits.in
r1493 r1494 106 106 } 107 107 108 for my $domain ( keys %{$config->{domain}}) { 109 logger ("processing domain: $domain");110 process_domain($domain);111 } 108 # Make array of what is probably to check for notifications 109 my $work_array = []; 110 push @$work_array, map { munin_get_parent_node ($_) } @{munin_find_field($config, qr/^(critical|warning|crit|warn)$/)}; 111 112 112 &munin_writeconfig ("$config->{dbdir}/limits", \%notes); 113 113 … … 116 116 logger("munin-limits finished ($update_time sec)"); 117 117 118 sub process_group { 119 my $hash = shift || return undef; 120 my $name = munin_get_node_name ($hash); 121 122 if ($hash and ref ($hash) eq "HASH") { 123 if (defined $hash->{'graph_title'}) { # Graph, need to check limits 124 logger ("processing plugin: $name") if $DEBUG; 125 process_service ($hash); 126 } else { 127 foreach my $childobj (munin_get_children ($hash)) { 128 next unless ref ($childobj) eq "HASH"; 129 logger ("processing group: $name") if $DEBUG; 130 process_group ($childobj); 131 } 132 } 133 } 134 } 118 print Data::Dumper ($work_array); 119 120 exit 0; 135 121 136 122 sub process_service { … … 144 130 145 131 # Some fields that are nice to have in the plugin output 146 $hash->{'fields'} = join (' ', map { munin_get_node_name ($_) } @$children) );132 $hash->{'fields'} = join (' ', map { munin_get_node_name ($_) } @$children); 147 133 $hash->{'plugin'} = $service; 148 134 $hash->{'graph_title'} = $hash->{'notify_alias'} if defined $hash->{'notify_alias'};
