Changeset 610

Show
Ignore:
Timestamp:
05/01/05 19:32:49 (7 years ago)
Author:
jimmyo
Message:

Main: Tables in service-view now containt the correct "Type" when using data aliases.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    • Property cvs2svn:cvs-rev changed from 1.257 to 1.258
    r609 r610  
    88  * Main: Bugfix with graphs using both "graph_sums" and data aliases. 
    99  * Main: Tables in service-view now sorted according to graph_order. 
     10  * Main: Tables in service-view now containt the correct "Type" when using 
     11    data aliases. 
    1012  * Plugins: generic/sendmail_mail{stats,traffic} updated. 
    1113  * Plugins: Made generic/samba more portable (fixes by Nicolas Stransky). 
  • trunk/server/Munin.pm.in

    • Property cvs2svn:cvs-rev changed from 1.43 to 1.44
    r609 r610  
    2323# 
    2424# $Log$ 
     25# Revision 1.44  2005/01/05 18:32:49  jimmyo 
     26# Main: Tables in service-view now containt the correct "Type" when using data aliases. 
     27# 
    2528# Revision 1.43  2005/01/05 18:08:01  jimmyo 
    2629# Main: Tables in service-view now sorted according to graph_order. 
     
    245248           'munin_graph_column_headers', 
    246249           'munin_get_max_label_length', 
    247            'munin_get_field_order' 
     250           'munin_get_field_order', 
     251           'munin_get_rrd_filename' 
    248252           ); 
    249253 
     
    279283my %legal_expanded = map { $_ => 1 } @legal; 
    280284 
     285# Fields to copy when "aliasing" a field 
     286my @copy_fields    = ("label", "draw", "type", "rrdfile", "fieldname", "info");  
     287 
     288 
    281289sub munin_trend { 
    282290    my (@array) = @_; 
     
    10981106} 
    10991107 
     1108sub munin_get_rrd_filename { 
     1109    my $node    = shift; 
     1110    my $config  = shift; 
     1111    my $domain  = shift; 
     1112    my $name    = shift; 
     1113    my $service = shift; 
     1114    my $field   = shift; 
     1115    my $path    = shift; 
     1116    my $result  = "unknown"; 
     1117 
     1118    if ($node->{client}->{$service}->{$field.".filename"}) 
     1119    { 
     1120        $result = $node->{client}->{$service}->{$field.".filename"}; 
     1121    } 
     1122    elsif ($path) 
     1123    { 
     1124        if (!defined ($node->{client}->{$service}->{$field.".label"})) 
     1125        { 
     1126            print "DEBUG: Setting label: $field\n" if $DEBUG; 
     1127            $node->{client}->{$service}->{$field.".label"} = $field; 
     1128        } 
     1129 
     1130        if ($path =~ /^\s*([^:;]+)[:;]([^:]+):([^:\.]+)[:\.]([^:\.]+)\s*$/) 
     1131        { 
     1132            $result = munin_get_filename ($config, $1, $2, $3, $4); 
     1133            print "\nDEBUG1: Expanding $path...\n" if $DEBUG; 
     1134            if (! defined $node->{client}->{$service}->{$field."label"}) 
     1135            { 
     1136                for my $f (@copy_fields) 
     1137                { 
     1138                    if (not exists $node->{client}->{$service}->{"$field.$f"} and 
     1139                            exists $config->{'domain'}->{$1}->{'node'}->{$2}->{'client'}->{$3}->{"$4.$f"}) 
     1140                    { 
     1141                        $node->{client}->{$service}->{"$field.$f"} = $config->{'domain'}->{$1}->{'node'}->{$2}->{'client'}->{$3}->{"$4.$f"}; 
     1142                    } 
     1143                } 
     1144            } 
     1145        } 
     1146        elsif ($path =~ /^\s*([^:]+):([^:\.]+)[:\.]([^:\.]+)\s*$/) 
     1147        { 
     1148            print "\nDEBUG2: Expanding $path...\n" if $DEBUG; 
     1149            $result = munin_get_filename ($config, $domain, $1, $2, $3); 
     1150            for my $f (@copy_fields) 
     1151            { 
     1152                if (not exists $node->{client}->{$service}->{"$field.$f"} and 
     1153                        exists $config->{'domain'}->{$domain}->{'node'}->{$1}->{'client'}->{$2}->{"$3.$f"}) 
     1154                { 
     1155                    print "DEBUG: Copying $f...\n" if $DEBUG; 
     1156                    $node->{client}->{$service}->{"$field.$f"} = $config->{'domain'}->{$domain}->{'node'}->{$1}->{'client'}->{$2}->{"$3.$f"}; 
     1157                } 
     1158            } 
     1159        } 
     1160        elsif ($path =~ /^\s*([^:\.]+)[:\.]([^:\.]+)\s*$/) 
     1161        { 
     1162            print "\nDEBUG3: Expanding $path...\n" if $DEBUG; 
     1163            $result = munin_get_filename ($config, $domain, $name, $1, $2); 
     1164            for my $f (@copy_fields) 
     1165            { 
     1166                if (not exists $node->{client}->{$service}->{"$field.$f"} and 
     1167                        exists $node->{client}->{$1}->{"$2.$f"}) 
     1168                { 
     1169                    $node->{client}->{$service}->{"$field.$f"} = $node->{client}->{$1}->{"$2.$f"}; 
     1170                } 
     1171            } 
     1172        } 
     1173        elsif ($path =~ /^\s*([^:\.]+)\s*$/) 
     1174        { 
     1175            print "\nDEBUG4: Expanding $path...\n" if $DEBUG; 
     1176            $result = munin_get_filename ($config, $domain, $name, $service, $1); 
     1177            for my $f (@copy_fields) 
     1178            { 
     1179                if (not exists $node->{client}->{$service}->{"$field.$f"} and 
     1180                        exists $node->{client}->{$service}->{"$1.$f"}) 
     1181                { 
     1182                    $node->{client}->{$service}->{"$field.$f"} = $node->{client}->{$service}->{"$1.$f"}; 
     1183                } 
     1184            } 
     1185        } 
     1186    } 
     1187    else 
     1188    { 
     1189        print "\nDEBUG5: Doing path...\n" if $DEBUG; 
     1190        $result = munin_get_filename($config, $domain,$name,$service,$field); 
     1191    } 
     1192    return $result; 
     1193} 
     1194 
    11001195 
    110111961; 
  • trunk/server/munin-graph.in

    • Property cvs2svn:cvs-rev changed from 1.50 to 1.51
    r609 r610  
    2121# 
    2222# $Log$ 
     23# Revision 1.51  2005/01/05 18:32:49  jimmyo 
     24# Main: Tables in service-view now containt the correct "Type" when using data aliases. 
     25# 
    2326# Revision 1.50  2005/01/05 18:08:01  jimmyo 
    2427# Main: Tables in service-view now sorted according to graph_order. 
     
    231234my @limit_hosts = (); 
    232235my @limit_services = (); 
    233  
    234 # Fields to copy when "aliasing" a field 
    235 my @copy_fields    = ("label", "draw", "type", "rrdfile", "fieldname", "info");  
    236236 
    237237# Force drawing of "graph no".  
     
    715715} 
    716716 
    717 sub get_rrd_filename { 
    718     my $node    = shift; 
    719     my $config  = shift; 
    720     my $domain  = shift; 
    721     my $name    = shift; 
    722     my $service = shift; 
    723     my $field   = shift; 
    724     my $path    = shift; 
    725     my $result  = "unknown"; 
    726  
    727     if ($node->{client}->{$service}->{$field.".filename"}) 
    728     { 
    729         $result = $node->{client}->{$service}->{$field.".filename"}; 
    730     } 
    731     elsif ($path) 
    732     { 
    733         if (!defined ($node->{client}->{$service}->{$field.".label"})) 
    734         { 
    735             print "DEBUG: Setting label: $field\n" if $DEBUG; 
    736             $node->{client}->{$service}->{$field.".label"} = $field; 
    737         } 
    738  
    739         if ($path =~ /^\s*([^:;]+)[:;]([^:]+):([^:\.]+)[:\.]([^:\.]+)\s*$/) 
    740         { 
    741             $result = munin_get_filename ($config, $1, $2, $3, $4); 
    742             print "\nDEBUG1: Expanding $path...\n" if $DEBUG; 
    743             if (! defined $node->{client}->{$service}->{$field."label"}) 
    744             { 
    745                 for my $f (@copy_fields) 
    746                 { 
    747                     if (not exists $node->{client}->{$service}->{"$field.$f"} and 
    748                             exists $config->{'domain'}->{$1}->{'node'}->{$2}->{'client'}->{$3}->{"$4.$f"}) 
    749                     { 
    750                         $node->{client}->{$service}->{"$field.$f"} = $config->{'domain'}->{$1}->{'node'}->{$2}->{'client'}->{$3}->{"$4.$f"}; 
    751                     } 
    752                 } 
    753             } 
    754         } 
    755         elsif ($path =~ /^\s*([^:]+):([^:\.]+)[:\.]([^:\.]+)\s*$/) 
    756         { 
    757             print "\nDEBUG2: Expanding $path...\n" if $DEBUG; 
    758             $result = munin_get_filename ($config, $domain, $1, $2, $3); 
    759             for my $f (@copy_fields) 
    760             { 
    761                 if (not exists $node->{client}->{$service}->{"$field.$f"} and 
    762                         exists $config->{'domain'}->{$domain}->{'node'}->{$1}->{'client'}->{$2}->{"$3.$f"}) 
    763                 { 
    764                     print "DEBUG: Copying $f...\n" if $DEBUG; 
    765                     $node->{client}->{$service}->{"$field.$f"} = $config->{'domain'}->{$domain}->{'node'}->{$1}->{'client'}->{$2}->{"$3.$f"}; 
    766                 } 
    767             } 
    768         } 
    769         elsif ($path =~ /^\s*([^:\.]+)[:\.]([^:\.]+)\s*$/) 
    770         { 
    771             print "\nDEBUG3: Expanding $path...\n" if $DEBUG; 
    772             $result = munin_get_filename ($config, $domain, $name, $1, $2); 
    773             for my $f (@copy_fields) 
    774             { 
    775                 if (not exists $node->{client}->{$service}->{"$field.$f"} and 
    776                         exists $node->{client}->{$1}->{"$2.$f"}) 
    777                 { 
    778                     $node->{client}->{$service}->{"$field.$f"} = $node->{client}->{$1}->{"$2.$f"}; 
    779                 } 
    780             } 
    781         } 
    782         elsif ($path =~ /^\s*([^:\.]+)\s*$/) 
    783         { 
    784             print "\nDEBUG4: Expanding $path...\n" if $DEBUG; 
    785             $result = munin_get_filename ($config, $domain, $name, $service, $1); 
    786             for my $f (@copy_fields) 
    787             { 
    788                 if (not exists $node->{client}->{$service}->{"$field.$f"} and 
    789                         exists $node->{client}->{$service}->{"$1.$f"}) 
    790                 { 
    791                     $node->{client}->{$service}->{"$field.$f"} = $node->{client}->{$service}->{"$1.$f"}; 
    792                 } 
    793             } 
    794         } 
    795     } 
    796     else 
    797     { 
    798         print "\nDEBUG5: Doing path...\n" if $DEBUG; 
    799         $result = munin_get_filename($config, $domain,$name,$service,$field); 
    800     } 
    801     return $result; 
    802 } 
    803  
    804717sub process_node { 
    805718    my ($domain,$name,$node) = @_; 
     
    863776                 
    864777            # Getting name of rrd file 
    865             $filename = &get_rrd_filename ($node, $config, $domain, $name, $service, $field, $path); 
     778            $filename = &munin_get_rrd_filename ($node, $config, $domain, $name, $service, $field, $path); 
    866779 
    867780            my $update = RRDs::last ($filename); 
  • trunk/server/munin-html.in

    • Property cvs2svn:cvs-rev changed from 1.40 to 1.41
    r609 r610  
    2121# 
    2222# $Log$ 
     23# Revision 1.41  2005/01/05 18:32:49  jimmyo 
     24# Main: Tables in service-view now containt the correct "Type" when using data aliases. 
     25# 
    2326# Revision 1.40  2005/01/05 18:08:01  jimmyo 
    2427# Main: Tables in service-view now sorted according to graph_order. 
     
    423426                foreach my $f (@{&munin_get_field_order ($config->{domain}->{$domain}->{node}->{$node}, $config, $domain, $node, $service)}) 
    424427                { 
    425                         $f =~ s/=.*//; 
     428                        $f =~ s/=(.*)$//; 
     429                        my $path = $1; 
    426430                        next unless (&munin_draw_field ($config->{domain}->{$domain}->{node}->{$node}, $service, $f)); 
    427                         print "DEBUG: single_value: Checking field \"$f\".\n" if $DEBUG; 
     431                        print "DEBUG: single_value: Checking field \"$f\" ($path).\n" if $DEBUG; 
     432 
     433                        if (defined $path) 
     434                        { 
     435                            munin_get_rrd_filename ($config->{domain}->{$domain}->{node}->{$node}, $config, $domain, $node, $service, $f, $path); 
     436                        } 
    428437 
    429438                        my %field_info;