Changeset 1763
- Timestamp:
- 12/03/08 17:02:06 (1 month ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/DEV-capside/opsview-web/lib/Opsview/Web/Controller/RRDgraph.pm
r1756 r1763 89 89 # List of datapoints 90 90 my $ds = {}; 91 my $max_legend_length = 0; 91 92 my @auth_errors; 92 93 foreach my $host (@$hosts) { … … 153 154 my $vname = "$hash->{host}-$hash->{service}-$dsname"; 154 155 $vname =~ s/[^a-zA-Z0-9-_]/_/g; 155 156 $hash->{'vname'} = $vname; 157 156 158 my $legend = ""; 157 if ($showlegend ) {159 if ($showlegend == 1 or $showlegend == 2) { 158 160 # $displayname is a calculated name, based on whether there are multiple hosts/services or not 159 161 my $displayname = $dsname; … … 167 169 $displayname =~ s/\:/\\:/g; 168 170 $legend = "$displayname"; 169 } 170 171 $hash->{'displayname'} = $displayname; 172 $hash->{'legend'} = $legend; 173 174 $max_legend_length = length($legend) if (length($legend) > $max_legend_length); 175 } 176 } 177 } 178 179 @colours = split(",", $colours) unless (@colours); 180 181 if ($showlegend == 2){ 182 push @$rrdoptions, "COMMENT:" . (' ' x ($max_legend_length + 4)) . " Max Min Avg\\n"; 183 } 184 185 foreach my $dsname (sort keys %$ds) { 186 foreach my $hash (@{ $ds->{$dsname} }) { 171 187 my $f = $hash->{file}; 172 173 @colours = split(",", $colours) unless (@colours); 188 my $vname = $hash->{'vname'}; 189 174 190 my $nextcolour = shift @colours; 191 my $fixedw_legend = $hash->{'legend'} . (' ' x ($max_legend_length - length($hash->{'legend'}))); 175 192 push @$rrdoptions, 176 193 "DEF:$vname=$f:$dsname:AVERAGE", 177 "$type:$vname#$nextcolour:$legend$stacked"; 178 #"GPRINT:$vname".':LAST:\tCur\: %6.2lf%s\n'; 194 "$type:$vname#$nextcolour:$fixedw_legend$stacked"; 195 if ($showlegend == 2){ 196 push @$rrdoptions, 197 "GPRINT:$vname:MAX:%7.02lf", 198 "GPRINT:$vname:MIN:%7.02lf ", 199 "GPRINT:$vname:AVERAGE:%7.02lf", 200 "COMMENT:\\n"; 201 } 179 202 } 180 203 }
