Changeset 41135 for trunk/ippMonitor/raw/czartool_labels.php
- Timestamp:
- Nov 25, 2019, 4:14:49 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/ippMonitor/raw/czartool_labels.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/raw/czartool_labels.php
r41134 r41135 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"); … … 634 626 echo "</tr>"; 635 627 } 628 629 630 // timer finished 631 echo "<tr><th colspan=10>"; 632 $time = microtime(); 633 $time = explode(' ', $time); 634 $time = $time[1] + $time[0]; 635 $finish = $time; 636 $total_time = round(($finish - $start), 3); 637 echo "loading in $total_time seconds."; 638 $start= $finish; 639 echo "</th></tr>"; 636 640 echo "</table></br>"; 637 641 … … 676 680 $selectedLabel, $selectedStage, $plotType) { 677 681 682 // timer start 683 $time = microtime(); 684 $time = explode(' ', $time); 685 $time = $time[1] + $time[0]; 686 $start = $time; 687 688 // function begin 678 689 $isUpdate = ($selectedMode == "update"); 679 690 global $headerColor; … … 799 810 800 811 echo "</tr>\n"; 801 echo "</table>\n"; 812 813 // timer finished 814 echo "<tr><th colspan=11>"; 815 $time = microtime(); 816 $time = explode(' ', $time); 817 $time = $time[1] + $time[0]; 818 $finish = $time; 819 $total_time = round(($finish - $start), 3); 820 echo "loading in $total_time seconds."; 821 $start= $finish; 822 echo "</th></tr>"; 823 echo "</table><br>"; 802 824 } 803 825 … … 947 969 function createDatesTable($db, $proj) { 948 970 971 // timer start 972 $time = microtime(); 973 $time = explode(' ', $time); 974 $time = $time[1] + $time[0]; 975 $start = $time; 976 977 // function begin 949 978 global $table; 950 979 echo $table; … … 959 988 createServerDateRow($db, $proj, "registration"); 960 989 961 echo "</table>\n"; 990 // timer finished 991 echo "<tr><th colspan=11>"; 992 $time = microtime(); 993 $time = explode(' ', $time); 994 $time = $time[1] + $time[0]; 995 $finish = $time; 996 $total_time = round(($finish - $start), 3); 997 echo "loading in $total_time seconds."; 998 $start= $finish; 999 echo "</th></tr>"; 1000 echo "</table><br>"; 1001 962 1002 } 963 1003 … … 1001 1041 function createServersTable($pass, $proj, $selectedMode, $db, $servers, $selectedLabel, $selectedStage, $plotType) { 1002 1042 1043 // timer start 1044 $time = microtime(); 1045 $time = explode(' ', $time); 1046 $time = $time[1] + $time[0]; 1047 $start = $time; 1048 1049 // function begin 1003 1050 // set up table columns 1004 1051 global $table; … … 1087 1134 } 1088 1135 1089 echo "</table>\n"; 1136 // timer finished 1137 echo "<tr><th colspan=5>"; 1138 $time = microtime(); 1139 $time = explode(' ', $time); 1140 $time = $time[1] + $time[0]; 1141 $finish = $time; 1142 $total_time = round(($finish - $start), 3); 1143 echo "loading in $total_time seconds."; 1144 $start= $finish; 1145 echo "</th></tr>"; 1146 echo "</table><br>\n"; 1090 1147 } 1091 1148 … … 1129 1186 function getServerStatus($db,$proj, $server, &$alive, &$running) { 1130 1187 1131 $sql = "SELECT alive, running FROM science_servers WHERE server LIKE '$server' AND telescope LIKE '$proj' ORDER BY timestamp DESC LIMIT 1"; 1188 # $sql = "SELECT alive, running FROM science_servers WHERE server LIKE '$server' AND telescope LIKE '$proj' ORDER BY timestamp DESC LIMIT 1"; 1189 $sql = "SELECT alive, running FROM live_servers WHERE server LIKE '$server' AND telescope LIKE '$proj' ORDER BY timestamp DESC LIMIT 1"; 1132 1190 if($debug){echo "$sql<br>";} 1133 1191 … … 1248 1306 ########################################################################### 1249 1307 function showPingStatus($Host, $DatabaseName) { 1308 // timer start 1309 $time = microtime(); 1310 $time = explode(' ', $time); 1311 $time = $time[1] + $time[0]; 1312 $start = $time; 1313 1314 // function begin 1250 1315 exec("ping -c 1 $Host", $res, $rval); 1251 1316 if ($rval == 0){ … … 1254 1319 $PingStatus = "<font style=\"BACKGROUND-COLOR: yellow\" color=\"red\">DOWN</font>"; 1255 1320 } 1256 echo "<tr><td>$DatabaseName</td><td>$PingStatus</td></tr>"; 1257 } 1258 1321 echo "<tr><td>$DatabaseName</td>"; 1322 1323 echo "</td><td>$PingStatus</td>"; 1324 // timer finished 1325 echo "<td>"; 1326 $time = microtime(); 1327 $time = explode(' ', $time); 1328 $time = $time[1] + $time[0]; 1329 $finish = $time; 1330 $total_time = round(($finish - $start), 3); 1331 echo "$total_time seconds"; 1332 $start= $finish; 1333 echo "</td></tr>"; 1334 } 1335 1336 1337 ########################################################################### 1338 # 1339 # Creates a table of summitExp against rawExp 1340 # 1341 ########################################################################### 1342 function createSummitDataTable($projectdb) { 1343 1344 // timer start 1345 $time = microtime(); 1346 $time = explode(' ', $time); 1347 $time = $time[1] + $time[0]; 1348 $start = $time; 1349 1350 // function begin 1351 $date = date("Y-m-d"); 1352 $sql = "SELECT DISTINCT exp_type FROM summitExp WHERE dateobs > '$date'"; 1353 1354 $qry = $projectdb->query($sql); 1355 if (dberror($qry)) { 1356 echo "<b>error reading newExp table</b><br>\n"; 1357 echo "<br><small><b> table query : $sql </b></small><br>\n"; 1358 menu_end(); 1359 } 1360 1361 // set up the table 1362 global $table; 1363 echo $table; 1364 echo "<tr>"; 1365 createTableTitle("Data status > $date", 4); 1366 echo "<tr>"; 1367 createTableColumnHeader("Exposure type"); 1368 createTableColumnHeader("At summit"); 1369 createTableColumnHeader("Registered at MHPCC"); 1370 createTableColumnHeader("Summit (Drop/Null)"); 1371 1372 $msg = "No science images taken since $date"; 1373 1374 // list the results 1375 while ($qry->fetchInto($expType)) { 1376 1377 $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id) 1378 WHERE dateobs > '$date' AND exp_type = '$expType[0]'"; 1379 // AND state != 'drop' AND state is not null AND fault != 1042"; 1380 $qry2 = $projectdb->query($sql); 1381 $qry2->fetchInto($summit); 1382 1383 $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name 1384 WHERE summitExp.dateobs > '$date' AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'"; 1385 $qry2 = $projectdb->query($sql); 1386 $qry2->fetchInto($mhpcc); 1387 1388 $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id) 1389 WHERE dateobs > '$date' AND exp_type = '$expType[0]' AND (state = 'drop' OR state is null)"; 1390 $qry2 = $projectdb->query($sql); 1391 $qry2->fetchInto($dropped); 1392 1393 1394 #Query with 30 minutes delay to check during the night if any exposures are missing. 1395 $datehour = gmdate("Y-m-d H:i:s"); 1396 $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id) 1397 WHERE dateobs > '$date' AND dateobs <= date_sub('$datehour', interval 30 minute) 1398 AND exp_type = '$expType[0]' AND (state != 'drop' OR state is null) and fault != 1042"; 1399 1400 $qry2 = $projectdb->query($sql); 1401 $qry2->fetchInto($summitdelay); 1402 1403 $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name 1404 WHERE summitExp.dateobs > '$date' AND summitExp.dateobs <= date_sub('$datehour', interval 30 minute) 1405 AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'"; 1406 $qry2 = $projectdb->query($sql); 1407 $qry2->fetchInto($mhpccdelay); 1408 1409 echo "<tr>"; 1410 1411 $DLdiff = $summit[0] - $mhpcc[0]; 1412 if ($DLdiff == 0) $error = 0; 1413 else $error = 1; 1414 1415 $delayDLdiff = $summitdelay[0] - $mhpccdelay[0]; 1416 if ($delayDLdiff == 0) $errordelay = 0; 1417 else $errordelay = 1; 1418 1419 echo "<td>$expType[0]</td>"; 1420 echo "<td>$summit[0]</td>"; 1421 if ($delayDLdiff==0) { 1422 createFormattedTableCell("", "", $mhpcc[0], $error, 0); 1423 } else { 1424 $DLStatus = "<font style=\"BACKGROUND-COLOR: yellow\" color=\"red\">$mhpcc[0] ($delayDLdiff)</font>"; 1425 echo "<td>$DLStatus</td>"; 1426 } 1427 1428 echo "<td>$dropped[0]</td>"; 1429 1430 echo "</tr>"; 1431 } 1432 1433 // timer finished 1434 echo "<tr><th colspan=4>"; 1435 $time = microtime(); 1436 $time = explode(' ', $time); 1437 $time = $time[1] + $time[0]; 1438 $finish = $time; 1439 $total_time = round(($finish - $start), 3); 1440 echo "loading in $total_time seconds."; 1441 $start= $finish; 1442 echo "</th></tr>"; 1443 echo "</table><br>"; 1444 } 1445 1446 1447 function createSummitDataTable2($projectdb) { 1448 1449 // timer start 1450 $time = microtime(); 1451 $time = explode(' ', $time); 1452 $time = $time[1] + $time[0]; 1453 $start = $time; 1454 1455 // function begin 1456 $date = date("Y-m-d"); 1457 // set up the table 1458 global $table; 1459 global $columnHeaderColor; 1460 echo $table; 1461 echo "<tr>"; 1462 createTableTitle("Data status > $date", 4); 1463 echo "<tr>"; 1464 createTableColumnHeader("Exp_type at summit"); 1465 createTableColumnHeader("Status at summit"); 1466 createTableColumnHeader("Status at mhpcc"); 1467 createTableColumnHeader("Number"); 1468 $sql = "SELECT summitExp.exp_type,pzDownloadExp.state,rawExp.state,COUNT(*) FROM summitExp 1469 LEFT JOIN pzDownloadExp USING (summit_id) LEFT JOIN rawExp on summitExp.exp_name = rawExp.exp_name 1470 WHERE summitExp.dateobs > '$date' group by summitExp.exp_type,pzDownloadExp.state,rawExp.state"; 1471 $qry = $projectdb->query($sql); 1472 while ($qry->fetchInto($tmp)) { 1473 if ($tmp[1] == NULL) { 1474 echo "<tr><td>$tmp[0]<td> null <td> null <td bgcolor=\"yellow\"> <font color=\"red\">$tmp[3]"; 1475 } 1476 else { 1477 if ($tmp[1] == 'run') { 1478 echo "<tr><td>$tmp[0]<td> loading <td> null <td bgcolor=$columnHeaderColor> <font color=\"red\">$tmp[3]"; 1479 } 1480 else { 1481 if ($tmp[2] == NULL) { 1482 echo "<tr><td>$tmp[0] <td> $tmp[1] <td> loading <td bgcolor=$columnHeaderColor> <font color=\"blue\">$tmp[3]"; 1483 } 1484 else { 1485 echo "<tr><td>$tmp[0]<td> $tmp[1] <td> downloaded <td> $tmp[3]"; 1486 } 1487 } 1488 } 1489 } 1490 1491 // timer finished 1492 echo "<tr><th colspan=4>"; 1493 $time = microtime(); 1494 $time = explode(' ', $time); 1495 $time = $time[1] + $time[0]; 1496 $finish = $time; 1497 $total_time = round(($finish - $start), 3); 1498 echo "loading in $total_time seconds."; 1499 $start= $finish; 1500 echo "</th></tr>"; 1501 echo "</table><br>"; 1502 } 1259 1503 ?> 1260 1504
Note:
See TracChangeset
for help on using the changeset viewer.
