/[cricket]/generate-overview.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /generate-overview.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by dpavlin, Sat Aug 9 21:31:19 2003 UTC revision 1.16 by dpavlin, Mon Nov 3 10:30:48 2003 UTC
# Line 27  Line 27 
27    
28  # Target can be skipped in overview report with skip-overview  # Target can be skipped in overview report with skip-overview
29    
30    my $path;
31    my $gBaseURL;
32    
33  BEGIN {  BEGIN {
34  #       $gInstallRoot = (($0 =~ m:^(.*/):)[0] || "./") . ".";  #       $gInstallRoot = (($0 =~ m:^(.*/):)[0] || "./") . ".";
35          require '/etc/cricket/cricket-conf.pl';          require '/etc/cricket/cricket-conf.pl';
# Line 44  BEGIN { Line 47  BEGIN {
47    
48  #use lib "$gInstallRoot/../lib";  #use lib "$gInstallRoot/../lib";
49  use lib "$Common::global::gInstallRoot/lib";  use lib "$Common::global::gInstallRoot/lib";
50    use strict;
51    
52  use File::Basename;  use File::Basename;
53  use LWP::UserAgent;  use LWP::UserAgent;
# Line 67  Common::Options::commonOptions( 'baseURL Line 71  Common::Options::commonOptions( 'baseURL
71  initConst();  initConst();
72    
73  $Common::global::gCT = new ConfigTree::Cache;  $Common::global::gCT = new ConfigTree::Cache;
74  $gCT = $Common::global::gCT;  my $gCT = $Common::global::gCT;
75  $gCT->Base($Common::global::gConfigRoot);  $gCT->Base($Common::global::gConfigRoot);
76  $gCT->Warn(\&Warn);  $gCT->Warn(\&Warn);
77    
# Line 299  HTMLEND Line 303  HTMLEND
303  sub localHandleTargetInstance {  sub localHandleTargetInstance {
304          my($Name, $target) = @_;          my($Name, $target) = @_;
305    
306          $targetpath = $target->{'auto-target-path'};          my $targetpath = $target->{'auto-target-path'};
307          $targetname = $target->{'auto-target-name'};          my $targetname = $target->{'auto-target-name'};
308    
309          if (! defined($target->{'skip-overview'}))          my @skip_views = split(/[\s,]+/,$target->{'skip-view'}) if ($target->{'skip-view'});
310          {  print "### ",join("|",@skip_views),"\n";
311    
312            if (defined($target->{'skip-overview'})) {
313                    Info("Skipping target $targetname.");
314            } else {
315                  Info("Working on target $targetname.");                  Info("Working on target $targetname.");
316                  my($reqRanges,@ranges);                  my($reqRanges,@ranges);
317    
# Line 322  sub localHandleTargetInstance { Line 330  sub localHandleTargetInstance {
330    
331                          foreach $range (@ranges)                          foreach $range (@ranges)
332                          {                          {
333                                  $rangeLabel = rangeToLabel($range);                                  my $rangeLabel = rangeToLabel($range);
334    
335                                  my($paramtarget) = "$targetpath/$targetname";                                  my($paramtarget) = "$targetpath/$targetname";
336                    
# Line 339  sub localHandleTargetInstance { Line 347  sub localHandleTargetInstance {
347    
348                                  # find the ds names based on the target type                                  # find the ds names based on the target type
349                                  my($ttype) = lc($target->{'target-type'});                                  my($ttype) = lc($target->{'target-type'});
350                                  my($ttRef) = $main::gCT->configHash($Name, 'targettype', $ttype, $target);                                  my($ttRef) = $gCT->configHash($Name, 'targettype', $ttype, $target);
351    
352                                  # If there are views defined, then we generate graphs                                  # If there are views defined, then we generate graphs
353                                  # for each view.                                  # for each view.
354    
355                                  my($dslist);                                  my($dslist);
356    
357                                  if (defined($ttRef->{'view'}))                                  if (defined($ttRef->{'view'})) {
                                 {  
358                                          my($v);                                          my($v);
359                                          foreach $v (split(/\s*,\s*/, $ttRef->{'view'}))                                          foreach $v (split(/\s*,\s*/, $ttRef->{'view'})) {
360                                          {                                                  my ($view_name,undef) = split(/\s*:\s*/,$v);
361                                                    if (grep(/$view_name/,@skip_views)) {
362                                                            Info("Skip view $v");
363                                                            next;
364                                                    }
365                                                  # views are like this: "cpu: cpu1load  cpu5load"                                                  # views are like this: "cpu: cpu1load  cpu5load"
366                                                  my($vname, $dss) = split(/\s*:\s*/, $v, 2);                                                  my($vname, $dss) = split(/\s*:\s*/, $v, 2);
367    
# Line 358  sub localHandleTargetInstance { Line 369  sub localHandleTargetInstance {
369                                                  $dslist =~ s/\s*$//;                                                  $dslist =~ s/\s*$//;
370                                                  $dslist =~ s/\s+/,/g;                                                  $dslist =~ s/\s+/,/g;
371    
372                                                  $URL = "$gBaseURL?type=png&target=$paramtarget";                                                  my $URL = "$gBaseURL?type=png&target=$paramtarget";
373                                                  $URL .= "&dslist=$dslist&range=$paramrange";                                                  $URL .= "&dslist=$dslist&range=$paramrange";
374                                                  my $desc = "$paramtarget $vname";                                                  my $desc = "$paramtarget $vname";
375                                                  $desc .= " <b>".$target->{'short-desc'}."</b>" if (defined $target->{'short-desc'});                                                  $desc .= " <b>".$target->{'short-desc'}."</b>" if (defined $target->{'short-desc'});
# Line 368  sub localHandleTargetInstance { Line 379  sub localHandleTargetInstance {
379    
380                                                  Info("Retrieving graph for $desc");                                                  Info("Retrieving graph for $desc");
381  #                                               getURL($URL,"$path/$name-$vname-$rangeLabel.png");  #                                               getURL($URL,"$path/$name-$vname-$rangeLabel.png");
382                                                  $tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y&view=$vname";                                                  my $tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y&view=$vname";
383                                                  $html{"$rangeLabel\t$paramtarget"}.=do_html($desc,$tmp_URL,$URL);                                                  $html{"$rangeLabel\t$paramtarget"}.=do_html($desc,$tmp_URL,$URL);
384                                          }                                          }
385                                  } else {                                  } else {
# Line 376  sub localHandleTargetInstance { Line 387  sub localHandleTargetInstance {
387                                          # squeeze out any extra spaces                                          # squeeze out any extra spaces
388                                          $dslist = join(',', split(/\s*,\s*/, $dslist));                                          $dslist = join(',', split(/\s*,\s*/, $dslist));
389    
390                                          $URL = "$gBaseURL?type=png&target=$paramtarget";                                          my $URL = "$gBaseURL?type=png&target=$paramtarget";
391                                          $URL .= "&dslist=$dslist&range=$paramrange";                                          $URL .= "&dslist=$dslist&range=$paramrange";
392                                          my $desc ="$paraminst $rangeLabel";                                          my $desc ="$paraminst $rangeLabel";
393                                          $desc .= " <b>".$target->{'short-desc'}."</b>" if (defined $target->{'short-desc'});                                          $desc .= " <b>".$target->{'short-desc'}."</b>" if (defined $target->{'short-desc'});
# Line 387  sub localHandleTargetInstance { Line 398  sub localHandleTargetInstance {
398                                          Info("Retrieving graph for $desc");                                          Info("Retrieving graph for $desc");
399    
400  #                                       getURL($URL,"$path/$name-$rangeLabel.png");  #                                       getURL($URL,"$path/$name-$rangeLabel.png");
401                                          $tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y";                                          my $tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y";
402                                          $html{"$rangeLabel\t$paramtarget"}.=do_html($desc,$tmp_URL,$URL);                                          $html{"$rangeLabel\t$paramtarget"}.=do_html($desc,$tmp_URL,$URL);
403                                  }                                  }
404                          }                          }

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.26