Changeset 28845
- Timestamp:
- Aug 5, 2010, 9:10:53 AM (16 years ago)
- Location:
- trunk/tools
- Files:
-
- 1 added
- 3 edited
-
czarplot.pl (modified) (5 diffs)
-
czartool/Czarplot.pm (modified) (5 diffs)
-
czartool/Nebulous.pm (added)
-
roboczar.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/czarplot.pl
r28772 r28845 21 21 my $histogram = undef; 22 22 my $timeSeries = undef; 23 my $nebulous = undef; 23 24 my $savingToFile = undef; 24 25 … … 32 33 "output|o=s" => \$path, 33 34 "histogram|h" => \$histogram, 35 "nebulous|n" => \$nebulous, 34 36 "timeseries|t" => \$timeSeries, 35 37 "verbose|v" => \$verbose, … … 41 43 if (!$timeSeries) { 42 44 print "* OPTIONAL: plot timeseries -t (default=on)\n";} 45 if (!$nebulous) { 46 print "* OPTIONAL: plot nebulous disk space -n (default=off)\n";} 43 47 if (!$label) { 44 48 print "* OPTIONAL: choose a label -l <labellName> (default='all_labels')\n";} … … 58 62 # default values 59 63 if (!$label) {$label = "all_labels";} 60 if (!$ histogram && !$timeSeries) {$timeSeries = 1; $histogram = 1;}64 if (!$nebulous && !$histogram && !$timeSeries) {$timeSeries = 1; $histogram = 0;} 61 65 if (!$verbose) {$verbose = 0;} 62 66 if (!$save_temps) {$save_temps = 0;} … … 78 82 } 79 83 84 my $diskUsage = 1; # TODO 85 80 86 if ($timeSeries) {$czarplot->createTimeSeries($label, $stage, $begin, $end);} 81 87 if ($histogram) {$czarplot->createHistogram($label, $begin, $end);} 88 if ($nebulous) {$czarplot->plotDiskUsageHistogram();} 89 if ($nebulous) {$czarplot->plotStorageTimeSeries($begin, $end);} 82 90 -
trunk/tools/czartool/Czarplot.pm
r28804 r28845 154 154 my ($self, $minY, $maxY) = @_; 155 155 156 ${$maxY} = ${$maxY} + (${$maxY}/10); 157 ${$minY} = ${$minY} - (${$minY}/10); 156 my $border = (${$maxY} - ${$minY})/10; 157 158 ${$maxY} += $border; 159 ${$minY} -= $border ; 158 160 if (${$maxY} == 0) {${$maxY} = 1;} 159 161 if (${$minY} == 0) {${$minY} = -1;} 160 162 } 161 163 164 165 ########################################################################### 166 # 167 # Figures out suitable spacing for time tics on time-series pliots 168 # 169 ########################################################################### 170 sub getTimeSpacing { 171 my ($self, $timeDiff, $divX, $timeFormat) = @_; 172 173 # if less than a couple of hour's data plotted, show 30 mins tics 174 if ($timeDiff < 7200) { 175 ${$timeFormat} = "%H:%M"; 176 ${$divX} = 1800; 177 } 178 # if less than half a day's data plotted, show hourly tics 179 elsif ($timeDiff < 43200) { 180 ${$timeFormat} = "%H:%M"; 181 ${$divX} = 3600; 182 } 183 # if less than one day's data plotted, show 2 hourly tics 184 elsif ($timeDiff < 86400) { 185 ${$timeFormat} = "%H:%M"; 186 ${$divX} = 7200; 187 } 188 # if less than 1 week's data is data plotted, show daily tics 189 elsif ($timeDiff < 604800) { 190 191 ${$timeFormat} = "%m/%d"; 192 ${$divX} = 86400; 193 } 194 else { 195 196 ${$timeFormat} = "%m/%d"; 197 ${$divX} = 172800; 198 } 199 } 200 162 201 ########################################################################### 163 202 # … … 171 210 172 211 my $timeFormat = undef; 173 174 my $divX = $timeDiff/4; 175 176 # if less than a couple of hour's data plotted, show 30 mins tics 177 if ($timeDiff < 7200) { 178 $timeFormat = "%H:%M"; 179 $divX = 1800; 180 } 181 # if less than half a day's data plotted, show hourly tics 182 elsif ($timeDiff < 43200) { 183 $timeFormat = "%H:%M"; 184 $divX = 3600; 185 } 186 # if less than one day's data plotted, show 2 hourly tics 187 elsif ($timeDiff < 86400) { 188 $timeFormat = "%H:%M"; 189 $divX = 7200; 190 } 191 # if less than 1 week's data is data plotted, show daily tics 192 elsif ($timeDiff < 604800) { 193 194 $timeFormat = "%m/%d"; 195 $divX = 86400; 196 } 197 else { 198 199 $timeFormat = "%m/%d"; 200 $divX = 172800; 201 } 202 212 my $divX = undef; 213 214 $self->getTimeSpacing($timeDiff, \$divX, \$timeFormat); 203 215 204 216 my $numOfPlots = keys %$gnuplotFiles; … … 237 249 if ($numOfPlots == 1) { 238 250 239 print GP "'" . $gnuplotFiles->{$stage} . "' using 1:4 title \" processed\" with lines lt 2,";240 print GP "'" . $gnuplotFiles->{$stage} . "' using 1:2 title \" pending\" with lines lt 3,";241 print GP "'" . $gnuplotFiles->{$stage} . "' using 1:3 title \" faults\" with lines lt 1";251 print GP "'" . $gnuplotFiles->{$stage} . "' using 1:4 title \"Processed\" with lines lt 2,"; 252 print GP "'" . $gnuplotFiles->{$stage} . "' using 1:2 title \"Pending\" with lines lt 4,"; 253 print GP "'" . $gnuplotFiles->{$stage} . "' using 1:3 title \"Faults\" with lines lt 7"; 242 254 } 243 255 # when plotting multiple stages, show only processed … … 249 261 250 262 print GP "\n"; 263 close GP; 264 } 265 266 ########################################################################### 267 # 268 # Plots a time-series of cluster storage 269 # 270 ########################################################################### 271 sub plotStorageTimeSeries { 272 my ($self, $fromTime, $toTime) = @_; 273 274 my $outputFile = "/tmp/czarplot_cluster.png"; 275 my ($minX, $maxX, $minY, $maxY, $timeDiff); 276 277 my $gnuplotFile = $self->{_czarDb}->createStorageTimeSeriesData($fromTime, $toTime, \$minX, \$maxX, \$minY, \$maxY, \$timeDiff); 278 279 $self->sortOutMaxMinY(\$minY, \$maxY); 280 281 my $timeFormat = undef; 282 my $divX = undef; 283 284 $self->getTimeSpacing($timeDiff, \$divX, \$timeFormat); 285 286 open (GP, "|/usr/bin/gnuplot -persist") or die "no gnuplot"; 287 use FileHandle; 288 GP->autoflush(1); 289 290 print GP 291 "set term $self->{_outputFormat};" . 292 "set output \"$outputFile\";" . 293 "set title \"hmjhhjhj\";" . 294 "set key left top;" . 295 "set xdata time;" . 296 "set timefmt \"$self->{_dateFormat}\";" . 297 "set xrange [\"$minX\":\"$maxX\"];" . 298 "set yrange [\"$minY\":\"$maxY\"];" . 299 "set format x \"$timeFormat\";" . 300 "set xtics \"$minX\", $divX, \"$maxX\";" . 301 "set grid xtics;" . 302 "set xlabel \"Time\";" . 303 "set ylabel \"Available (TB)\";" . 304 "plot " . 305 # "'$gnuplotFile' using 1:2 title \"Total\" with lines lt 1," . 306 "'$gnuplotFile' using 1:2 title \"Available\" with lines lt 2\n"; 307 308 print GP "\n"; 251 309 close GP; 252 310 } … … 275 333 "set bmargin 5;" . 276 334 "set ylabel \"Exposures\";" . 277 "plot '$inputFile' using 2:xtic(1) title \"Processed\" lt 2, '' using 3 title \"Pending\" lt 3, '' using 4 title \"Faults\" lt 1\n"; 335 "plot '$inputFile' using 2:xtic(1) title \"Processed\" lt 2, '' using 3 title \"Pending\" lt 4, '' using 4 title \"Faults\" lt 7;" . 336 "\n"; 278 337 279 338 close GP; 280 339 } 281 340 341 ########################################################################### 342 # 343 # Plots disk usage across cluster as a stacked histogram 344 # 345 ########################################################################### 346 sub plotDiskUsageHistogram { 347 my ($self) = @_; 348 349 my $outputFile = "/tmp/czarplot_hosts.png"; 350 351 my $inputFile = $self->{_czarDb}->createHostsData(); 352 353 open (GP, "|/usr/bin/gnuplot -persist") or die "no gnuplot"; 354 use FileHandle; 355 GP->autoflush(1); 356 357 print GP 358 "set term $self->{_outputFormat};" . 359 "set output \"$outputFile\";" . 360 "set title \"Nebulous disk use across IPP cluster\";" . 361 "set style fill solid 1.00 border -1;" . 362 "set style histogram rowstacked;" . 363 "set style data histograms;" . 364 "set ylabel \"Space (TB)\";" . 365 "set xtic rotate by -90 scale 0;" . 366 "plot '$inputFile' using 2:xtic(1) t \"Used\" , '' using 3 t \"Available\";" . 367 368 "\n"; 369 370 close GP; 371 } 282 372 1; -
trunk/tools/roboczar.pl
r28831 r28845 10 10 use czartool::Gpc1Db; 11 11 use czartool::Pantasks; 12 use czartool::Nebulous; 12 13 use czartool::Czarplot; 13 14 14 15 15 my $period = 60; … … 24 24 my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp", 0, $save_temps); # TODO last arg here is save_temps, should get as arg 25 25 my $gpc1Db = new czartool::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser"); 26 my $nebulous = new czartool::Nebulous($czarDb); 26 27 my $pantasks = new czartool::Pantasks(); 27 28 my $czarplot = new czartool::Czarplot($czarDb, "%Y%m%d-%H%M%S", "png", "/tmp", $save_temps); … … 101 102 my $end = undef; 102 103 my $priority = undef; 103 104 104 while (1) { 105 106 print "* Checking Nebulous\n"; 107 $nebulous->updateClusterSpaceInfo(); 105 108 106 109 updateServerStatus();
Note:
See TracChangeset
for help on using the changeset viewer.
