- Timestamp:
- Oct 27, 2019, 9:47:12 PM (7 years ago)
- Location:
- branches/ccl_branches/ipp-20190806/ippMonitor
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
czartool/czarpoll.pl (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/ccl_branches/ipp-20190806/ippMonitor
- Property svn:mergeinfo changed
/trunk/ippMonitor (added) merged: 40862,40877-40879,40882-40883,40936
- Property svn:mergeinfo changed
-
branches/ccl_branches/ipp-20190806/ippMonitor/czartool/czarpoll.pl
r40847 r40974 12 12 use POSIX qw/strftime/; 13 13 use List::MoreUtils qw(uniq); 14 use DateTime; 14 15 15 16 # local classes … … 127 128 ########################################################################### 128 129 sub updateLabels { 130 my ($dbupdate) = @_; 129 131 130 132 # this used to have a concept of labels grouped by pantasks server, but we … … 199 201 200 202 # store them all in stdscience: 201 $server = "stdscience"; 202 if (@allLabels) { 203 $czarDb->updateCurrentLabels($server, \@allLabels,'gpc1', \@priorities); 204 } else { 205 print "WARNING: No labels to update for gpc1 for '$server'\n"; 206 } 207 208 if (@allLabels2) { 209 $czarDb->updateCurrentLabels($server, \@allLabels2,'gpc2', \@priorities2); 210 } else { 211 print "WARNING: No labels to update for gpc2 for '$server'\n"; 203 if($dbupdate == 1) { 204 $server = "stdscience"; 205 if (@allLabels) { 206 $czarDb->updateCurrentLabels($server, \@allLabels,'gpc1', \@priorities); 207 } else { 208 print "WARNING: No labels to update for gpc1 for '$server'\n"; 209 } 210 211 if (@allLabels2) { 212 $czarDb->updateCurrentLabels($server, \@allLabels2,'gpc2', \@priorities2); 213 } else { 214 print "WARNING: No labels to update for gpc2 for '$server'\n"; 215 } 212 216 } 213 217 return(\@allLabels,\@allLabels2); … … 243 247 my ($period) = @_; 244 248 249 my $dbupdate; 250 my $polldate; 251 my $datenow; 252 my $timediff; 245 253 my $label; 246 254 my $new; … … 267 275 # main polling loop 268 276 while (1) { 269 270 277 my $iterationStartTime = time(); 278 279 #get the time of last czarpoll update 280 $polldate = $czarDb->getPollDate(); 281 $polldate=~/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/; 282 my $date=DateTime->new(year=>$1,month=>$2,day=>$3,hour=>$4,minute=>$5,second=>$6,time_zone=>"HST"); 283 $date->set_time_zone("UTC"); 284 285 $datenow=DateTime->now; 286 $timediff = ($datenow->epoch) - ($date->epoch); 287 if($timediff > 120.) { 288 print "There is no recent Czarpoll iteration\n"; 289 print "*Updating database entries*\n"; 290 $dbupdate = 1; 291 } else { 292 print "There is a recent Czarpoll iteration already made ($timediff sec ago)\n"; 293 print "*Skipping database queries and entries*\n"; 294 $dbupdate = 0; 295 } 296 271 297 272 298 # sort out times … … 298 324 299 325 # now cleanup tables from yesterday and optimize 300 print "* Performing database cleanup\n"; 301 $czarDb->cleanupDateRange($yesterday, $yesterday, $config->getCzarCleanupInterval()); 302 print "* Optimizing the database\n"; 303 $czarDb->optimize(); 326 #TdB20190703: The ipp113 and ipp117 instances of czarpoll use the same stage DBs in czarDB. 327 #Therefore, it makes no sense to run the cleanup+optimising twice 328 #print "* Performing database cleanup\n"; 329 #$czarDb->cleanupDateRange($yesterday, $yesterday, $config->getCzarCleanupInterval()); 330 #print "* Optimizing the database\n"; 331 #$czarDb->optimize(); 304 332 $lastDayDailyTasks = $yesterday; 305 333 } … … 307 335 308 336 # check nightly science status 309 print "* Checking nightly science status\n"; 310 if (!$pantasks->getNightlyScienceStatus(\$nsStatus,'gpc1')) {$nsStatus = "Unknown";} 311 $czarDb->updateNightlyScience($nsStatus,'gpc1'); 312 if (!$pantasks->getNightlyScienceStatus(\$nsStatus,'gpc2')) {$nsStatus = "Unknown";} 313 $czarDb->updateNightlyScience($nsStatus,'gpc2'); 337 if($dbupdate == 1) { 338 print "* Checking nightly science status\n"; 339 if (!$pantasks->getNightlyScienceStatus(\$nsStatus,'gpc1')) {$nsStatus = "Unknown";} 340 $czarDb->updateNightlyScience($nsStatus,'gpc1'); 341 if (!$pantasks->getNightlyScienceStatus(\$nsStatus,'gpc2')) {$nsStatus = "Unknown";} 342 $czarDb->updateNightlyScience($nsStatus,'gpc2'); 343 } 314 344 315 345 # check nebulous 316 346 print "* Checking Nebulous\n"; 317 $nebulous->updateClusterSpaceInfo();347 if($dbupdate == 1) {$nebulous->updateClusterSpaceInfo();} 318 348 $plotter0->plotStorageTimeSeries($czarDb->subtractInterval($begin, "1 WEEK") , $end); 319 349 $plotter0->plotDiskUsageHistogram(); 320 350 $plotter0->plotDiskUsageHistogramLarge(); 321 updateServerStatus();351 if($dbupdate == 1) {updateServerStatus();} 322 352 323 353 # check pantasks dates 324 updateDates();354 if($dbupdate == 1) {updateDates();} 325 355 326 356 # check labels 327 my ($labels, $labels2) = updateLabels( );357 my ($labels, $labels2) = updateLabels($dbupdate); 328 358 my @labels = @$labels; 329 359 my @labels2 = @$labels2; … … 342 372 my $size = @{$labels}; 343 373 if($size > 0) { 344 updateAllStages($thisServer, $newState, $labels,$labels2, $begin, $end);374 if($dbupdate == 1) {updateAllStages($thisServer, $newState, $labels,$labels2, $begin, $end);} 345 375 if ($thisServer eq "stdscience") { 346 376 createPlots($thisServer, $plotter1, $labels, $begin, $end);
Note:
See TracChangeset
for help on using the changeset viewer.
