IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30100


Ignore:
Timestamp:
Dec 17, 2010, 9:54:12 AM (15 years ago)
Author:
rhenders
Message:

Changed timings of plots and cleanup and creation of metrics from 6am->6am to 6pm->6pm to reflect changes in burntool scheduling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/czarpoll.pl

    r29977 r30100  
    108108    my $newState = undef;
    109109    my $nsStatus = undef;
    110     my $lastDay = strftime('%Y-%m-%d', localtime);
    111110    my $today = undef;
    112     my $doneMetricsToday = 1;
    113 
     111    my $yesterday = undef;
     112    my $newDayTime = "18:00";
     113    my $lastDayDailyTasks = "2010-01-01";
     114
     115    # main polling loop
    114116    while (1) {
    115117
    116         # check whether day has changed. if so, cleanup tables from previous day and optimize
     118        # sort out times
    117119        $today = strftime('%Y-%m-%d', localtime);
    118         if ($czarDb->isBefore($lastDay, $today)) {
    119        
     120        $yesterday = $czarDb->subtractInterval($today, "1 DAY");
     121        $end = $czarDb->getNowTimestamp();
     122
     123        # if before 18:00 today, then start plots from 18:00 yesterday
     124        if ($czarDb->isBefore($end, "$today $newDayTime")) {$begin = "$yesterday $newDayTime";}
     125        # if after 18:00 today, then perform some daily tasks and start plots from 18:00 today
     126        else {
     127           
     128            $begin = "$today $newDayTime";
     129
     130            # check whether yesterday was cleaned. if not, cleanup tables and optimize
     131            if ($lastDayDailyTasks ne $yesterday) {
     132   
     133                print "* performing daily tasks (clean-up, metrics)";
     134
     135                # create metrics for last 24 hours
     136                print "* Creating metrics for last 24 hours\n";
     137                # TODO hardcoded path needs to be in config
     138                my $dayMetrics = new czartool::DayMetrics($gpc1Db,
     139                        $czarDb,
     140                        "/data/ipp004.0/ipp/ippMetrics/",
     141                        1, 0, $today);
     142                $dayMetrics->writeHTML();
     143
     144                # now update metrics index page
     145                my $metricsIndex = new czartool::MetricsIndex($gpc1Db,
     146                        $czarDb,
     147                        "/data/ipp004.0/ipp/ippMetrics/",
     148                        1, 0);
     149                $metricsIndex->writeHTML();
     150
     151                # now cleanup tables from yesterday and optimize
    120152                print "* New day - performing cleanup\n";
    121                 $czarDb->cleanupDateRange($lastDay, $lastDay, "30 MINUTE");
     153                $czarDb->cleanupDateRange($yesterday, $yesterday, "30 MINUTE");
    122154                $czarDb->optimize();
    123                 $lastDay = $today;
    124                 $doneMetricsToday = 0;
    125         }
    126 
    127         # sort out times
    128         $begin = strftime('%Y-%m-%d 06:30', localtime);
    129         $end = $czarDb->getNowTimestamp();
    130 
    131         # if time now is after 06:35am, then create metrics for past 24 hours
    132         if (!$doneMetricsToday && $czarDb->isBefore($begin, $end)) {
    133        
    134             # create metrics for last 24 hours
    135             print "* Creating metrics for last 24 hours\n";
    136             my $yesterday = $czarDb->subtractInterval($today, "1 DAY");
    137             # TODO hardcoded path needs to be in config
    138             my $dayMetrics = new czartool::DayMetrics($gpc1Db,
    139                     $czarDb,
    140                     "/data/ipp004.0/ipp/ippMetrics/",
    141                     1, 0, $yesterday);
    142             $dayMetrics->writeHTML();
    143             $doneMetricsToday = 1;
    144 
    145             # now update metrics index page
    146             my $metricsIndex = new czartool::MetricsIndex($gpc1Db,
    147                     $czarDb,
    148                     "/data/ipp004.0/ipp/ippMetrics/",
    149                     1, 0);
    150             $metricsIndex->writeHTML();
    151         }
    152 
    153         # if time now is before 06:35am, include data from previous day
    154         if ($czarDb->isBefore($end, $begin)) {
    155 
    156             $begin = $czarDb->subtractInterval($begin, "1 DAY");
     155                $lastDayDailyTasks = $yesterday;
     156            }
    157157        }
    158158
     
    248248
    249249        $plotter->createLogAndLinearTimeSeries($allServerLabels,  $stage, $begin, $end); # TODO must be a neater way...
    250         $plotter->createRateTimeSeries($allServerLabels, $stage, $begin, $end, undef, 0);
     250            $plotter->createRateTimeSeries($allServerLabels, $stage, $begin, $end, undef, 0);
    251251    }
    252252}
     
    272272    my $server = undef;
    273273    my $state = undef;
    274    
     274
    275275    foreach $stage (@stages) {
    276276
Note: See TracChangeset for help on using the changeset viewer.