Changeset 38258
- Timestamp:
- May 13, 2015, 9:19:19 AM (11 years ago)
- Location:
- trunk/ippMonitor
- Files:
-
- 16 edited
-
czartool/czarplot.pl (modified) (2 diffs)
-
czartool/czarpoll.pl (modified) (12 diffs)
-
czartool/czartool/Config.pm (modified) (1 diff)
-
czartool/czartool/CzarDb.pm (modified) (21 diffs)
-
czartool/czartool/DayMetrics.pm (modified) (6 diffs)
-
czartool/czartool/Gpc1Db.pm (modified) (1 diff)
-
czartool/czartool/Metrics.pm (modified) (2 diffs)
-
czartool/czartool/MetricsIndex.pm (modified) (1 diff)
-
czartool/czartool/MySQLDb.pm (modified) (1 diff)
-
czartool/czartool/Plotter.pm (modified) (12 diffs)
-
czartool/czartool/StageMetrics.pm (modified) (2 diffs)
-
raw/czartool_exposures.php (modified) (2 diffs)
-
raw/czartool_getplot.php (modified) (1 diff)
-
raw/czartool_labels.php (modified) (15 diffs)
-
raw/ipp.czar.dat (modified) (1 diff)
-
raw/ipp.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/czartool/czarplot.pl
r34249 r38258 30 30 my $log = undef; 31 31 my $psps = undef; 32 my $project = 'gpc1'; 32 33 33 34 GetOptions ( 34 35 "label|l=s" => \$label, 36 "project=s" => \$project, 35 37 "stage|s=s" => \$stage, 36 38 "timeinpast|p=s" => \$timeinpast, … … 110 112 my $newDayTime = $config->getMetricsStartTime(); 111 113 114 my $projectDb = $config->getDbInstanceForProject($project); 115 die "Failed to open database for $project.\n" unless $projectDb; 116 117 112 118 my $plotter = undef; 113 119 if ($savingToFile) { 114 120 115 $plotter = czartool::Plotter->new_file($config, $p ath, $save_temps);121 $plotter = czartool::Plotter->new_file($config, $projectDb, $path, $save_temps); 116 122 } 117 123 else { 118 124 119 $plotter = czartool::Plotter->new_display($config, $ save_temps);125 $plotter = czartool::Plotter->new_display($config, $projectDb, $save_temps); 120 126 } 121 127 -
trunk/ippMonitor/czartool/czarpoll.pl
r38251 r38258 26 26 27 27 GetOptions ( 28 "period|p=s" => \$period, # TODO more Db args28 "period|p=s" => \$period, 29 29 ); 30 30 … … 35 35 my $nebulous = new czartool::Nebulous($czarDb); 36 36 my $pantasks = new czartool::Pantasks(); 37 my $plotter = czartool::Plotter->new_file($config, $config->getGnuplotPath(), $save_temps); 38 37 38 # We have a top level directory that gets general plots and then one for each database 39 my $plotter0 = czartool::Plotter->new_file($config, undef, $config->getGnuplotPath(), $save_temps); 40 41 # for now hardcode two databases. Later I'll look into handling a variable number 42 my $plotter1 = czartool::Plotter->new_file($config, $gpc1Db, $config->getGnuplotPath() . "/gpc1", $save_temps); 43 my $plotter2 = czartool::Plotter->new_file($config, $gpc2Db, $config->getGnuplotPath() . "/gpc2", $save_temps); 39 44 40 45 my @stages = ( … … 59 64 "merged", 60 65 "deleted_local"); 66 67 # The ippToPsps pages are no longer operational 68 @ippToPspsStages = (); 61 69 62 70 my @allStages = (@stages, @ippToPspsStages); … … 167 175 while (1) { 168 176 177 my $iterationStartTime = time(); 178 169 179 # sort out times 170 180 $today = strftime('%Y-%m-%d', localtime); … … 172 182 $end = $czarDb->getNowTimestamp(); 173 183 174 # if before 18:00 today, then start plots from 18:00 yesterday 175 if ($czarDb->isBefore($end, "$today $newDayTime")) {$begin = "$yesterday $newDayTime";} 176 # if after 18:00 today, then perform some daily tasks and start plots from 18:00 today 177 else { 184 if ($czarDb->isBefore($end, "$today $newDayTime")) { 185 # if before $newDayTime today (configured to 18:00), then start plots from $newDayTime yesterday 186 $begin = "$yesterday $newDayTime"; 187 } else { 188 # if after $newDayTime today (configured to 18:00), then perform some daily tasks and start plots from $newDayTime today 178 189 179 190 $begin = "$today $newDayTime"; … … 186 197 # create metrics for last 24 hours 187 198 print "* Creating metrics for last 24 hours\n"; 188 my $dayMetrics = new czartool::DayMetrics($config, 1, 0, $today);199 my $dayMetrics = new czartool::DayMetrics($config, $gpc1Db, 1, 0, $today); 189 200 $dayMetrics->writeHTML(); 190 201 191 202 # now update metrics index page 192 my $metricsIndex = new czartool::MetricsIndex($config, 1, 0);203 my $metricsIndex = new czartool::MetricsIndex($config, $gpc1Db, 1, 0); 193 204 $metricsIndex->writeHTML(); 194 205 … … 210 221 print "* Checking Nebulous\n"; 211 222 $nebulous->updateClusterSpaceInfo(); 212 $plotter ->plotStorageTimeSeries($czarDb->subtractInterval($begin, "1 WEEK") , $end);213 $plotter ->plotDiskUsageHistogram();214 $plotter ->plotDiskUsageHistogramLarge();223 $plotter0->plotStorageTimeSeries($czarDb->subtractInterval($begin, "1 WEEK") , $end); 224 $plotter0->plotDiskUsageHistogram(); 225 $plotter0->plotDiskUsageHistogramLarge(); 215 226 updateServerStatus(); 216 227 … … 239 250 foreach $row ( @{$labels} ) { 240 251 my ($label) = @{$row}; 252 # for now use priorities from gpc1 database 241 253 $priority = $gpc1Db->getPriority($label); 242 254 $czarDb->setLabelPriority($label, $priority); … … 244 256 245 257 updateAllStages($thisServer, $newState, $labels, $begin, $end); 246 if ($thisServer eq "stdscience") {createPlots($thisServer, $labels, $begin, $end);} 258 if ($thisServer eq "stdscience") { 259 createPlots($thisServer, $plotter1, $labels, $begin, $end); 260 createPlots($thisServer, $plotter2, $labels, $begin, $end); 261 } 247 262 } 248 263 else { print "* WARNING: no $thisServer labels found in Db\n";} 249 264 } 250 265 266 my $iterationTime = time() - $iterationStartTime; 267 268 print "done with czarpoll iteration after $iterationTime seconds\n"; 269 251 270 print "--------------------------------------------------------------------------\n"; 252 #print "* Going to sleep\n"; 253 #sleep($period); 254 #print "* Waking up\n"; 271 if ($iterationTime < $period) { 272 print "* Going to sleep\n"; 273 sleep($period - $iterationTime); 274 print "* Waking up\n"; 275 } 255 276 }; 256 277 } … … 262 283 ########################################################################### 263 284 sub createPlots { 264 my ($server, $ rows, $begin, $end) = @_;285 my ($server, $plotter, $rows, $begin, $end) = @_; 265 286 266 287 my $stage = undef; 267 288 my $row = undef; 268 289 269 print "* Generating plots\n"; 270 271 # get ippToPsps labels 272 my $ippToPspsLabels = undef; 273 $czarDb->getCurrentIppToPspsLabels($begin, $end, \$ippToPspsLabels); 274 $plotter->setIppToPspsMode(); 275 276 # create ippToPsps labels 277 foreach $stage (@ippToPspsStages) { 290 my $project = $plotter->getProject(); 291 print "* Generating plots for $project\n"; 292 293 # XXX The ippToPsps stuff is not project specific so it should be done somewhere 294 # else 295 if (scalar @ippToPspsStages) { 296 # get ippToPsps labels 297 my $ippToPspsLabels = undef; 298 $czarDb->getCurrentIppToPspsLabels($begin, $end, \$ippToPspsLabels); 299 $plotter->setIppToPspsMode(); 300 301 # create ippToPsps labels 302 foreach $stage (@ippToPspsStages) { 303 foreach $row ( @{$ippToPspsLabels} ) { 304 my ($label) = @{$row}; 305 306 chomp($label); 307 $plotter->createTimeSeries($label, $stage, $begin, $end, 1, 0, 1); 308 } 309 } 310 311 # create plots for each label for all stages for ippToPsps 278 312 foreach $row ( @{$ippToPspsLabels} ) { 279 313 my ($label) = @{$row}; 280 314 281 chomp($label); 282 $plotter->createTimeSeries($label, $stage, $begin, $end, 1, 0, 1); 283 } 284 } 285 286 # create plots for each label for all stages for ippToPsps 287 foreach $row ( @{$ippToPspsLabels} ) { 288 my ($label) = @{$row}; 289 290 $plotter->createTimeSeries($label, undef, $begin, $end, 1, 1, 1); 291 } 292 315 $plotter->createTimeSeries($label, undef, $begin, $end, 1, 1, 1); 316 } 317 } 293 318 294 319 # create plots for each label for each stage 295 320 $plotter->setStandardMode(); 321 296 322 foreach $stage (@stages) { 297 323 foreach $row ( @{$rows} ) { 298 324 my ($label) = @{$row}; 299 325 326 # skip update labels for now. The plots are not relevant. 327 next if $label =~ 'ps_ud'; 328 300 329 chomp($label); 301 330 $plotter->createTimeSeries($label, $stage, $begin, $end, 1, 0, 1); … … 308 337 foreach $row ( @{$rows} ) { 309 338 my ($label) = @{$row}; 339 340 # skip update labels for now. The plots are not relevant. 341 next if $label =~ 'ps_ud'; 310 342 311 343 $plotter->createTimeSeries($label, undef, $begin, $end, 1, 1, 1); … … 362 394 chomp($label); 363 395 396 # Move this to a function and pass in the database 364 397 $new = $gpc1Db->countExposures($label, $stage, $newState); 365 398 $full = $gpc1Db->countExposures($label, $stage, "full"); -
trunk/ippMonitor/czartool/czartool/Config.pm
r38250 r38258 126 126 ########################################################################### 127 127 # 128 # Returns an instance of a database for the given project 129 # 130 ########################################################################### 131 sub getDbInstanceForProject { 132 my ($self, $project) = @_; 133 134 if ($project eq 'gpc1') { 135 return $self->getGpc1Instance(); 136 } elsif ($project eq 'gpc2') { 137 return $self->getGpc2Instance(); 138 } else { 139 return undef; 140 } 141 } 142 143 ########################################################################### 144 # 128 145 # Returns the interval used in czarDB cleanup 129 146 # -
trunk/ippMonitor/czartool/czartool/CzarDb.pm
r38250 r38258 214 214 ########################################################################### 215 215 # 216 # Update s current_labels table216 # Update server_dates table 217 217 # 218 218 ########################################################################### … … 380 380 my ($self, $label, $stage, $fromTime, $toTime, $minX, $maxX, $timeDiff) = @_; 381 381 382 # XXX: I'm not splitting this by project (dbname). 383 # Is that ok? Seems like a good idea because this will make the time 384 # range of the plots for both projects the same. 385 382 386 my $query = $self->{_db}->prepare(<<SQL); 383 387 SELECT … … 411 415 ########################################################################### 412 416 sub getDayTimings { 413 my ($self, $label, $ startStage, $endStage, $begin, $started, $finished, $timeTaken) = @_;417 my ($self, $label, $dbname, $startStage, $endStage, $begin, $started, $finished, $timeTaken) = @_; 414 418 415 419 my $end = $self->addInterval($begin, "1 DAY"); 416 420 417 my $startStageMetrics = new czartool::StageMetrics($startStage, $label, $ begin, $end);418 my $endStageMetrics = new czartool::StageMetrics($endStage, $label, $ begin, $end);419 420 if (!$self->runAnalysis($startStageMetrics )) {return 0;}421 if (!$self->runAnalysis($endStageMetrics )) {return 0;}421 my $startStageMetrics = new czartool::StageMetrics($startStage, $label, $dbname, $begin, $end); 422 my $endStageMetrics = new czartool::StageMetrics($endStage, $label, $dbname, $begin, $end); 423 424 if (!$self->runAnalysis($startStageMetrics, $dbname)) {return 0;} 425 if (!$self->runAnalysis($endStageMetrics, $dbname)) {return 0;} 422 426 423 427 ${$started} = $startStageMetrics->getStarted(); … … 436 440 ########################################################################### 437 441 sub runAnalysis { 438 my ($self, $stageMetrics ) = @_;442 my ($self, $stageMetrics, $dbname) = @_; 439 443 440 444 if (!$stageMetrics) {return 0;} … … 445 449 my $toTime = $stageMetrics->getEndTime(); 446 450 451 447 452 $toTime = $self->addInterval($toTime, "20 MINUTE"); # TODO dodgy 448 453 … … 452 457 FROM $stage 453 458 WHERE label LIKE '$label' 459 AND dbname LIKE '$dbname' 454 460 AND timestamp >= '$fromTime' AND timestamp <= '$toTime' 455 461 ORDER BY timestamp; … … 656 662 ########################################################################### 657 663 sub createTimeSeriesData { 658 my ($self, $label, $ stage, $fromTime, $toTime, $minX, $maxX, $timeDiff, $linDataFile, $logDataFile, $ratDataFile) = @_;664 my ($self, $label, $dbname, $stage, $fromTime, $toTime, $minX, $maxX, $timeDiff, $linDataFile, $logDataFile, $ratDataFile) = @_; 659 665 660 666 # get total number of data points … … 663 669 FROM $stage 664 670 WHERE label LIKE '$label' 671 AND dbname LIKE '$dbname' 665 672 AND timestamp >= '$fromTime' AND timestamp <= '$toTime'; 666 673 SQL … … 680 687 FROM $stage 681 688 WHERE label LIKE '$label' 689 AND dbname LIKE '$dbname' 682 690 AND timestamp >= '$fromTime' AND timestamp <= '$toTime' 683 691 ORDER BY timestamp; … … 854 862 ########################################################################### 855 863 sub countFaultsInPast { 856 my ($self, $label, $ stage, $interval) = @_; # TODO use time not interval864 my ($self, $label, $dbname, $stage, $interval) = @_; # TODO use time not interval 857 865 858 866 # get earliest time for this label … … 860 868 SELECT GREATEST(MIN(timestamp), now() - INTERVAL $interval) 861 869 FROM $stage 862 WHERE label LIKE '$label'; 870 WHERE label LIKE '$label' 871 AND dbname LIKE '$dbname'; 863 872 SQL 864 873 $query->execute; … … 870 879 FROM $stage 871 880 WHERE label LIKE '$label' 881 AND dbname LIKE '$dbname' 872 882 AND timestamp <= '$timestamp' LIMIT 1; 873 883 SQL … … 883 893 ########################################################################### 884 894 sub countPendingNow { 885 my ($self, $label, $ stage) = @_;895 my ($self, $label, $dbname, $stage) = @_; 886 896 887 897 my $query = $self->{_db}->prepare(<<SQL); … … 889 899 FROM $stage 890 900 WHERE label LIKE '$label' 901 AND dbname LIKE '$dbname' 891 902 ORDER BY timestamp DESC LIMIT 1; 892 903 SQL … … 902 913 ########################################################################### 903 914 sub countProcessedPendingAndFaults { 904 my ($self, $label, $ stage, $fromTime, $toTime, $processed, $pending, $faults) = @_;915 my ($self, $label, $dbname, $stage, $fromTime, $toTime, $processed, $pending, $faults) = @_; 905 916 906 917 my $query = $self->{_db}->prepare(<<SQL); … … 909 920 FROM $stage 910 921 WHERE label LIKE '$label' 922 AND dbname like '$dbname' 911 923 AND timestamp >= '$fromTime' AND timestamp <= '$toTime' 912 924 ORDER BY timestamp DESC LIMIT 1; … … 917 929 (${$pending}, ${$faults}) = $query->fetchrow_array(); 918 930 919 ${$processed} = $self->countProcessed($label, $ stage, $fromTime, $toTime);931 ${$processed} = $self->countProcessed($label, $dbname, $stage, $fromTime, $toTime); 920 932 921 933 if (!${$pending}) {${$pending} = 0;} … … 1066 1078 ########################################################################### 1067 1079 sub createProcessingRateData { 1068 my ($self, $stage, $label, $ begin, $end, $interval, $dataFile, $minX, $maxX, $timeDiff) = @_;1080 my ($self, $stage, $label, $dbname, $begin, $end, $interval, $dataFile, $minX, $maxX, $timeDiff) = @_; 1069 1081 1070 1082 my $startTime = $begin; … … 1089 1101 if (!$self->isBefore($startTime, $end)) {last;} 1090 1102 $endTime = $self->addInterval($startTime, $interval); 1091 if (!$self->countProcessedPendingAndFaults($label, $ stage, $startTime, $endTime, \$processed, \$pending, \$faults)) {}1103 if (!$self->countProcessedPendingAndFaults($label, $dbname, $stage, $startTime, $endTime, \$processed, \$pending, \$faults)) {} 1092 1104 $timestamp = $self->getFormattedDate($endTime); 1093 1105 if (!$processed) {$processed = 0;} … … 1108 1120 ########################################################################### 1109 1121 sub countProcessed { 1110 my ($self, $label, $ stage, $begin, $end) = @_;1122 my ($self, $label, $dbname, $stage, $begin, $end) = @_; 1111 1123 1112 1124 my $query = $self->{_db}->prepare(<<SQL); … … 1115 1127 FROM $stage 1116 1128 WHERE label LIKE '$label' 1129 AND dbname LIKE '$dbname' 1117 1130 AND timestamp >= '$begin' 1118 1131 AND timestamp < '$end' -
trunk/ippMonitor/czartool/czartool/DayMetrics.pm
r38250 r38258 29 29 my $self = $class->SUPER::new( 30 30 $_[1], # config object 31 $_[2], # verbose 32 $_[3] # save_temps 31 $_[2], # projectDb 32 $_[3], # verbose 33 $_[4] # save_temps 33 34 ); 34 35 35 $self->{day} = $_[ 4];36 $self->{day} = $_[5]; 36 37 37 38 my $yesterday = $self->{czarDb}->subtractInterval($self->{day}, "1 DAY"); … … 68 69 69 70 # summit and chip exposures 70 my $summitExposures = $self->{gpc1Db}->countScienceExposuresFromLastNight($self->{day}); 71 my $chipMetrics = new czartool::StageMetrics("chip", "all_stdscience_labels", $self->{begin}, $self->{chipEnd}); 72 $self->{czarDb}->runAnalysis($chipMetrics); 71 my $summitExposures = $self->{projectDb}->countScienceExposuresFromLastNight($self->{day}); 72 my $dbname = $self->{projectDb}->getDbName(); 73 my $chipMetrics = new czartool::StageMetrics("chip", "all_stdscience_labels", $dbname, $self->{begin}, $self->{chipEnd}); 74 $self->{czarDb}->runAnalysis($chipMetrics, $dbname); 73 75 74 76 my $previousDay = $self->{czarDb}->subtractInterval($self->{day}, "1 DAY"); … … 136 138 foreach my $stage ( @stages ){ 137 139 138 my $stageMetrics = new czartool::StageMetrics($stage, $label, $ self->{begin}, ($stage eq "chip") ? $self->{chipEnd} : $self->{end});139 if (!$self->{czarDb}->runAnalysis($stageMetrics )) {next;}140 my $stageMetrics = new czartool::StageMetrics($stage, $label, $dbname, $self->{begin}, ($stage eq "chip") ? $self->{chipEnd} : $self->{end}); 141 if (!$self->{czarDb}->runAnalysis($stageMetrics, $dbname)) {next;} 140 142 141 143 if (!$stageMetrics->anythingProcessed()) {next;} … … 268 270 print $htmlFile " </tr>\n"; 269 271 272 my $dbname = $self->{projectDb}->getDbName(); 273 270 274 # OSS survey 271 275 my ($started, $finished, $timeTaken) = undef; 272 $self->{czarDb}->getDayTimings("OSS.nightlyscience", "chip", "diff", $self->{begin}, \$started, \$finished, \$timeTaken);276 $self->{czarDb}->getDayTimings("OSS.nightlyscience", $dbname, "chip", "diff", $self->{begin}, \$started, \$finished, \$timeTaken); 273 277 $self->printSurveyDetails("OSS", $started, $finished, $timeTaken); 274 278 … … 295 299 foreach $mdf (@mdfs) { 296 300 297 if ($self->{czarDb}->getDayTimings($mdf, "chip", "dist", $self->{begin}, \$started, \$finished, \$timeTaken)) {301 if ($self->{czarDb}->getDayTimings($mdf, $dbname, "chip", "dist", $self->{begin}, \$started, \$finished, \$timeTaken)) { 298 302 299 303 if ($started && $self->{czarDb}->isBefore($started, $earliest)) {$earliest = $started; $haveStart = 1;} … … 309 313 $self->printSurveyDetails("MDF", $earliest, $latest, $timeTaken); 310 314 311 $self->{czarDb}->getDayTimings("all_stdscience_labels", "chip", "dist",$self->{begin}, \$started, \$finished, \$timeTaken);315 $self->{czarDb}->getDayTimings("all_stdscience_labels", $dbname, "chip", "dist", $self->{begin}, \$started, \$finished, \$timeTaken); 312 316 $self->printSurveyDetails("All", $started, $finished, $timeTaken); 313 317 -
trunk/ippMonitor/czartool/czartool/Gpc1Db.pm
r38206 r38258 1 1 #!/usr/bin/perl i-w 2 3 # This class is now misnamed. Should be ProjectDb or something like that. 2 4 3 5 package czartool::Gpc1Db; -
trunk/ippMonitor/czartool/czartool/Metrics.pm
r32093 r38258 25 25 my $self = { 26 26 config => shift, 27 projectDb => shift, 27 28 verbose => shift, 28 29 save_temps => shift, 29 30 }; 30 31 31 $self->{gpc1Db} = $self->{config}->getGpc1Instance(); 32 # $self->{gpc1Db} = $self->{config}->getGpc1Instance(); 33 32 34 $self->{czarDb} = $self->{config}->getCzarDbInstance(); 33 35 $self->{baseDir} = $self->{config}->getMetricsSaveLocation(); … … 39 41 $self->{plotter} = czartool::Plotter->new_file( 40 42 $self->{config}, 43 $self->{projectDb}, 41 44 ".", 42 45 $self->{save_temps}); -
trunk/ippMonitor/czartool/czartool/MetricsIndex.pm
r32224 r38258 29 29 my $self = $class->SUPER::new( 30 30 $_[1], # config object 31 $_[2], # verbose 32 $_[3] # save_temps 31 $_[2], # database 32 $_[3], # verbose 33 $_[4] # save_temps 33 34 ); 34 35 -
trunk/ippMonitor/czartool/czartool/MySQLDb.pm
r32093 r38258 65 65 } 66 66 67 sub getDbName { 68 my( $self ) = @_; 69 return $self->{_dbName}; 70 } 71 67 72 ########################################################################### 68 73 # -
trunk/ippMonitor/czartool/czartool/Plotter.pm
r38214 r38258 46 46 my $self = { 47 47 _config => shift, 48 _projectDb => shift, 48 49 _dateFormat => shift, 49 50 _outputFormat => shift, … … 52 53 }; 53 54 55 54 56 bless $self, $class; 55 57 $self->init(); … … 66 68 my $self = { 67 69 _config => shift, 70 _projectDb => shift, 68 71 _outputPath => shift, 69 72 _save_temps => shift, … … 86 89 my $self = { 87 90 _config => shift, 91 _projectDb => shift, 88 92 _save_temps => shift, 89 93 }; … … 128 132 my ($self) = @_; 129 133 130 $self->{_gpc1Db} = $self->{_config}->getGpc1Instance(); 134 if ($self->{_projectDb}) { 135 $self->{_project} = $self->{_projectDb}->getDbName(); 136 } else { 137 $self->{_project} = undef; 138 } 139 140 131 141 $self->{_czarDb} = $self->{_config}->getCzarDbInstance(); 132 142 $self->setStandardMode(); 143 } 144 145 ########################################################################### 146 # 147 # Get the project (dbname) associated with this Plotter 148 # 149 ########################################################################### 150 sub getProject { 151 my ($self) = @_; 152 return $self->{_project}; 133 153 } 134 154 … … 209 229 $stage, 210 230 $label, 231 $self->{_project}, 211 232 $beginTime, 212 233 $endTime, … … 301 322 if($self->{_czarDb}->createTimeSeriesData( 302 323 $label, 324 $self->{_project}, 303 325 $stage, 304 326 $beginTime, … … 403 425 if (!$self->{_czarDb}->countProcessedPendingAndFaults( 404 426 $label, 427 $self->{_project}, 405 428 $stage, 406 429 $beginTime, … … 547 570 $title .= " for '$label'\\nFrom '$fromTime' to '$toTime' HST"; 548 571 549 open (GP, "|$GNUPLOT -persist ") or die "no gnuplot";572 open (GP, "|$GNUPLOT -persist > /dev/null 2>&1") or die "no gnuplot"; 550 573 use FileHandle; 551 574 GP->autoflush(1); … … 747 770 748 771 my $fracs; 749 if (!$self->{_ gpc1Db}->getMagicMaskFraction($exp_id, \$fracs)) {return 0;}772 if (!$self->{_projectDb}->getMagicMaskFraction($exp_id, \$fracs)) {return 0;} 750 773 751 774 open (GNUDAT, ">".$tmpFile->filename); … … 809 832 # get exposures between these dates 810 833 my $exp_ids = undef; 811 if (!$self->{_ gpc1Db}->getProcessedExposures($begin, $end, \$exp_ids)) {return 0;}834 if (!$self->{_projectDb}->getProcessedExposures($begin, $end, \$exp_ids)) {return 0;} 812 835 my $totalExp = @{$exp_ids}; 813 836 if ($totalExp < 1) {return 0;} … … 844 867 $exp_id = @{$row}[0]; 845 868 846 if (!$self->{_ gpc1Db}->getMagicMaskStats($exp_id, \$meanMask, \$sumMask, \$chipCount )) {next;}869 if (!$self->{_projectDb}->getMagicMaskStats($exp_id, \$meanMask, \$sumMask, \$chipCount )) {next;} 847 870 848 871 -
trunk/ippMonitor/czartool/czartool/StageMetrics.pm
r32093 r38258 17 17 stage => shift, 18 18 label => shift, 19 dbname => shift, 19 20 startTime => shift, 20 21 endTime => shift … … 111 112 sub getEndTime() {my $self = shift; return $self->{endTime};} 112 113 sub getLabel() {my $self = shift; return $self->{label};} 114 sub getDbname() {my $self = shift; return $self->{dbname};} 113 115 sub getStage() {my $self = shift; return $self->{stage};} 114 116 sub getStarted() {my $self = shift; return $self->{started};} -
trunk/ippMonitor/raw/czartool_exposures.php
r30563 r38258 6 6 7 7 if (! $ID['proj']) { projectform ($ID); } 8 $ gpc1db = dbconnect($ID['proj']);8 $projectdb = dbconnect($ID['proj']); 9 9 10 10 $PATH = getenv("PATH"); … … 46 46 echo "</form>\n"; 47 47 48 createTableForThisSurvey($ gpc1db, $date, $survey);48 createTableForThisSurvey($projectdb, $date, $survey); 49 49 50 50 menu_end(); -
trunk/ippMonitor/raw/czartool_getplot.php
r35391 r38258 18 18 $plottype = $_GET[plottype]; 19 19 20 $path = "/data/ipp009.0/czartool_plots"; # TODO horrible hard-coded path - read from config 20 $proj = $_GET[proj]; 21 22 $path = $CZARPLOTDIR; 21 23 22 24 if ($label == "all") $label = "all_".$mode."_labels"; 23 25 24 26 if ($type=="t" || $type=="r" || $type=="rt" || $type=="rh") 25 $filePath = "$path/ czarplot_".$plottype."_".$label."_".$stage."_".$type.".png";27 $filePath = "$path/$proj/czarplot_".$plottype."_".$label."_".$stage."_".$type.".png"; 26 28 else if ($type=="h") 27 29 $filePath = "$path/czarplot_".$plottype."_".$label."_all_stages_".$type.".png"; -
trunk/ippMonitor/raw/czartool_labels.php
r38257 r38258 8 8 if (! $ID['proj']) { projectform ($ID); } 9 9 10 // $db = dbconnect($ID['proj']);11 $czardb = dbconnect( "czardb"); // HACK to connect to czarDb10 // connect to czarDb 11 $czardb = dbconnect($CZARDBNAME); 12 12 $lastUpdateTime = getLastUpdateTime($czardb); 13 13 14 $ gpc1db = dbconnect($ID['proj']);14 $projectdb = dbconnect($ID['proj']); 15 15 16 16 $PATH = getenv("PATH"); … … 99 99 $menu = $ID['menu']; 100 100 101 $selectedMode = $_GET[mode]; 101 // The Update mode of czartool is obsolete since we don't use the update 102 // pantasks. 103 // $selectedMode = $_GET[mode]; 104 $selectedMode = "stdscience"; 105 102 106 $selectedStage = $_GET[stage]; 103 107 $selectedLabel = $_GET[label]; … … 135 139 $labels = getLabels($czardb, $selectedMode); 136 140 $distLabels = getLabels($czardb, "distribution"); 141 // publishing is in stdscience now 137 142 # $pubLabels = getLabels($czardb, "publishing"); 138 143 $pubLabels = $labels; … … 145 150 } 146 151 152 // The Update mode of czartool is obsolete. selectedMode is hardcoded to stdscience above. 147 153 $isUpdate = ($selectedMode == "update"); 148 $modeText = $isUpdate ? "Showing update processing" : "Showing standard processing"; 149 $modeLinkText = $isUpdate ? "standard" : "update"; 150 $modeLink = $isUpdate ? "stdscience" : "update"; 151 $link = "czartool_labels.php?pass=".$pass."&proj=".$proj."&mode=".$modeLink."&label=all&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotType"; 154 $isUpdate = 0; 155 156 // hijack the text and link at the top to create a link to the czartool monitoring the other project database 157 // I.E. Switch from gpc1 to gpc2 or gpc2 to gpc1 158 159 $modeText = "Monitoring $proj"; 160 if ($proj == 'gpc1') { 161 $newproj = 'gpc2'; 162 } else { 163 $newproj = 'gpc1'; 164 } 165 $link = "czartool_labels.php?pass=".$pass."&mode=".$selectedMode."&label=all&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotType"; 152 166 153 167 // set up the form … … 164 178 echo "<td colspan=\"3\" style=\"background-color:#0080c0;\">"; 165 179 echo "<h1 align=\"middle\">Czartool</h1>"; 166 echo "<h 4 align=\"middle\">$modeText (change to <a href=\"$link\"><font color=\"blue\">$modeLinkText</font></a>)</h4>";180 echo "<h2 align=\"middle\">$modeText (change to <a href=\"$link&proj=$newproj\"><font color=\"blue\">$newproj</font></a>)</h2>"; 167 181 echo "</td>"; 168 182 echo "</tr>"; 169 183 184 // PLOTS 170 185 echo "<tr valign=\"top\">"; 171 186 echo "<td style=width:100px;text-align:top;\">"; 172 187 # time series plot 173 echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel& stage=$selectedStage&plottype=$plotType\"><br>";188 echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=$plotType\"><br>"; 174 189 # rate time series plot 175 echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=rt&label=$selectedLabel& stage=$selectedStage&plottype=linear\"><br>";190 echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=rt&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br>"; 176 191 # rate stacked histo plot 177 # echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=rh&label=$selectedLabel& stage=$selectedStage&plottype=linear\"><br>";192 # echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=rh&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br>"; 178 193 # histogram plot 179 # echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=h&label=$selectedLabel& stage=$selectedStage&plottype=linear\"><br>";194 # echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=h&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br>"; 180 195 # storage plot 181 196 echo "<br><a href=\"czartool_getplot.php?type=sl\"><img title=\"Click to enlarge me\" src=\"czartool_getplot.php?type=s\"></a><br>"; … … 186 201 if ($selectedServer && !$serverCmd) showServerStatus($selectedServer); 187 202 echo "</td>"; 203 204 188 205 echo "<td style=height:200px;width:10px;text-align:top;\">"; 189 206 echo "<td style=height:200px;width:400px;text-align:top;\">"; … … 240 257 createServersTable($pass, $proj,$selectedMode,$czardb, $servers, $selectedLabel, $selectedStage, $plotType); 241 258 echo "<br>"; 242 createSummitDataTable($ gpc1db);259 createSummitDataTable($projectdb); 243 260 echo "<br>"; 244 261 createDatesTable($czardb); … … 253 270 createTableColumnHeader("Status (sec behind master)"); 254 271 showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_DBNAME_GPC1); 272 273 // XXX: avoid replication status checking errors due to missing passwords from my test host 274 // XXX: TODO: remove this conditional before committing changes 275 if (0) { 255 276 # XXX EAM : problem showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_DBNAME_NEBULOUS); 256 277 showReplicationsStatus($REPL_HOST_PSTAMP, $REPL_USER_PSTAMP, $REPL_PASSWORD_PSTAMP, $REPL_DBNAME_PSTAMP); … … 258 279 showReplicationsStatus($REPL_HOST_ISP, $REPL_USER_ISP, $REPL_PASSWORD_ISP, $REPL_DBNAME_ISP); 259 280 showReplicationsStatus($REPL_HOST_NEBULOUS_SECONDARY, $REPL_USER_NEBULOUS_SECONDARY, $REPL_PASSWORD_NEBULOUS_SECONDARY, $REPL_DBNAME_NEBULOUS_SECONDARY); 281 } 260 282 echo "</table>"; 261 283 … … 315 337 # 316 338 ########################################################################### 317 function createSummitDataTable($ gpc1db) {339 function createSummitDataTable($projectdb) { 318 340 319 341 $date = date("Y-m-d"); 320 342 $sql = "SELECT DISTINCT exp_type FROM summitExp WHERE dateobs > '$date'"; 321 343 322 $qry = $ gpc1db->query($sql);344 $qry = $projectdb->query($sql); 323 345 if (dberror($qry)) { 324 346 echo "<b>error reading newExp table</b><br>\n"; … … 343 365 344 366 $sql = "SELECT COUNT(*) FROM summitExp WHERE dateobs > '$date' AND exp_type = '$expType[0]'"; 345 $qry2 = $ gpc1db->query($sql);367 $qry2 = $projectdb->query($sql); 346 368 $qry2->fetchInto($summit); 347 369 $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name WHERE summitExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'"; 348 $qry2 = $ gpc1db->query($sql);370 $qry2 = $projectdb->query($sql); 349 371 $qry2->fetchInto($mhpcc); 350 372 … … 373 395 function getLabels($db, $server) { 374 396 375 # order by descending priority as set in gpc1database397 # order by descending priority as set in project database 376 398 $sql = "SELECT label FROM current_labels WHERE server LIKE '$server' ORDER BY priority DESC"; 377 399 if ($debug) {echo "$sql<br>";} … … 490 512 $myTable = $mainTable[$stage]; 491 513 $myFailures = $getFailures[$stage]; 492 # echo "myTable: $myTable";514 # echo "myTable: $myTable"; 493 515 494 516 if ("$myFailures" == "NONE") { … … 501 523 } 502 524 } 503 getStateAndFaults($db, $thisLabel, $ selectedState, $stage, $str, $anyFaults);525 getStateAndFaults($db, $thisLabel, $proj, $selectedState, $stage, $str, $anyFaults); 504 526 505 527 $cellcolor = 0; … … 647 669 # 648 670 ########################################################################### 649 function getStateAndFaults($db, $label, $ state, $stage, &$str, &$anyFaults) {671 function getStateAndFaults($db, $label, $proj, $state, $stage, &$str, &$anyFaults) { 650 672 651 673 $anyFaults = false; 652 $sql = "SELECT pending, faults FROM $stage WHERE label LIKE '$label' ORDER BY timestamp DESC LIMIT 1";674 $sql = "SELECT pending, faults FROM $stage WHERE label LIKE '$label' AND dbname LIKE '$proj' ORDER BY timestamp DESC LIMIT 1"; 653 675 if ($debug) {echo "$sql<br>";} 654 676 -
trunk/ippMonitor/raw/ipp.czar.dat
r33846 r38258 4 4 5 5 menulink | menuselect | link | czartool - standard | czartool_labels.php 6 menulink | menuselect | link | czartool - ipptopsps | czartool_ipptopsps.php7 6 menulink | menuselect | link | mask stats | maskStats.php 8 7 menulink | menuselect | link | night summary | nightSummary.php -
trunk/ippMonitor/raw/ipp.php
r37983 r38258 69 69 global $DBUSER; 70 70 global $DBPASS; 71 global $CZARDBNAME; 72 global $CZARDBHOST; 71 73 72 74 $success = 0; … … 86 88 // connect to the database 87 89 if ($DBI == "DB") { 88 $db = DB::connect("mysql://$DBUSER:$DBPASS@$DBHOST/$database"); 90 if ($database == $CZARDBNAME) { 91 $db = DB::connect("mysql://$DBUSER:$DBPASS@$CZARDBHOST/$database"); 92 } else { 93 $db = DB::connect("mysql://$DBUSER:$DBPASS@$DBHOST/$database"); 94 } 89 95 } 90 96 if ($DBI == "MDB2") { … … 192 198 function checkID () { 193 199 200 194 201 $VERBOSE = 0; 202 if ($VERBOSE > 1) { 203 phpinfo(32); 204 } 195 205 196 206 // check for valid server method
Note:
See TracChangeset
for help on using the changeset viewer.
