ASNMTAP

 view release on metacpan or  search on metacpan

applications/htmlroot/cgi-bin/moderator/generatePluginCrontabSchedulingReport.pl  view on Meta::CPAN

        push (@labels, $label);
		
        FORMIN: for (my $min = 0; $min < 60; $min++) {
          my $currentDate = timelocal(0, $min, 0, 1, 0, 105);

          UKEY: foreach my $uKey (keys %uKeys) {
            my $collectorDaemon = $uKeys{$uKey}->{collectorDaemon} if ($uKeys{$uKey}->{collectorDaemon} !~ /\|/);

            unless ( defined $collectorDaemon ) {
              $hight = $hightMin; $rv = 0; $errorMessage = "'$uKey' from '$CcatalogID' into more then one Collector Daemon available: '". $uKeys{$uKey}->{collectorDaemon} ."'";
              last FORHOUR;
            } else {
              my $noOFFLINE = $uKeys{$uKey}->{noOffline} if ($uKeys{$uKey}->{noOffline} !~ /\|/);

              unless ( defined $noOFFLINE ) {
                $hight = $hightMin; $rv = 0; $errorMessage = "For '$uKey' from '$CcatalogID' is there more then one noOffline type available: '". $uKeys{$uKey}->{noOffline} ."'";
                last FORHOUR;
              } else {
                my $insertStatus;

                foreach my $lineNumber (keys %{$uKeys{$uKey}{lineNumbers}}) {
                  my $tmin  = $uKeys{$uKey}->{lineNumbers}->{$lineNumber}->{minute};
                  my $thour = $uKeys{$uKey}->{lineNumbers}->{$lineNumber}->{hour};
                  my $tmday = $uKeys{$uKey}->{lineNumbers}->{$lineNumber}->{dayOfTheMonth};
                  my $tmon  = $uKeys{$uKey}->{lineNumbers}->{$lineNumber}->{monthOfTheYear};
                  my $twday = $uKeys{$uKey}->{lineNumbers}->{$lineNumber}->{dayOfTheWeek};

                  my ($doIt, $doOffline) = set_doIt_and_doOffline ($min, $hour, $mday, $mon, $wday, $tmin, $thour, $tmday, $tmon, $twday);

                  if ($doIt || $doOffline) {
                    if ($doIt) {
                      $insertStatus = $ERRORS{UNKNOWN};
                    } elsif ($doOffline) {
                      if ($noOFFLINE) {
                       if ($noOFFLINE eq "noOFFLINE") {
                          $insertStatus = $ERRORS{DEPENDENT} unless ( defined $insertStatus );
                        } elsif ($noOFFLINE eq 'multiOFFLINE') {
                          $insertStatus = $ERRORS{OFFLINE} unless ( defined $insertStatus );
                        } elsif ($noOFFLINE eq 'noTEST') {
                          $insertStatus = $ERRORS{'NO TEST'} unless ( defined $insertStatus );
                        }
                      } else {
                        $insertStatus = $ERRORS{OFFLINE} unless ( defined $insertStatus );
                      }
                    }
                  }
                }

                if (defined $insertStatus) {
                  if ($restPreviousTimeslot) {
                    push (@colorsCrontab,      $COLORSRRD{$STATE{$insertStatus}});
                    push (@colorsTimeslot,     $COLORSRRD{'IN PROGRESS'});
                    push (@dataPoints,         $dataPoint);
                    push (@crontabStartDate,   perlchartdir::chartTime2($currentDate));
                    push (@crontabEndDate,     perlchartdir::chartTime2($currentDate));
                    push (@crontabEndTimeslot, perlchartdir::chartTime2($currentDate - $restPreviousTimeslot));
                    $restPreviousTimeslot = 0;
                    $restCurrentTimeslot  = $stepValue;
                  }

                  my $endpointCurrentTimeslot = (($min * 60) + $stepValue);

                  if ($endpointCurrentTimeslot > 3600) {
                    $restPreviousTimeslot = $endpointCurrentTimeslot - 3600;
                    $restCurrentTimeslot  = $stepValue - $restPreviousTimeslot;
                  }

                  # the color for each crontab bar
                  push (@colorsCrontab,      $COLORSRRD{$STATE{$insertStatus}});

                  # the color for each timeslot bar
                  push (@colorsTimeslot,     $COLORSRRD{'IN PROGRESS'});

                  # the data points for each test result matching the corresponding label
                  push (@dataPoints,         $dataPoint);

                  # the timeslot start dates and end dates for the tasks
                  push (@crontabStartDate,   perlchartdir::chartTime2($currentDate));
                  push (@crontabEndDate,     perlchartdir::chartTime2($currentDate + 60));
                  push (@crontabEndTimeslot, perlchartdir::chartTime2($currentDate + $restCurrentTimeslot));
                }
              }
            }
          }
        }
      }
    }
  }
} else {
  $hight = $hightMin; $errorMessage = "PROBLEM REGARDING FINDING MASTER OR SLAVE";
}

# exit;

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# calculatie hight
$hight += ($labelOffset * 24 * 7);
$hight = $hightMin if ($hight < $hightMin);

# Create XYChart object with: width, hight, backgroundcolor, bordercolor, pxp-3d borden
my $c = new XYChart($width, $hight, $background, $background, 1);

# Add a title box to the chart using 10 pts Arial Bold Italic font.
$chartTitle = "Error for '$chartTitle'" unless ( defined $chartTitle and $rv );
$c->addText($width/2, 14, $chartTitle, "arialbi.ttf", 10, $forGround, 5, 0);

# Add debugMessage and errorMessage
$c->addText($width - 18, $hight - 33, $debugMessage, "arial.ttf", 8, $forGround, 6, 0) if ( defined $debugMessage );
$c->addText($width/2, (($hight - $yOffset - $AreaBOffset)/2) + $yOffset + 16, $errorMessage, "arial.ttf", 12, 0xFF0000, 5, 0) if ( defined $errorMessage );
$c->addText($width/2, (($hight - $yOffset - $AreaBOffset)/2) + $yOffset - 16, $dbiErrorCode, "arial.ttf", 10, 0xFF0000, 5, 0) if ( defined $dbiErrorCode );
$c->addText($width/2, (($hight - $yOffset - $AreaBOffset)/2) + $yOffset + 48, $dbiErrorString, "arial.ttf", 10, 0xFF0000, 5, 0) if ( defined $dbiErrorString );

# Add a custom CDML text at the bottom right of the plot area as the logo
$c->addText($width - 3, 92, $APPLICATION . " @ " . $BUSINESS, "arial.ttf", 8, $forGround, 6, 270);
$c->addText($width - 18, $hight - 18, $DEPARTMENT . " @ " . $BUSINESS . ", created on: " . scalar(localtime()) . ".", "arial.ttf", 8, $forGround, 6, 0);

unless ( defined $errorMessage or defined $dbiErrorCode or defined $dbiErrorString ) {
  # Set the plotarea at (xOffset, yOffset) and of size ($width - $xOffset - 21) x ($hight - $AreaBOffset) pixels, with white background. Set border and grid line colors to 0xa08040.
  $c->setPlotArea($xOffset, $yOffset, $width - $xOffset - 21, $hight - $AreaBOffset, 0xffffff, 0xeeeeee, $axisColor, 0xCCCCCC, 0xCCCCCC)->setGridWidth(1, 1, 1, 1);

  # swap the x and y axes to create a horziontal box-whisker chart
  $c->swapXY();



( run in 1.084 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )