Changeset 41125 for trunk/ippMonitor
- Timestamp:
- Nov 14, 2019, 2:50:20 PM (7 years ago)
- Location:
- trunk/ippMonitor
- Files:
-
- 1 added
- 4 edited
-
czartool/czarDbSchema.sql (modified) (1 diff)
-
czartool/czarpoll.pl (modified) (5 diffs)
-
czartool/czartool/CzarDb.pm (modified) (1 diff)
-
czartool/extra_labels.dat (added)
-
raw/czartool_labels.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/czartool/czarDbSchema.sql
r40055 r41125 404 404 405 405 -- 406 -- Table structure for table `science_labels` (from current_labels) 407 -- 408 409 DROP TABLE IF EXISTS `science_labels`; 410 SET @saved_cs_client = @@character_set_client; 411 SET character_set_client = utf8; 412 CREATE TABLE `science_labels` ( 413 `server` varchar(128) default NULL, 414 `label` varchar(128) default NULL, 415 `telescope` varchar(128) NOT NULL, 416 `priority` int(11) NOT NULL default '0', 417 KEY `science_labels` (`server`,`label`, `telescope`) 418 ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 419 SET character_set_client = @saved_cs_client; 420 421 -- 422 -- Table structure for table `science_nightlyscience` (from nightlyscience) 423 -- 424 425 DROP TABLE IF EXISTS `science_nightlyscience`; 426 SET @saved_cs_client = @@character_set_client; 427 SET character_set_client = utf8; 428 CREATE TABLE `science_nightlyscience` ( 429 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, 430 `status` varchar(128) default 'NONE', 431 `telescope` varchar(128) NOT NULL 432 ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 433 SET character_set_client = @saved_cs_client; 434 435 -- 436 -- Table structure for table `science_reverts` (from reverts) 437 -- 438 439 DROP TABLE IF EXISTS `science_reverts`; 440 SET @saved_cs_client = @@character_set_client; 441 SET character_set_client = utf8; 442 CREATE TABLE `science_reverts` ( 443 `stage` varchar(128) default NULL, 444 `telescope` varchar(128) NOT NULL, 445 `reverting` tinyint(4) default NULL 446 ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 447 SET character_set_client = @saved_cs_client; 448 449 -- 450 -- Table structure for table `science_server_dates` (from server_dates) 451 -- 452 453 DROP TABLE IF EXISTS `science_server_dates`; 454 SET @saved_cs_client = @@character_set_client; 455 SET character_set_client = utf8; 456 CREATE TABLE `science_server_dates` ( 457 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, 458 `server` varchar(64) default 'NONE', 459 `telescope` varchar(128) NOT NULL, 460 `date` varchar(64) default 'NONE' 461 ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 462 SET character_set_client = @saved_cs_client; 463 464 -- 465 -- Table structure for table `science_servers` (from servers) 466 -- 467 468 DROP TABLE IF EXISTS `science_servers`; 469 SET @saved_cs_client = @@character_set_client; 470 SET character_set_client = utf8; 471 CREATE TABLE `science_servers` ( 472 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, 473 `server` varchar(128) default NULL, 474 `telescope` varchar(128) NOT NULL, 475 `alive` tinyint(4) default NULL, 476 `running` tinyint(4) default NULL 477 ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 478 SET character_set_client = @saved_cs_client; 479 480 -- 481 -- Table structure for table `live_servers` (from servers) 482 -- 483 484 DROP TABLE IF EXISTS `live_servers`; 485 SET @saved_cs_client = @@character_set_client; 486 SET character_set_client = utf8; 487 CREATE TABLE `live_servers` ( 488 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, 489 `server` varchar(128) default NULL, 490 `telescope` varchar(128) NOT NULL, 491 `alive` tinyint(4) default NULL, 492 `running` tinyint(4) default NULL 493 ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 494 SET character_set_client = @saved_cs_client; 495 496 -- 406 497 -- Table structure for table `server_dates` 407 498 -- -
trunk/ippMonitor/czartool/czarpoll.pl
r40879 r41125 236 236 $pantasks->getServerStatus($server,'gpc2', \$alive, \$running); 237 237 $czarDb->updateServerStatus($server,'gpc2', $alive, $running); 238 } 239 } 240 241 ########################################################################### 242 # 243 # Updates pantasks server status TODO should really get info for all servers at once 244 # 245 ########################################################################### 246 sub updateServerStatusLive { 247 print "* Checking all pantasks servers\n"; 248 249 my $servers = $pantasks->getServerList(); 250 251 my $server = undef; 252 my $alive = undef; 253 my $running = undef; 254 foreach $server (@{$servers}) { 255 $pantasks->getServerStatus($server,'gpc1', \$alive, \$running); 256 $czarDb->updateServerStatusLive($server,'gpc1', $alive, $running); 257 $pantasks->getServerStatus($server,'gpc2', \$alive, \$running); 258 $czarDb->updateServerStatusLive($server,'gpc2', $alive, $running); 238 259 } 239 260 } … … 272 293 my $newDayTime = $config->getMetricsStartTime(); 273 294 my $lastDayDailyTasks = "2010-01-01"; 274 295 my $checkneb = 1; # 1 for nebulous, 0 for localhost test 275 296 # main polling loop 276 297 while (1) { 298 277 299 my $iterationStartTime = time(); 278 300 279 301 #get the time of last czarpoll update 280 302 $polldate = $czarDb->getPollDate(); … … 287 309 if($timediff > 120.) { 288 310 print "There is no recent Czarpoll iteration\n"; 289 print "* Updating database entries*\n";311 print "* Updating database entries*\n"; 290 312 $dbupdate = 1; 291 313 } else { 292 314 print "There is a recent Czarpoll iteration already made ($timediff sec ago)\n"; 293 print "* Skipping database queries and entries*\n";315 print "* Skipping database queries and entries\n"; 294 316 $dbupdate = 0; 295 317 } … … 326 348 #TdB20190703: The ipp113 and ipp117 instances of czarpoll use the same stage DBs in czarDB. 327 349 #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();350 print "* Performing database cleanup\n"; 351 $czarDb->cleanupDateRange($yesterday, $yesterday, $config->getCzarCleanupInterval()); 352 print "* Optimizing the database\n"; 353 $czarDb->optimize(); 332 354 $lastDayDailyTasks = $yesterday; 333 355 } … … 344 366 345 367 # check nebulous 346 print "* Checking Nebulous\n"; 347 if($dbupdate == 1) {$nebulous->updateClusterSpaceInfo();} 348 $plotter0->plotStorageTimeSeries($czarDb->subtractInterval($begin, "1 WEEK") , $end); 349 $plotter0->plotDiskUsageHistogram(); 350 $plotter0->plotDiskUsageHistogramLarge(); 368 if ($checkneb == 1) { 369 print "* Checking Nebulous\n"; 370 if($dbupdate == 1) {$nebulous->updateClusterSpaceInfo();} 371 $plotter0->plotStorageTimeSeries($czarDb->subtractInterval($begin, "1 WEEK") , $end); 372 $plotter0->plotDiskUsageHistogram(); 373 $plotter0->plotDiskUsageHistogramLarge(); 374 } 375 else { 376 print "* Locahost, so no checking nebulous\n"; 377 } 378 379 # check pantasks status 351 380 if($dbupdate == 1) {updateServerStatus();} 381 if($dbupdate == 1) {updateServerStatusLive();} 352 382 353 383 # check pantasks dates -
trunk/ippMonitor/czartool/czartool/CzarDb.pm
r40878 r41125 166 166 SQL 167 167 168 $query->execute; 169 } 170 171 ########################################################################### 172 # 173 # Updates server table 174 # 175 ########################################################################### 176 sub updateServerStatusLive { 177 my ($self, $server,$telescope, $alive, $running) = @_; 178 179 my $query = $self->{_db}->prepare(<<SQL); 180 DELETE FROM live_servers where timestamp < CURRENT_TIMESTAMP - INTERVAL 12 hour; 181 SQL 182 $query->execute; 183 184 $query = $self->{_db}->prepare(<<SQL); 185 INSERT INTO live_servers 186 (server,telescope, alive, running) 187 VALUES 188 ('$server','$telescope', $alive, $running); 189 SQL 168 190 $query->execute; 169 191 } -
trunk/ippMonitor/raw/czartool_labels.php
r40936 r41125 214 214 echo "<td style=height:200px;width:400px;text-align:top;\">"; 215 215 216 #echo "<br>"; 216 ///////////////////////////////////////// 217 // timer begin for status and links 218 ///////////////////////////////////////// 219 $time = microtime(); 220 $time = explode(' ', $time); 221 $time = $time[1] + $time[0]; 222 $start = $time; 217 223 218 224 // status table at top 219 225 $nsStatus = getNightlyScienceStatus($czardb, $proj); 220 226 $plotTypeLink = ($plotType == "linear") ? "log" : "linear"; 221 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink"; 227 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . 228 "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink"; 229 222 230 echo "<br>"; 223 231 echo $table; 224 225 createTableTitle("Status and links", 3); 232 createTableTitle("Status and links", 2); 226 233 echo "<tr>\n"; 227 echo "<tr><td>Time of last update</td><td>$lastUpdateTime</td></tr>"; 228 echo "<tr><td>ippMonitor SVN version</td><td>"; include 'version.php'; echo "</td></tr>"; 229 echo "<tr><td>Current nightly science status</td><td>$nsStatus</td></tr>"; 230 echo "<tr><td>Postage stamp server status</td><td><a href=\"http://pstamp.ipp.ifa.hawaii.edu/status.php\"><font color=\"blue\">here</font></a></td></tr>"; 231 echo "<tr><td>Documentation</td><td><a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing\"><font color=\"blue\">here</font></a></td></tr>"; 232 echo "<tr><td>Cluster load</td><td><a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&hc=6&c=IPP%2520Production\"><font color=\"blue\">here</font></a> <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?m=cpu_report&r=hour&s=by%2520name&c=IPP+Production&h=&sh=1&hc=8&z=small\"><font color=\"blue\">cpu_report</font></a> <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?m=mem_report&r=hour&s=by%2520name&c=IPP+Production&h=&sh=1&hc=8&z=small\"><font color=\"blue\">mem_report</font></a></td></tr>"; 233 echo "<tr><td>IPP metrics</td><td><a href=\"https://ps1wiki.ifa.hawaii.edu/data/metrics/index.html\"><font color=\"blue\">here</font></a></td></tr>"; 234 echo "<tr><td>Czar log pages</td><td><a href=\"https://confluence.ipp.ifa.hawaii.edu/pages/viewrecentblogposts.action?key=IPPCZAR\"><font color=\"blue\">here</font></a></td></tr>"; 235 echo "<tr><td>Exposure summary</td><td><a href=\"czartool_exposures.php?pass=$pass&proj=$proj\"><font color=\"blue\">here</font></a></td></tr>"; 236 echo "<tr><td>Confluence</td><td><a href=\"https://confluence.ipp.ifa.hawaii.edu/display/IPPCZAR/IPP-Czaring+Home\"><font color=\"blue\">here</font></a></td></tr>"; 237 echo "<tr><td>JIRA</td><td><a href=\"https://jira.ipp.ifa.hawaii.edu/secure/Dashboard.jspa\"><font color=\"blue\">here</font></a></td></tr>"; 234 echo "<tr><td>Time of last update</td> 235 <td>$lastUpdateTime</td></tr>"; 236 echo "<tr><td>ippMonitor SVN version</td> 237 <td>"; include 'version.php'; echo "</td></tr>"; 238 echo "<tr><td>Current nightly science status</td> 239 <td>$nsStatus</td></tr>"; 240 echo "<tr><td>Postage stamp server status</td> 241 <td><a href=\"http://pstamp.ipp.ifa.hawaii.edu/status.php\" target=new><font color=\"blue\">here</font></a></td></tr>"; 242 echo "<tr><td>Documentation</td> 243 <td><a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing\" target=new><font color=\"blue\">here</font></a></td></tr>"; 244 echo "<tr><td>Cluster load</td> 245 <td><a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&hc=6&c=IPP%2520Production\"> 246 <font color=\"blue\">here</font></a> 247 <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?m=cpu_report&r=hour&s=by%2520name&c=IPP+Production&h=&sh=1&hc=8&z=small\"> 248 <font color=\"blue\">cpu_report</font></a> 249 <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?m=mem_report&r=hour&s=by%2520name&c=IPP+Production&h=&sh=1&hc=8&z=small\"> 250 <font color=\"blue\">mem_report</font></a></td></tr>"; 251 echo "<tr><td>IPP metrics</td> 252 <td><a href=\"https://ps1wiki.ifa.hawaii.edu/data/metrics/index.html\"><font color=\"blue\" target=new>here</font></a></td></tr>"; 253 echo "<tr><td>Czar log pages</td> 254 <td><a href=\"https://confluence.ipp.ifa.hawaii.edu/pages/viewrecentblogposts.action?key=IPPCZAR\" target=new><font color=\"blue\">here</font></a></td></tr>"; 255 echo "<tr><td>Exposure summary</td> 256 <td><a href=\"czartool_exposures.php?pass=$pass&proj=$proj\"><font color=\"blue\">here</font></a></td></tr>"; 257 echo "<tr><td>Confluence</td> 258 <td><a href=\"https://confluence.ipp.ifa.hawaii.edu/display/IPPCZAR/IPP-Czaring+Home\" target=new><font color=\"blue\">here</font></a></td></tr>"; 259 echo "<tr><td>JIRA</td> 260 <td><a href=\"https://jira.ipp.ifa.hawaii.edu/secure/Dashboard.jspa\" target=new><font color=\"blue\">here</font></a></td></tr>"; 261 echo "<tr><td>data store</td> 262 <td><a href=\"https://svn.ifa.hawaii.edu/\" target=new><font color=\"blue\">here</font></a></td></tr>"; 238 263 239 264 $plotTypeLink = ($plotType == "linear") ? "log" : "linear"; 240 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&mode=" . $selectedMode . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink"; 241 242 echo "</table>\n"; 243 244 echo "<br>"; 245 246 createLabelsTable($pass, 247 $proj, 248 $czardb, 249 $selectedMode, 250 $labels, 251 $distLabelsExist, 252 $pubLabelsExist, 253 $stages, 254 "new", 255 $selectedLabel, 256 $selectedStage, 257 $plotType); 258 259 if ($selectedMode == "update") {echo "<br>"; createPStampDataTable();} 260 echo "<br>"; 261 262 # XXX EAM : 2017.09.17 : debugging slowness 263 createServersTable($pass, $proj,$selectedMode,$czardb, $servers, $selectedLabel, $selectedStage, $plotType); echo "<br>"; 264 createSummitDataTable($projectdb); echo "<br>"; // this is slow because of the join between summitExp and rawExp 265 createChunkDataTable($projectdb); echo "<br>"; 266 createDatesTable($czardb, $proj); echo "<br>"; 267 268 echo $table; 269 echo "<tr>"; 270 createTableTitle("Database status (update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\">here</a>)", 2); 271 272 echo "<tr>"; 273 createTableColumnHeader("Database"); 274 createTableColumnHeader("Status (sec behind master)"); 275 showDatabaseStatus($HOST_GPC1, $USER_GPC1, $PASSWORD_GPC1, $DBNAME_GPC1); 276 showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_DBNAME_GPC1); 277 showReplicationsStatus($REPL_HOST_GPC1_SECONDARY, $REPL_USER_GPC1_SECONDARY, $REPL_PASSWORD_GPC1_SECONDARY, $REPL_DBNAME_GPC1_SECONDARY); 278 279 echo "<tr>"; 280 281 showDatabaseStatus($HOST_NEBULOUS, $USER_NEBULOUS, $PASSWORD_NEBULOUS, $DBNAME_NEBULOUS); 282 showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_DBNAME_NEBULOUS); 283 showReplicationsStatus($REPL_HOST_NEBULOUS_SECONDARY, $REPL_USER_NEBULOUS_SECONDARY, $REPL_PASSWORD_NEBULOUS_SECONDARY, $REPL_DBNAME_NEBULOUS_SECONDARY); 284 showReplicationsStatus($REPL_HOST_DATASTORE_SECONDARY, $REPL_USER_DATASTORE_SECONDARY, $REPL_PASSWORD_DATASTORE_SECONDARY, $REPL_DBNAME_DATASTORE_SECONDARY); 285 286 # some mysql replication slaves to add when they are returned to service 287 # showReplicationsStatus($REPL_HOST_PSTAMP, $REPL_USER_PSTAMP, $REPL_PASSWORD_PSTAMP, $REPL_DBNAME_PSTAMP); 288 # showReplicationsStatus($REPL_HOST_ISP, $REPL_USER_ISP, $REPL_PASSWORD_ISP, $REPL_DBNAME_ISP); 289 echo "</table>"; 290 291 echo $table; 292 echo "<tr>"; 293 createTableTitle("Critical machine status", 2); 294 295 echo "<tr>"; 296 createTableColumnHeader("Hostname"); 297 createTableColumnHeader("Status"); 298 showPingStatus($HOST_GATEWAY, $DBNAME_GATEWAY); 299 showPingStatus($HOST_GATEWAY_SECONDARY, $DBNAME_GATEWAY_SECONDARY); 300 301 # showPingStatus($HOST_APACHE1, $DBNAME_APACHE1); 302 showPingStatus($HOST_APACHE2, $DBNAME_APACHE2); 303 showPingStatus($HOST_APACHE3, $DBNAME_APACHE3); 304 showPingStatus($HOST_APACHE4, $DBNAME_APACHE4); 305 showPingStatus($HOST_APACHE5, $DBNAME_APACHE5); 306 showPingStatus($HOST_APACHE6, $DBNAME_APACHE6); 307 showPingStatus($HOST_APACHE7, $DBNAME_APACHE7); 308 showPingStatus($HOST_PROXY, $DBNAME_PROXY); 309 showPingStatus($HOST_SVN, $DBNAME_SVN); 310 showPingStatus($HOST_CONFLUENCE, $DBNAME_CONFLUENCE); 311 312 echo "</table>"; 313 314 echo "</table>"; 265 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&mode=" . $selectedMode . 266 "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink"; 267 268 // timer finished 269 echo "<tr><th colspan=4>"; 270 $time = microtime(); 271 $time = explode(' ', $time); 272 $time = $time[1] + $time[0]; 273 $finish = $time; 274 $total_time = round(($finish - $start), 3); 275 echo "loading in $total_time seconds."; 276 echo "</th></tr>"; 277 echo "</table><br>"; 278 279 createLabelsTable($pass, $proj, $czardb, $selectedMode, $labels, 280 $distLabelsExist, $pubLabelsExist, $stages, "new", $selectedLabel, 281 $selectedStage, $plotType); 282 if ($selectedMode == "update") {echo "<br>"; createPStampDataTable();} 283 284 # XXX EAM : 2017.09.17 : debugging slowness 285 # CCL : 2019.11.09 : debugging slowness 286 //createSummitDataTable($projectdb); // this is slow because of the join between summitExp and rawExp, but not the major one 287 createSummitDataTable2($projectdb); // this is slow because of the join between summitExp and rawExp, but not the major one 288 289 createServersTable($pass, $proj,$selectedMode,$czardb, $servers, $selectedLabel, $selectedStage, $plotType); 290 // this was the major slowness part due to large table in czardb 291 292 createChunkDataTable($projectdb); // this is another part for slowness during nightly processing 293 294 createDatesTable($czardb, $proj); 295 296 ///////////////////////////////////////// 297 // timer begin for Database status 298 ///////////////////////////////////////// 299 $time = microtime(); 300 $time = explode(' ', $time); 301 $time = $time[1] + $time[0]; 302 $start = $time; 303 304 // status table at top 305 echo $table; 306 echo "<tr>"; 307 createTableTitle("Database status (update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\">here</a>)", 2); 308 309 echo "<tr>"; 310 createTableColumnHeader("Database"); 311 createTableColumnHeader("Status (sec behind master)"); 312 showDatabaseStatus($HOST_GPC1, $USER_GPC1, $PASSWORD_GPC1, $DBNAME_GPC1); 313 showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_DBNAME_GPC1); 314 showReplicationsStatus($REPL_HOST_GPC1_SECONDARY, $REPL_USER_GPC1_SECONDARY, $REPL_PASSWORD_GPC1_SECONDARY, $REPL_DBNAME_GPC1_SECONDARY); 315 316 echo "<tr>"; 317 showDatabaseStatus($HOST_NEBULOUS, $USER_NEBULOUS, $PASSWORD_NEBULOUS, $DBNAME_NEBULOUS); 318 showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_DBNAME_NEBULOUS); 319 showReplicationsStatus($REPL_HOST_NEBULOUS_SECONDARY, $REPL_USER_NEBULOUS_SECONDARY, $REPL_PASSWORD_NEBULOUS_SECONDARY, $REPL_DBNAME_NEBULOUS_SECONDARY); 320 showReplicationsStatus($REPL_HOST_DATASTORE_SECONDARY, $REPL_USER_DATASTORE_SECONDARY, $REPL_PASSWORD_DATASTORE_SECONDARY, $REPL_DBNAME_DATASTORE_SECONDARY); 321 322 // some mysql replication slaves to add when they are returned to service 323 // showReplicationsStatus($REPL_HOST_PSTAMP, $REPL_USER_PSTAMP, $REPL_PASSWORD_PSTAMP, $REPL_DBNAME_PSTAMP); 324 // showReplicationsStatus($REPL_HOST_ISP, $REPL_USER_ISP, $REPL_PASSWORD_ISP, $REPL_DBNAME_ISP); 325 326 // timer finished 327 echo "<tr><th colspan=2>"; 328 $time = microtime(); 329 $time = explode(' ', $time); 330 $time = $time[1] + $time[0]; 331 $finish = $time; 332 $total_time = round(($finish - $start), 3); 333 echo "loading in $total_time seconds."; 334 echo "</th></tr>"; 335 echo "</table><br>"; 336 337 ///////////////////////////////////////// 338 // timer begin for critical machines 339 ///////////////////////////////////////// 340 $time = microtime(); 341 $time = explode(' ', $time); 342 $time = $time[1] + $time[0]; 343 $start = $time; 344 345 // status table at top 346 $PingStatus = "<font style=\"BACKGROUND-COLOR: yellow\" color=\"red\">DOWN</font>"; 347 echo $table; 348 echo "<tr>"; 349 createTableTitle("Critical machine status", 3); 350 351 echo "<tr>"; 352 createTableColumnHeader("Hostname"); 353 createTableColumnHeader("Status"); 354 createTableColumnHeader("Loading time"); 355 showPingStatus($HOST_GATEWAY, $DBNAME_GATEWAY); 356 showPingStatus($HOST_GATEWAY_SECONDARY, $DBNAME_GATEWAY_SECONDARY); 357 showPingStatus($HOST_APACHE1, $DBNAME_APACHE1); 358 showPingStatus($HOST_APACHE2, $DBNAME_APACHE2); 359 showPingStatus($HOST_APACHE3, $DBNAME_APACHE3); 360 showPingStatus($HOST_APACHE4, $DBNAME_APACHE4); 361 showPingStatus($HOST_APACHE5, $DBNAME_APACHE5); 362 showPingStatus($HOST_APACHE6, $DBNAME_APACHE6); 363 showPingStatus($HOST_APACHE7, $DBNAME_APACHE7); 364 showPingStatus($HOST_APACHE8, $DBNAME_APACHE8); 365 // echo "<td>ippc70 (apache node) <td> $PingStatus <td> 0 seconds "; // comment out if ippc70 is back 366 showPingStatus($HOST_PROXY, $DBNAME_PROXY); 367 showPingStatus($HOST_SVN, $DBNAME_SVN); 368 showPingStatus($HOST_CONFLUENCE, $DBNAME_CONFLUENCE); 369 370 // timer finished 371 echo "<tr><th colspan=3>"; 372 $time = microtime(); 373 $time = explode(' ', $time); 374 $time = $time[1] + $time[0]; 375 $finish = $time; 376 $total_time = round(($finish - $start), 3); 377 echo "loading in $total_time seconds."; 378 echo "</th></tr>"; 379 echo "</table><br>"; 380 381 315 382 menu_end(); 316 383 384 385 ############################################################################# 386 ############################# Functions Below ############################# 387 ############################################################################# 317 388 318 389 ########################################################################### … … 361 432 } 362 433 363 ###########################################################################364 #365 # Creates a table of summitExp against rawExp366 #367 ###########################################################################368 function createSummitDataTable($projectdb) {369 370 $date = date("Y-m-d");371 $sql = "SELECT DISTINCT exp_type FROM summitExp WHERE dateobs > '$date'";372 373 $qry = $projectdb->query($sql);374 if (dberror($qry)) {375 echo "<b>error reading newExp table</b><br>\n";376 echo "<br><small><b> table query : $sql </b></small><br>\n";377 menu_end();378 }379 380 // set up the table381 global $table;382 echo $table;383 echo "<tr>";384 createTableTitle("Status of last night's data", 4);385 echo "<tr>";386 createTableColumnHeader("Exposure type");387 createTableColumnHeader("At summit");388 createTableColumnHeader("Registered at MHPCC");389 createTableColumnHeader("At summit (Dropped)");390 391 $msg = "No science images taken since $date";392 393 // list the results394 while ($qry->fetchInto($expType)) {395 396 $sql = "SELECT COUNT(*) FROM summitExp left join pzDownloadExp using (summit_id) WHERE dateobs > '$date' AND exp_type = '$expType[0]' and (state != 'drop' or state is null) and fault != 1042";397 # $sql = "SELECT COUNT(*) FROM summitExp WHERE dateobs > '$date' AND exp_type = '$expType[0]'";398 $qry2 = $projectdb->query($sql);399 $qry2->fetchInto($summit);400 401 402 $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name WHERE summitExp.dateobs > '$date' AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'";403 $qry2 = $projectdb->query($sql);404 $qry2->fetchInto($mhpcc);405 406 $sql = "SELECT COUNT(*) FROM summitExp join pzDownloadExp using (summit_id) WHERE dateobs > '$date' AND exp_type = '$expType[0]' and state = 'drop'";407 $qry2 = $projectdb->query($sql);408 $qry2->fetchInto($dropped);409 410 411 #Query with 30 minutes delay to check during the night if any exposures are missing.412 $datehour = gmdate("Y-m-d H:i:s");413 $sql = "SELECT COUNT(*) FROM summitExp left join pzDownloadExp using (summit_id) WHERE dateobs > '$date' AND dateobs <= date_sub('$datehour', interval 30 minute) AND exp_type = '$expType[0]' and (state != 'drop' or state is null) and fault != 1042";414 $qry2 = $projectdb->query($sql);415 $qry2->fetchInto($summitdelay);416 417 $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name WHERE summitExp.dateobs > '$date' AND summitExp.dateobs <= date_sub('$datehour', interval 30 minute) AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'";418 $qry2 = $projectdb->query($sql);419 $qry2->fetchInto($mhpccdelay);420 421 echo "<tr>";422 423 $DLdiff = $summit[0] - $mhpcc[0];424 if ($DLdiff == 0) $error = 0;425 else $error = 1;426 427 $delayDLdiff = $summitdelay[0] - $mhpccdelay[0];428 if ($delayDLdiff == 0) $errordelay = 0;429 else $errordelay = 1;430 431 echo "<td>$expType[0]</td>";432 echo "<td>$summit[0]</td>";433 #createFormattedTableCell("", "", $mhpcc[0], $error, 0);434 if ($delayDLdiff==0) {435 createFormattedTableCell("", "", $mhpcc[0], $error, 0);436 } else {437 $DLStatus = "<font style=\"BACKGROUND-COLOR: yellow\" color=\"red\">$mhpcc[0] ($delayDLdiff)</font>";438 echo "<td>$DLStatus</td>";439 }440 441 echo "<td>$dropped[0]</td>";442 443 echo "</tr>";444 }445 446 echo "</table>\n";447 448 }449 434 450 435 ########################################################################### … … 455 440 function createChunkDataTable($projectdb) { 456 441 442 // timer start 443 $time = microtime(); 444 $time = explode(' ', $time); 445 $time = $time[1] + $time[0]; 446 $start = $time; 447 448 // function begin 457 449 #First find the reference exposure ID to speed up the subsequent queries 458 450 $date = gmdate("Y-m-d"); … … 592 584 echo "</tr>"; 593 585 } 594 echo "</table>\n"; 586 587 588 // timer finished 589 echo "<tr><th colspan=5>"; 590 $time = microtime(); 591 $time = explode(' ', $time); 592 $time = $time[1] + $time[0]; 593 $finish = $time; 594 $total_time = round(($finish - $start), 3); 595 echo "loading in $total_time seconds."; 596 $start= $finish; 597 echo "</th></tr>"; 598 echo "</table></br>"; 595 599 596 600 } … … 634 638 $selectedLabel, $selectedStage, $plotType) { 635 639 640 // timer start 641 $time = microtime(); 642 $time = explode(' ', $time); 643 $time = $time[1] + $time[0]; 644 $start = $time; 645 646 // function begin 636 647 $isUpdate = ($selectedMode == "update"); 637 648 global $headerColor; … … 757 768 758 769 echo "</tr>\n"; 759 echo "</table>\n"; 770 771 // timer finished 772 echo "<tr><th colspan=11>"; 773 $time = microtime(); 774 $time = explode(' ', $time); 775 $time = $time[1] + $time[0]; 776 $finish = $time; 777 $total_time = round(($finish - $start), 3); 778 echo "loading in $total_time seconds."; 779 $start= $finish; 780 echo "</th></tr>"; 781 echo "</table><br>"; 760 782 } 761 783 … … 905 927 function createDatesTable($db, $proj) { 906 928 929 // timer start 930 $time = microtime(); 931 $time = explode(' ', $time); 932 $time = $time[1] + $time[0]; 933 $start = $time; 934 935 // function begin 907 936 global $table; 908 937 echo $table; … … 917 946 createServerDateRow($db, $proj, "registration"); 918 947 919 echo "</table>\n"; 948 // timer finished 949 echo "<tr><th colspan=11>"; 950 $time = microtime(); 951 $time = explode(' ', $time); 952 $time = $time[1] + $time[0]; 953 $finish = $time; 954 $total_time = round(($finish - $start), 3); 955 echo "loading in $total_time seconds."; 956 $start= $finish; 957 echo "</th></tr>"; 958 echo "</table><br>"; 959 920 960 } 921 961 … … 959 999 function createServersTable($pass, $proj, $selectedMode, $db, $servers, $selectedLabel, $selectedStage, $plotType) { 960 1000 1001 // timer start 1002 $time = microtime(); 1003 $time = explode(' ', $time); 1004 $time = $time[1] + $time[0]; 1005 $start = $time; 1006 1007 // function begin 961 1008 // set up table columns 962 1009 global $table; … … 1045 1092 } 1046 1093 1047 echo "</table>\n"; 1094 // timer finished 1095 echo "<tr><th colspan=5>"; 1096 $time = microtime(); 1097 $time = explode(' ', $time); 1098 $time = $time[1] + $time[0]; 1099 $finish = $time; 1100 $total_time = round(($finish - $start), 3); 1101 echo "loading in $total_time seconds."; 1102 $start= $finish; 1103 echo "</th></tr>"; 1104 echo "</table><br>\n"; 1048 1105 } 1049 1106 … … 1087 1144 function getServerStatus($db,$proj, $server, &$alive, &$running) { 1088 1145 1089 $sql = "SELECT alive, running FROM science_servers WHERE server LIKE '$server' AND telescope LIKE '$proj' ORDER BY timestamp DESC LIMIT 1"; 1146 # $sql = "SELECT alive, running FROM science_servers WHERE server LIKE '$server' AND telescope LIKE '$proj' ORDER BY timestamp DESC LIMIT 1"; 1147 $sql = "SELECT alive, running FROM live_servers WHERE server LIKE '$server' AND telescope LIKE '$proj' ORDER BY timestamp DESC LIMIT 1"; 1090 1148 if($debug){echo "$sql<br>";} 1091 1149 … … 1206 1264 ########################################################################### 1207 1265 function showPingStatus($Host, $DatabaseName) { 1266 // timer start 1267 $time = microtime(); 1268 $time = explode(' ', $time); 1269 $time = $time[1] + $time[0]; 1270 $start = $time; 1271 1272 // function begin 1208 1273 exec("ping -c 1 $Host", $res, $rval); 1209 1274 if ($rval == 0){ … … 1212 1277 $PingStatus = "<font style=\"BACKGROUND-COLOR: yellow\" color=\"red\">DOWN</font>"; 1213 1278 } 1214 echo "<tr><td>$DatabaseName</td><td>$PingStatus</td></tr>"; 1215 } 1216 1279 echo "<tr><td>$DatabaseName</td>"; 1280 1281 echo "</td><td>$PingStatus</td>"; 1282 // timer finished 1283 echo "<td>"; 1284 $time = microtime(); 1285 $time = explode(' ', $time); 1286 $time = $time[1] + $time[0]; 1287 $finish = $time; 1288 $total_time = round(($finish - $start), 3); 1289 echo "$total_time seconds"; 1290 $start= $finish; 1291 echo "</td></tr>"; 1292 } 1293 1294 1295 ########################################################################### 1296 # 1297 # Creates a table of summitExp against rawExp 1298 # 1299 ########################################################################### 1300 function createSummitDataTable($projectdb) { 1301 1302 // timer start 1303 $time = microtime(); 1304 $time = explode(' ', $time); 1305 $time = $time[1] + $time[0]; 1306 $start = $time; 1307 1308 // function begin 1309 $date = date("Y-m-d"); 1310 $sql = "SELECT DISTINCT exp_type FROM summitExp WHERE dateobs > '$date'"; 1311 1312 $qry = $projectdb->query($sql); 1313 if (dberror($qry)) { 1314 echo "<b>error reading newExp table</b><br>\n"; 1315 echo "<br><small><b> table query : $sql </b></small><br>\n"; 1316 menu_end(); 1317 } 1318 1319 // set up the table 1320 global $table; 1321 echo $table; 1322 echo "<tr>"; 1323 createTableTitle("Data status > $date", 4); 1324 echo "<tr>"; 1325 createTableColumnHeader("Exposure type"); 1326 createTableColumnHeader("At summit"); 1327 createTableColumnHeader("Registered at MHPCC"); 1328 createTableColumnHeader("Summit (Drop/Null)"); 1329 1330 $msg = "No science images taken since $date"; 1331 1332 // list the results 1333 while ($qry->fetchInto($expType)) { 1334 1335 $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id) 1336 WHERE dateobs > '$date' AND exp_type = '$expType[0]'"; 1337 // AND state != 'drop' AND state is not null AND fault != 1042"; 1338 $qry2 = $projectdb->query($sql); 1339 $qry2->fetchInto($summit); 1340 1341 $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name 1342 WHERE summitExp.dateobs > '$date' AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'"; 1343 $qry2 = $projectdb->query($sql); 1344 $qry2->fetchInto($mhpcc); 1345 1346 $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id) 1347 WHERE dateobs > '$date' AND exp_type = '$expType[0]' AND (state = 'drop' OR state is null)"; 1348 $qry2 = $projectdb->query($sql); 1349 $qry2->fetchInto($dropped); 1350 1351 1352 #Query with 30 minutes delay to check during the night if any exposures are missing. 1353 $datehour = gmdate("Y-m-d H:i:s"); 1354 $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id) 1355 WHERE dateobs > '$date' AND dateobs <= date_sub('$datehour', interval 30 minute) 1356 AND exp_type = '$expType[0]' AND (state != 'drop' OR state is null) and fault != 1042"; 1357 1358 $qry2 = $projectdb->query($sql); 1359 $qry2->fetchInto($summitdelay); 1360 1361 $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name 1362 WHERE summitExp.dateobs > '$date' AND summitExp.dateobs <= date_sub('$datehour', interval 30 minute) 1363 AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'"; 1364 $qry2 = $projectdb->query($sql); 1365 $qry2->fetchInto($mhpccdelay); 1366 1367 echo "<tr>"; 1368 1369 $DLdiff = $summit[0] - $mhpcc[0]; 1370 if ($DLdiff == 0) $error = 0; 1371 else $error = 1; 1372 1373 $delayDLdiff = $summitdelay[0] - $mhpccdelay[0]; 1374 if ($delayDLdiff == 0) $errordelay = 0; 1375 else $errordelay = 1; 1376 1377 echo "<td>$expType[0]</td>"; 1378 echo "<td>$summit[0]</td>"; 1379 if ($delayDLdiff==0) { 1380 createFormattedTableCell("", "", $mhpcc[0], $error, 0); 1381 } else { 1382 $DLStatus = "<font style=\"BACKGROUND-COLOR: yellow\" color=\"red\">$mhpcc[0] ($delayDLdiff)</font>"; 1383 echo "<td>$DLStatus</td>"; 1384 } 1385 1386 echo "<td>$dropped[0]</td>"; 1387 1388 echo "</tr>"; 1389 } 1390 1391 // timer finished 1392 echo "<tr><th colspan=4>"; 1393 $time = microtime(); 1394 $time = explode(' ', $time); 1395 $time = $time[1] + $time[0]; 1396 $finish = $time; 1397 $total_time = round(($finish - $start), 3); 1398 echo "loading in $total_time seconds."; 1399 $start= $finish; 1400 echo "</th></tr>"; 1401 echo "</table><br>"; 1402 } 1403 1404 1405 function createSummitDataTable2($projectdb) { 1406 1407 // timer start 1408 $time = microtime(); 1409 $time = explode(' ', $time); 1410 $time = $time[1] + $time[0]; 1411 $start = $time; 1412 1413 // function begin 1414 $date = date("Y-m-d"); 1415 // set up the table 1416 global $table; 1417 global $columnHeaderColor; 1418 echo $table; 1419 echo "<tr>"; 1420 createTableTitle("Data status > $date", 4); 1421 echo "<tr>"; 1422 createTableColumnHeader("Exp_type at summit"); 1423 createTableColumnHeader("Status at summit"); 1424 createTableColumnHeader("Status at mhpcc"); 1425 createTableColumnHeader("Number"); 1426 $sql = "SELECT summitExp.exp_type,pzDownloadExp.state,rawExp.state,COUNT(*) FROM summitExp 1427 LEFT JOIN pzDownloadExp USING (summit_id) LEFT JOIN rawExp on summitExp.exp_name = rawExp.exp_name 1428 WHERE summitExp.dateobs > '$date' group by summitExp.exp_type,pzDownloadExp.state,rawExp.state"; 1429 $qry = $projectdb->query($sql); 1430 while ($qry->fetchInto($tmp)) { 1431 if ($tmp[1] == NULL) { 1432 echo "<tr><td>$tmp[0]<td> null <td> null <td bgcolor=\"yellow\"> <font color=\"red\">$tmp[3]"; 1433 } 1434 else { 1435 if ($tmp[1] == 'run') { 1436 echo "<tr><td>$tmp[0]<td> loading <td> null <td bgcolor=$columnHeaderColor> <font color=\"red\">$tmp[3]"; 1437 } 1438 else { 1439 if ($tmp[2] == NULL) { 1440 echo "<tr><td>$tmp[0] <td> $tmp[1] <td> loading <td bgcolor=$columnHeaderColor> <font color=\"blue\">$tmp[3]"; 1441 } 1442 else { 1443 echo "<tr><td>$tmp[0]<td> $tmp[1] <td> downloaded <td> $tmp[3]"; 1444 } 1445 } 1446 } 1447 } 1448 1449 // timer finished 1450 echo "<tr><th colspan=4>"; 1451 $time = microtime(); 1452 $time = explode(' ', $time); 1453 $time = $time[1] + $time[0]; 1454 $finish = $time; 1455 $total_time = round(($finish - $start), 3); 1456 echo "loading in $total_time seconds."; 1457 $start= $finish; 1458 echo "</th></tr>"; 1459 echo "</table><br>"; 1460 } 1217 1461 ?> 1218 1462
Note:
See TracChangeset
for help on using the changeset viewer.
