IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41677


Ignore:
Timestamp:
Jul 1, 2021, 5:22:46 PM (5 years ago)
Author:
fairlamb
Message:

bringing ippmonitor pages up-to-date with the live version

Location:
trunk/ippMonitor/raw
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippMonitor/raw/czartool_labels.php

    r41458 r41677  
    1919$LD_LIBRARY_PATH = getenv("LD_LIBRARY_PATH");
    2020putenv("LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH");
    21 
    2221
    2322if ($ID['menu']) {$myMenu = $ID['menu'];}
     
    3837        "pub",
    3938        );
    40         # "chipbackground");
    4139
    4240$getFailures = array(
     
    8684if ($proj == 'gpc1') {
    8785    $servers=array(
    88         #"addstar",
    89         #"addstarlap",
    90         "ippqub:stdscience_ws",
    9186        "cleanup",
    92         #"detrend",
    9387        "distribution",
     88        "ippqub:stdscience_ws",
    9489        "pstamp",
    95         # "update",
    96         # "publishing",
    9790        "registration",
    9891        "stack",
    99         # "deepstack",
    10092        "stdscience",
    10193        "summitcopy");
    10294} else {
    10395    $servers=array(
    104         "ippqub2:stdscience_ws",
    10596        "cleanup",
    10697        "distribution",
     98        "ippqub2:stdscience_ws",
    10799        "registration",
    108100        "stdscience",
     
    110102}
    111103
    112 
    113 // The Update mode of czartool is obsolete since we don't use the update
    114 // pantasks.
     104// The Update mode of czartool is obsolete since we don't use the update pantasks.
    115105// $selectedMode = $_GET[mode];
    116106$selectedMode = "stdscience";
     
    141131// tell all servers to stop or run
    142132if ($allServerCmd) {
    143 
    144133    foreach ($servers as &$server) serverStopRun($czardb, $server,  $allServerCmd);
    145134}
     
    147136
    148137$debug = 0;
    149 $table = "<table bgcolor=\"#FFFFFF\" width=\"900\" align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n";
     138$table = "<table bgcolor=\"#FFFFFF\" width=\"100%\" align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n";
    150139
    151140// $labels is generated with sequential integer key values
     
    187176// set up the form
    188177echo "<form action=\"czartool_labels.php\" method=\"POST\">\n";
    189 
    190178echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">\n";
    191179echo "<input type=\"hidden\" name=\"proj\" value=\"$proj\">\n";
     
    194182
    195183echo "<table border=\"0\">";
    196 
     184// timer begin for main page
     185$time = microtime();
     186$time = explode(' ', $time);
     187$time = $time[1] + $time[0];
     188$mainstart = $time;
     189
     190# headers
    197191echo "<tr>";
    198 echo "<td colspan=\"3\" style=\"background-color:#0080c0;\">";
    199 echo "<h1 align=\"middle\">Czartool</h1>";
    200 echo "<h2 align=\"middle\">$modeText (change to <a href=\"$link&proj=$newproj\"><font color=\"blue\">$newproj</font></a>)</h2>";
    201 echo "</td>";
     192echo "  <td colspan=\"3\" style=\"background-color:#0080c0;\">";
     193echo "  <h1 align=\"middle\">Czartool</h1>";
     194echo "  <h2 align=\"middle\">$modeText (change to <a href=\"$link&proj=$newproj\"><font color=\"blue\">$newproj</font></a>)</h2>";
     195echo "  </td>";
    202196echo "</tr>";
    203197
    204 // PLOTS
     198# table rows
    205199echo "<tr valign=\"top\">";
    206 echo "<td style=width:100px;text-align:top;\">";
    207  # time series plot
    208 echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br>";
    209 # log time series plot
    210 echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=log\"><br>";
    211  # rate time series plot
    212 echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=rt&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br>";
    213  # histogram plot
    214 # echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=h&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br>";
    215  # storage plot
    216 echo "<br><a href=\"czartool_getplot.php?type=sl\"><img title=\"Click to enlarge me\" src=\"czartool_getplot.php?type=s\"></a><br>";
    217  # storage timeseries
    218 echo "<br><img src=\"czartool_getplot.php?type=st\"><br>";
    219  # pantasks server status, if requested
     200
     201#1st table column for status
     202echo "<td style=height:200px;width:800px;text-align:top;\">";
     203
     204// status table at top
     205exec("svnversion /data/ippc64.1/ippitc/ippMonitor", $svnversion);
     206$phpversion = phpversion();
     207$ganglia = "http://ganglia.pan-starrs.ifa.hawaii.edu";
     208$svnlink = "https://svn.pan-starrs.ifa.hawaii.edu/trac/ipp";
     209$conflink = "https://confluence.ipp.ifa.hawaii.edu";
     210$jiralink = "https://jira.ipp.ifa.hawaii.edu";
     211$hsttime1 = date("Y-m-d H:i:s", strtotime("$lastUpdateTime"));
     212$utctime1 = gmdate("Y-m-d H:i:s", strtotime("$lastUpdateTime"));
     213
    220214echo "<br>";
    221  if ($selectedServer && !$serverCmd) showServerStatus($selectedServer);
    222 echo "</td>";
    223 
    224 
    225 echo "<td style=height:200px;width:10px;text-align:top;\">";
    226 echo "<td style=height:200px;width:400px;text-align:top;\">";
    227 
    228 /////////////////////////////////////////
    229 // timer begin for status and links
    230 /////////////////////////////////////////
     215echo $table;
     216createTableTitle("Status and links", 2);
     217echo "<tr><td>ippMonitor Notes </td>
     218          <td> PHP: v.$phpversion
     219  &nbsp|&nbsp <a href=\"$svnlink/browser/trunk/ippMonitor\" target=new><font color=\"blue\">SVN: v.$svnversion[0]</font></a>
     220  &nbsp|&nbsp <a href=\"$jiralink/browse/IPP-86\" target=new><font color=\"blue\">Jira</font></a>
     221  &nbsp|&nbsp <a href=\"http://ippmonitor.ipp.ifa.hawaii.edu/ippMonitor/czartool_labels.php?pass=$pass&proj=$proj\"><font color=\"blue\">online</font></a>,
     222       &nbsp <a href=\"http://ipp117.ipp.ifa.hawaii.edu/ippMonitor/czartool_labels.php?pass=$pass&proj=$proj\"><font color=\"blue\">dev</font></a>,
     223       &nbsp <a href=\"czartool_labels_last.php?pass=$pass&proj=$proj\"><font color=\"blue\">last</font></a>
     224       version </td></tr>";
     225echo "<tr><td>Pan-STARRS Data Store</td>
     226          <td><a href=\"https://svn.ifa.hawaii.edu/\" target=new><font color=\"blue\">Home</font></a>
     227  &nbsp|&nbsp <a href=\"https://svn.ifa.hawaii.edu/summit/ds/gpc1/\" target=new><font color=\"blue\">GPC1</font></a>
     228  &nbsp|&nbsp <a href=\"https://svn.ifa.hawaii.edu/conductorb/ds/gpc2/\" target=new><font color=\"blue\">GPC2</font></a>
     229  &nbsp|&nbsp <a href=\"http://ipp.ifa.hawaii.edu/skycoverage.20201110\" target=new><font color=\"blue\">Sky Coverage</font></a></td></tr>";
     230echo "<tr><td>Observations Metrics</td>
     231          <td><a href=\"https://ps1wiki.ifa.hawaii.edu/data/metrics/index.html\" target=new><font color = \"blue\"> PS1</font></a>
     232  &nbsp|&nbsp <a href=\"https://ps1wiki.ifa.hawaii.edu/data/ps2metrics/index.html\"  target=new><font color = \"blue\"> PS2</font></a>
     233  &nbsp|&nbsp <a href=\"http://ippmonitor.ipp.ifa.hawaii.edu/ippMonitor/ippMetrics/index.html\" target=new><font color=\"blue\">IPP</font></a></td></tr>";
     234echo "<tr><td>Postage Stamp Server</td>
     235          <td><a href=\"http://pstamp.ipp.ifa.hawaii.edu/pshome.php\" target=new><font color=\"blue\">Home</font></a>
     236  &nbsp|&nbsp <a href=\"http://pstamp.ipp.ifa.hawaii.edu/status.php\" target=new><font color=\"blue\">Status</font></a>
     237  &nbsp|&nbsp <a href=\"http://pstamp.ipp.ifa.hawaii.edu/dsroot.php\" target=new><font color=\"blue\">Data Store</font></a></td></tr>";
     238echo "<tr><td>IPP Cluster Ganglia Monitor</td>
     239          <td><a href=\"$ganglia/?r=hour&s=descending&hc=6&c=IPP%2520Production\" target=new> <font color=\"blue\">Load_reports</font></a>
     240  &nbsp|&nbsp <a href=\"$ganglia/?m=cpu_report&r=hour&s=by%2520name&c=IPP+Production&h=&sh=1&hc=8&z=small\" target=new> <font color=\"blue\">CPU_reports</font></a>
     241  &nbsp|&nbsp <a href=\"$ganglia/?m=mem_report&r=hour&s=by%2520name&c=IPP+Production&h=&sh=1&hc=8&z=small\" target=new> <font color=\"blue\">Memory_reports</font></a></td></tr>";
     242echo "<tr><td>Documentations for IPP</td>
     243          <td><a href=\"$conflink/pages/viewrecentblogposts.action?key=IPPCZAR\" target=new><font color=\"blue\">Czarblog</font></a>
     244  &nbsp|&nbsp <a href=\"$conflink/display/IPPCZAR/IPP-Czaring+Home\" target=new><font color=\"blue\">Confluence</font></a>
     245  &nbsp|&nbsp <a href=\"$jiralink/projects/IPP/issues/filter=allissues\" target=new><font color=\"blue\">Jira</font></a>
     246  &nbsp|&nbsp <a href=\"$svnlink/\" target=new><font color=\"blue\">trac</font></a></td></tr>";
     247echo "<tr><td>Current nightly science status</td>
     248          <td>".getNightlyScienceStatus($czardb, $proj)."</td></tr>";
     249echo "<tr><td>Czardb last update time</td>
     250          <td> $hsttime1 (HST), $utctime1 (UTC)</td></tr>";
     251echo "</table><br>";
     252
     253
     254createLabelsTable($pass, $proj, $czardb, $selectedMode, $labels, $distLabelsExist, $pubLabelsExist, $stages, "new", $selectedLabel, $selectedStage, $plotType);
     255if ($selectedMode == "update") {echo "<br>"; createPStampDataTable();}
     256
     257# XXX EAM : 2017.09.17 : debugging slowness
     258# CCL : 2019.11.09 : debugging slowness
     259//createSummitDataTable($projectdb); // this is slow because of the join between summitExp and rawExp, but not the major one
     260createSummitDataTable2($projectdb, $pass, $proj); // this is slow because of the join between summitExp and rawExp, but not the major one
     261
     262createChunkDataTable($projectdb);  // this is another part for slowness during nightly processing
     263
     264createDatesTable($czardb, $proj);
     265
     266// Database status
     267// timer begin for Database status
    231268$time = microtime();
    232269$time = explode(' ', $time);
     
    234271$start = $time;
    235272
    236 // status table at top
    237 $nsStatus = getNightlyScienceStatus($czardb, $proj);
    238 $plotTypeLink = ($plotType == "linear") ? "log" : "linear";
    239 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel .
    240         "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink";
    241 
    242 echo "<br>";
    243273echo $table;
    244 createTableTitle("Status and links", 2);
    245 echo "<tr>\n";
    246 echo "<tr><td>Time of last update</td>
    247           <td>$lastUpdateTime</td></tr>";
    248 echo "<tr><td>ippMonitor SVN version</td>
    249           <td>"; include 'version.php'; echo "</td></tr>";
    250 echo "<tr><td>Current PHP version: </td>
    251           <td>" . phpversion(); echo "</td></tr>";
    252 echo "<tr><td>Current nightly science status</td>
    253           <td>$nsStatus</td></tr>";
    254 echo "<tr><td>Postage stamp server status</td>
    255           <td><a href=\"http://pstamp.ipp.ifa.hawaii.edu/status.php\" target=new><font color=\"blue\">here</font></a></td></tr>";
    256 echo "<tr><td>Documentation</td>
    257           <td><a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing\" target=new><font color=\"blue\">here</font></a></td></tr>";
    258 echo "<tr><td>Cluster load</td>
    259           <td><a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&hc=6&c=IPP%2520Production\">
    260               <font color=\"blue\">here</font></a>
    261               <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\">
    262               <font color=\"blue\">cpu_report</font></a>
    263               <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\">
    264               <font color=\"blue\">mem_report</font></a></td></tr>";
    265 echo "<tr><td>IPP metrics</td>
    266           <td><a href=\"https://ps1wiki.ifa.hawaii.edu/data/metrics/index.html\"><font color=\"blue\" target=new>here</font></a></td></tr>";
    267 echo "<tr><td>Czar log pages</td>
    268           <td><a href=\"https://confluence.ipp.ifa.hawaii.edu/pages/viewrecentblogposts.action?key=IPPCZAR\" target=new><font color=\"blue\">here</font></a></td></tr>";
    269 echo "<tr><td>Exposure summary</td>
    270           <td><a href=\"czartool_exposures.php?pass=$pass&proj=$proj\"><font color=\"blue\">here</font></a></td></tr>";
    271 echo "<tr><td>Confluence</td>
    272           <td><a href=\"https://confluence.ipp.ifa.hawaii.edu/display/IPPCZAR/IPP-Czaring+Home\" target=new><font color=\"blue\">here</font></a></td></tr>";
    273 echo "<tr><td>JIRA</td>
    274           <td><a href=\"https://jira.ipp.ifa.hawaii.edu/secure/Dashboard.jspa\" target=new><font color=\"blue\">here</font></a></td></tr>";
    275 echo "<tr><td>data store</td>
    276           <td><a href=\"https://svn.ifa.hawaii.edu/\" target=new><font color=\"blue\">here</font></a></td></tr>";
    277 echo "<tr><td>Pan-STARRS data overview plots</td>
    278           <td><a href=\"http://ipp.ifa.hawaii.edu/skycoverage.20201110\" target=new><font color=\"blue\">here</font></a></td></tr>";
    279 
    280 $plotTypeLink = ($plotType == "linear") ? "log" : "linear";
    281 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&mode=" . $selectedMode .
    282         "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink";
    283 
    284 // timer finished
    285 echo "<tr><th colspan=4>";
    286 $time = microtime();
    287 $time = explode(' ', $time);
    288 $time = $time[1] + $time[0];
    289 $finish = $time;
    290 $total_time = round(($finish - $start), 3);
    291 echo "loading in $total_time seconds.";
    292 echo "</th></tr>";
    293 echo "</table><br>";
    294 
    295 createLabelsTable($pass, $proj, $czardb, $selectedMode, $labels,
    296   $distLabelsExist, $pubLabelsExist, $stages, "new", $selectedLabel,
    297   $selectedStage, $plotType);
    298 if ($selectedMode == "update") {echo "<br>"; createPStampDataTable();}
    299 
    300 # XXX EAM : 2017.09.17 : debugging slowness
    301 # CCL : 2019.11.09 : debugging slowness
    302 //createSummitDataTable($projectdb); // this is slow because of the join between summitExp and rawExp, but not the major one
    303 createSummitDataTable2($projectdb); // this is slow because of the join between summitExp and rawExp, but not the major one
    304 
    305 createServersTable($pass, $proj,$selectedMode,$czardb, $servers, $selectedLabel, $selectedStage, $plotType);
    306 // this was the major slowness part due to large table in czardb
    307 
    308 createChunkDataTable($projectdb);  // this is another part for slowness during nightly processing
    309 
    310 createDatesTable($czardb, $proj);
    311 
    312 /////////////////////////////////////////
    313 // timer begin for Database status
    314 /////////////////////////////////////////
    315 $time = microtime();
    316 $time = explode(' ', $time);
    317 $time = $time[1] + $time[0];
    318 $start = $time;
    319 
    320 // status table at top
    321   echo $table;
    322   echo "<tr>";
    323   createTableTitle("Database status (update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\">here</a>)", 2);
     274echo "<tr>";
     275createTableTitle("Database status (update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\"><font color=\"blue\">here</a>)", 2);
    324276 
    325   echo "<tr>";
    326   createTableColumnHeader("Database");
    327   createTableColumnHeader("Status (sec behind master)");
    328   showDatabaseStatus($HOST_GPC1, $USER_GPC1, $PASSWORD_GPC1, $DBNAME_GPC1);
    329   showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_DBNAME_GPC1);
    330   showReplicationsStatus($REPL_HOST_GPC1_SECONDARY, $REPL_USER_GPC1_SECONDARY, $REPL_PASSWORD_GPC1_SECONDARY, $REPL_DBNAME_GPC1_SECONDARY);
    331  
    332   echo "<tr>";
    333   showDatabaseStatus($HOST_NEBULOUS, $USER_NEBULOUS, $PASSWORD_NEBULOUS, $DBNAME_NEBULOUS);
    334   showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_DBNAME_NEBULOUS);
    335   showReplicationsStatus($REPL_HOST_NEBULOUS_SECONDARY, $REPL_USER_NEBULOUS_SECONDARY, $REPL_PASSWORD_NEBULOUS_SECONDARY, $REPL_DBNAME_NEBULOUS_SECONDARY);
    336   showReplicationsStatus($REPL_HOST_NEBULOUS_THIRD, $REPL_USER_NEBULOUS_THIRD, $REPL_PASSWORD_NEBULOUS_THIRD, $REPL_DBNAME_NEBULOUS_THIRD);
    337   showReplicationsStatus($REPL_HOST_NEBULOUS_FOURTH, $REPL_USER_NEBULOUS_FOURTH, $REPL_PASSWORD_NEBULOUS_FOURTH, $REPL_DBNAME_NEBULOUS_FOURTH);
    338   showReplicationsStatus($REPL_HOST_DATASTORE_SECONDARY, $REPL_USER_DATASTORE_SECONDARY, $REPL_PASSWORD_DATASTORE_SECONDARY, $REPL_DBNAME_DATASTORE_SECONDARY);
    339  
    340 //  some mysql replication slaves to add when they are returned to service
    341 //  showReplicationsStatus($REPL_HOST_PSTAMP, $REPL_USER_PSTAMP, $REPL_PASSWORD_PSTAMP, $REPL_DBNAME_PSTAMP);
    342 //  showReplicationsStatus($REPL_HOST_ISP, $REPL_USER_ISP, $REPL_PASSWORD_ISP, $REPL_DBNAME_ISP);
     277echo "<tr>";
     278createTableColumnHeader("Database");
     279createTableColumnHeader("Status (sec behind master)");
     280showDatabaseStatus($HOST_GPC1, $USER_GPC1, $PASSWORD_GPC1, $DBNAME_GPC1);
     281showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_DBNAME_GPC1);
     282showReplicationsStatus($REPL_HOST_GPC1_SECONDARY, $REPL_USER_GPC1_SECONDARY, $REPL_PASSWORD_GPC1_SECONDARY, $REPL_DBNAME_GPC1_SECONDARY);
     283showReplicationsStatus($REPL_HOST_GPC1_THIRD, $REPL_USER_GPC1_THIRD, $REPL_PASSWORD_GPC1_THIRD, $REPL_DBNAME_GPC1_THIRD);
     284showDatabaseStatus($HOST_NEBULOUS, $USER_NEBULOUS, $PASSWORD_NEBULOUS, $DBNAME_NEBULOUS);
     285showReplicationsStatus($REPL_HOST_NEBULOUS_SECONDARY, $REPL_USER_NEBULOUS_SECONDARY, $REPL_PASSWORD_NEBULOUS_SECONDARY, $REPL_DBNAME_NEBULOUS_SECONDARY);
     286showReplicationsStatus($REPL_HOST_NEBULOUS_THIRD, $REPL_USER_NEBULOUS_THIRD, $REPL_PASSWORD_NEBULOUS_THIRD, $REPL_DBNAME_NEBULOUS_THIRD);
     287showReplicationsStatus($REPL_HOST_NEBULOUS_FOURTH, $REPL_USER_NEBULOUS_FOURTH, $REPL_PASSWORD_NEBULOUS_FOURTH, $REPL_DBNAME_NEBULOUS_FOURTH);
     288showReplicationsStatus($REPL_HOST_DATASTORE_SECONDARY, $REPL_USER_DATASTORE_SECONDARY, $REPL_PASSWORD_DATASTORE_SECONDARY, $REPL_DBNAME_DATASTORE_SECONDARY);
    343289
    344290// timer finished
     
    353299echo "</table><br>";
    354300
    355 /////////////////////////////////////////
     301
     302// critical machines status
    356303// timer begin for critical machines
    357 /////////////////////////////////////////
    358304$time = microtime();
    359305$time = explode(' ', $time);
     
    361307$start = $time;
    362308
    363 // status table at top
    364   $PingStatus = "<font style=\"BACKGROUND-COLOR: yellow\"  color=\"red\">DOWN</font>";
    365   echo $table;
    366   echo "<tr>";
    367   createTableTitle("Critical machine status", 3);
    368 
    369   echo "<tr>";
    370   createTableColumnHeader("Hostname");
    371   createTableColumnHeader("Status");
    372   createTableColumnHeader("Loading time");
    373   showPingStatus($HOST_GATEWAY, $DBNAME_GATEWAY);
    374   showPingStatus($HOST_GATEWAY_SECONDARY, $DBNAME_GATEWAY_SECONDARY);
    375   showPingStatus($HOST_APACHE1, $DBNAME_APACHE1);
    376   showPingStatus($HOST_APACHE2, $DBNAME_APACHE2);
    377   showPingStatus($HOST_APACHE3, $DBNAME_APACHE3);
    378   showPingStatus($HOST_APACHE4, $DBNAME_APACHE4);
    379   showPingStatus($HOST_APACHE5, $DBNAME_APACHE5);
    380   showPingStatus($HOST_APACHE6, $DBNAME_APACHE6);
    381   showPingStatus($HOST_APACHE7, $DBNAME_APACHE7);
    382   showPingStatus($HOST_APACHE8, $DBNAME_APACHE8);
    383 //     echo "<td>ippc70 (apache node) <td> $PingStatus <td> 0 seconds ";  // comment out if ippc70 is back
    384   showPingStatus($HOST_PROXY, $DBNAME_PROXY);
    385   showPingStatus($HOST_SVN, $DBNAME_SVN);
    386   showPingStatus($HOST_CONFLUENCE, $DBNAME_CONFLUENCE);
    387 
     309$PingStatus = "<font style=\"BACKGROUND-COLOR: yellow\"  color=\"red\">DOWN</font>";
     310echo $table;
     311echo "<tr>";
     312createTableTitle("Critical machine status", 3);
     313
     314echo "<tr>";
     315createTableColumnHeader("Hostname");
     316createTableColumnHeader("Status");
     317createTableColumnHeader("Loading time");
     318showPingStatus($HOST_GATEWAY, $DBNAME_GATEWAY);
     319showPingStatus($HOST_GATEWAY_SECONDARY, $DBNAME_GATEWAY_SECONDARY);
     320showPingStatus($HOST_NAGIOS, $DBNAME_NAGIOS);
     321showPingStatus($HOST_HOME, $DBNAME_HOME);
     322showPingStatus($HOST_APACHE1, $DBNAME_APACHE1);
     323showPingStatus($HOST_APACHE2, $DBNAME_APACHE2);
     324showPingStatus($HOST_APACHE3, $DBNAME_APACHE3);
     325showPingStatus($HOST_APACHE4, $DBNAME_APACHE4);
     326showPingStatus($HOST_APACHE5, $DBNAME_APACHE5);
     327showPingStatus($HOST_APACHE6, $DBNAME_APACHE6);
     328showPingStatus($HOST_APACHE7, $DBNAME_APACHE7);
     329showPingStatus($HOST_APACHE8, $DBNAME_APACHE8);
     330showPingStatus($HOST_PROXY, $DBNAME_PROXY);
     331showPingStatus($HOST_SVN, $DBNAME_SVN);
     332showPingStatus($HOST_CONFLUENCE, $DBNAME_CONFLUENCE);
     333//  echo "<td>ippc70 (apache node) <td> $PingStatus <td> 0 seconds ";  // comment out if ippc70 is back
    388334// timer finished
    389335echo "<tr><th colspan=3>";
     
    396342echo "</th></tr>";
    397343echo "</table><br>";
    398    
     344
     345createServersTable($pass, $proj,$selectedMode,$czardb, $servers, $selectedLabel, $selectedStage, $plotType); // this was the major slowness part due to large table in czardb
     346
     347# pantasks server status, if requested
     348if ($selectedServer && !$serverCmd) showServerStatus($selectedServer, $proj);
     349
     350#2nd table column for space
     351echo "<td style=height:200px;width: 10px;text-align:top;\"><br>";
     352
     353#3rd table column for plots
     354echo "<td style=height:200px;width:600px;text-align:top;\"><br>";
     355# plots
     356if ($selectedStage == "all_stages" & $selectedLabel == "all") {
     357   # with all stages and all labels, the rate query is too slow so I use the old method until it get improved. CCL 20210117
     358   # gnuplots
     359   # time series plot
     360   echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br><br>";
     361   echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=log\"><br><br>";
     362   # rate series plot
     363   echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=rt&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br><br>";
     364} else {
     365   # google chart
     366   # time series plot
     367   echo Gettimeseries($czardb, $selectedMode, $selectedLabel, $proj, $selectedStage);
     368   # rate series plot
     369   echo Getrate($czardb, $selectedMode, $selectedLabel, $proj, $selectedStage);
     370}
     371
     372# storage timeseries
     373echo getSpaces($czardb);
     374# storage plot
     375echo getHosts($czardb);
     376
     377# timer for main page end
     378echo "<tr><th colspan=3>";
     379$time = microtime();
     380$time = explode(' ', $time);
     381$time = $time[1] + $time[0];
     382$finish = $time;
     383$total_time = round(($finish - $mainstart), 3);
     384echo "overall loading in $total_time seconds.";
     385echo "</th></tr>";
     386echo "</table>";
    399387
    400388menu_end();
    401389
    402390
    403 #############################################################################
    404 #############################  Functions Below  #############################
    405 #############################################################################
     391/////////////////////////////////////////////////////////////////////////////
     392//                                                                         //
     393//                               Functions                                 //
     394//                                                                         //
     395/////////////////////////////////////////////////////////////////////////////
    406396
    407397###########################################################################
     
    436426    // list the results
    437427    while ($qry->fetchInto($row)) {
    438 
    439428        echo "<tr>";
    440 
    441429        echo "<td>$row[0]</td>";
    442430        echo "<td>$row[1]</td>";
    443431        echo "<td>$row[2]</td>";
    444        
    445432        echo "</tr>";
    446433    }
    447 
    448434    echo "</table>\n";
    449 
    450435}
    451436
     
    480465    #do a query of raw/chip/cam/warp counts for this night, split by chunk.
    481466    #we need to do a subquery to find the total number of skycells in warpSkyfile, as well as the number of those with a bad quality
    482     $query = "SELECT suba.chunk,suba.Nvis1,suba.Nvis2,suba.Nvis3,suba.Nvis4,suba.Ncamgood,suba.Ncambad,subb.Nwarpgood,subb.Nwarpbad,suba.uniNvis1,suba.uniNvis2,suba.uniNvis3,suba.uniNvis4 FROM ";
     467    $query = "SELECT suba.chunk,suba.Nvis1,suba.Nvis2,suba.Nvis3,suba.Nvis4,suba.Ncamgood,suba.Ncambad,subb.Nwarpgood,subb.Nwarpbad FROM ";
    483468    $query .= "    (SELECT substr(comment, 1, position(' ' in comment)) AS chunk,count(if(rawExp.comment LIKE '%visit 1%',1,NULL)) AS Nvis1,";
    484469    $query .= "    count(if(rawExp.comment LIKE '%visit 2%',1,NULL)) AS Nvis2,count(if(rawExp.comment LIKE '%visit 3%',1,NULL)) AS Nvis3,";
    485470    $query .= "    count(if(rawExp.comment LIKE '%visit 4%',1,NULL)) AS Nvis4, count(if(camProcessedExp.sigma_ra <= 5 AND camProcessedExp.sigma_dec <= 5 AND camProcessedExp.quality = 0,1,NULL)) AS Ncamgood,";
    486     $query .= "    count(if(camProcessedExp.sigma_ra > 5 OR camProcessedExp.sigma_dec > 5 OR camProcessedExp.quality > 0,1,NULL)) AS Ncambad, COUNT(DISTINCT CASE WHEN rawExp.comment LIKE '%visit 1%' THEN rawExp.comment END) AS uniNvis1,";
    487     $query .= "    COUNT(DISTINCT CASE WHEN rawExp.comment LIKE '%visit 2%' THEN rawExp.comment END) AS uniNvis2,COUNT(DISTINCT CASE WHEN rawExp.comment LIKE '%visit 3%' THEN rawExp.comment END) AS uniNvis3,";
    488     $query .= "    COUNT(DISTINCT CASE WHEN rawExp.comment LIKE '%visit 4%' THEN rawExp.comment END) AS uniNvis4";
     471    $query .= "    count(if(camProcessedExp.sigma_ra > 5 OR camProcessedExp.sigma_dec > 5 OR camProcessedExp.quality > 0,1,NULL)) AS Ncambad";
    489472    $query .= "    FROM rawExp LEFT JOIN chipRun USING (exp_id) LEFT JOIN camRun USING (chip_id) JOIN camProcessedExp USING (cam_id) LEFT JOIN fakeRun USING (cam_id) LEFT JOIN warpRun USING (fake_id)";
    490473    $query .= "    WHERE dateobs like '$date%' AND exp_id > $refExpID[0] AND exp_type = 'OBJECT' AND rawExp.comment like '%visit%'";
     
    540523        $NexpWWdiff = 0;
    541524        $Npubwarps = 0;
    542         $uniNvis1 = 0;
    543         $uniNvis2 = 0;
    544         $uniNvis3 = 0;
    545         $uniNvis4 = 0;
    546525
    547526        $chunkname = $row[0];
     
    554533        if($row[7] > 0) $Nwarpgood = $row[7];
    555534        if($row[8] > 0) $Nwarpbad = $row[8];
    556         if($row[9] > 0) $uniNvis1 = $row[9];
    557         if($row[10] > 0) $uniNvis2 = $row[10];
    558         if($row[11] > 0) $uniNvis3 = $row[11];
    559         if($row[12] > 0) $uniNvis4 = $row[12];
    560535
    561536        #set flags if present
     
    629604        if(($NWWdiffbad >= 1) or ($NWSdiffbad >= 1)) $baddiffflag = 1;
    630605
    631         if (($uniNvis1 != $uniNvis2) or ($uniNvis1 != $uniNvis3) or ($uniNvis1 != $uniNvis4)) {
     606        if ($Nvis1 != $Nvis4) {
    632607          if ($NWWdiffpub != $NexpWWdiff) $complete = "chunk incomplete, not done"; 
    633608          if ($NWWdiffpub == $NexpWWdiff) $complete = "chunk incomplete, done"; 
    634609        }
    635         if (($uniNvis1 == $uniNvis2) and ($uniNvis1 == $uniNvis3) and ($uniNvis1 == $uniNvis4)) {
     610        if ($Nvis1 == $Nvis4) {
    636611          if ($NWWdiffpub != $NexpWWdiff) $complete = "chunk complete, not done"; 
    637612          if ($NWWdiffpub == $NexpWWdiff) $complete = "chunk complete, done"; 
     613
    638614        }
    639615
     
    920896        $pubLabelsExist,
    921897        $stages,
    922         $selectedState,
    923         $selectedLabel, $selectedStage, $plotType) {
     898        $selectedState, $selectedLabel, $selectedStage, $plotType) {
    924899
    925900    // timer start
     
    951926    createFormattedTableCell(($selectedStage != "all_stages"), $link, "All stages", 0, "$columnHeaderColor");
    952927
    953     #echo "<th>Label (in order of priority)</th>";
     928    //echo "<th>Label (in order of priority)</th>";
    954929    foreach ($stages as &$stage) {
    955930
     
    965940
    966941        createFormattedTableCell($showLink, $link, $stage, 0, "$columnHeaderColor");
    967 #        createTableColumnHeader("Dates");
     942        #createTableColumnHeader("Dates");
    968943    }
    969944
     
    1006981        foreach ($stages as &$stage) {
    1007982          // Note: Do not include the state for chip, cam, and warp so that both new and update faults are listed
    1008           $myTable    = $mainTable[$stage];
    1009           $myFailures = $getFailures[$stage];
     983      $myTable    = $mainTable[$stage];
     984      $myFailures = $getFailures[$stage];
    1010985          # echo "myTable: $myTable";
    1011986
    1012           if ("$myFailures" == "NONE") {
     987      if ("$myFailures" == "NONE") {
    1013988            $link = $defaultlink;
    1014989          } else {
    1015990            $link = $myFailures . "?pass=" . $pass . "&proj=" . $proj . "&" . $myTable . ".label=" . $thisLabel;
    1016             if ($addSearchState[$stage]) {
     991        if ($addSearchState[$stage]) {
    1017992              // Note: Do not include the state for chip, cam, and warp so that both new and update faults are listed
    1018993              $link .= "&" . $myTable . ".state=" . $searchState;
    1019994            }
    1020995          }
    1021           // echo "getStateAndFaults $db, $thisLabel, $proj, $selectedState, $stage, $str, $anyFaults<br>";
    1022           getStateAndFaults($db, $thisLabel, $proj, $selectedState, $stage, $str, $anyFaults);
    1023 
    1024           $cellcolor = 0;
    1025           if ("$stage" == "dist") {
    1026             $cellcolor = (!$isUpdate && !$distributing) ? "gray" : 0;
     996      // echo "getStateAndFaults $db, $thisLabel, $proj, $selectedState, $stage, $str, $anyFaults<br>";
     997      getStateAndFaults($db, $thisLabel, $proj, $selectedState, $stage, $str, $anyFaults);
     998
     999      $cellcolor = 0;
     1000      if ("$stage" == "dist") {
     1001        $cellcolor = (!$isUpdate && !$distributing) ? "gray" : 0;
    10271002          }
    10281003          if ("$stage" == "pub") {
    1029             $cellcolor = (!$isUpdate && !$publishing) ? "gray" : 0;
     1004        $cellcolor = (!$isUpdate && !$publishing) ? "gray" : 0;
    10301005          }
    10311006          createFormattedTableCell($anyFaults, $link, $str, $anyFaults, $cellcolor);
     
    12321207
    12331208    // timer finished
    1234     echo "<tr><th colspan=11>";
     1209#    echo "<tr><th colspan=11>";
    12351210    $time = microtime();
    12361211    $time = explode(' ', $time);
     
    12381213    $finish = $time;
    12391214    $total_time = round(($finish - $start), 3);
    1240     echo "loading in $total_time seconds.";
     1215#    echo "loading in $total_time seconds.";
    12411216    $start= $finish;
    1242     echo "</th></tr>";
     1217#    echo "</th></tr>";
    12431218    echo "</table><br>";
    12441219
     
    12611236    $firstIn = true;
    12621237    while ($qry->fetchInto($row)) {
    1263 
    12641238        if ($firstIn) {
    1265 
    12661239            $dates = $row[0];
    12671240            $firstIn = false;
     
    13001273    createTableColumnHeader("Alive?");
    13011274    createTableColumnHeader("Running?");
    1302 
    1303     //write_header_cell($class, "Server");
    1304     //write_header_cell($class, "Alive?");
    1305     //$link = "czartool_labels.php?pass=".$pass
    1306     //    ."&proj=".$proj
    1307     //    ."&label=".$selectedLabel
    1308     //    ."&stage=".$selectedStage
    1309     //    ."&plottype=".$plotType
    1310     //    ."&allservercmd=stop";
    1311 
    1312     //$link = ""; # TODO removed links temporarily
    1313     //    write_table_cell($class, '%s', $link, "Stop all");
    1314     //$link = "czartool_labels.php?pass=".$pass
    1315     //    ."&proj=".$proj
    1316     //    ."&label=".$selectedLabel
    1317     //    ."&stage=".$selectedStage
    1318     //    ."&plottype=".$plotType
    1319     //    ."&allservercmd=run";
    1320 
    1321     //$link = ""; # TODO removed links temporarily
    1322     //    write_table_cell($class, '%s', $link, "Run all");
    13231275    echo "</tr>\n";
    13241276
     
    13361288            ."&plottype=".$plotType;
    13371289
    1338         #$link = ""; # TODO removed links temporarily
    1339         //write_table_cell($class, '%s', $link, $server);
    1340         //write_table_cell($class, '%s', "", $alive ? "yes" : "NO");
    1341         //echo "<td>$server</td>";
    13421290        createFormattedTableCell(1, $link, $server, 0, 0);
    13431291        createFormattedTableCell(0, "", $alive ? "yes" : "NO", !$alive, 0);
    13441292        createFormattedTableCell(0, "", $running ? "yes" : "NO", !$running, 0);
    1345 
    1346         //if ($alive) {
    1347 
    1348           //  $link = "czartool_labels.php?pass=".$pass
    1349             //    ."&proj=".$proj
    1350               //  ."&label=".$selectedLabel
    1351               //  ."&stage=".$selectedStage
    1352               //  ."&plottype=".$plotType
    1353               //  ."&server=".$server
    1354               //  ."&servercmd=";
    1355 
    1356             //if ($running)  {
    1357 
    1358               //  $link = $link . "stop";
    1359               //  $link = ""; # TODO removed links temporarily
    1360               //      write_table_cell($class, '%s', $link, "stop");
    1361               //  write_table_cell($class, '%s', "", "");
    1362            // }
    1363            // else {
    1364 
    1365              //   $link = $link . "run";
    1366               //  write_table_cell($class, '%s', "", "");
    1367               //  $link = ""; # TODO removed links temporarily
    1368                //     write_table_cell($class, '%s', $link, "run");
    1369            // }
    1370        // }
    1371        // else {
    1372 
    1373          //   write_table_cell($class, '%s', "", "");
    1374          //   write_table_cell($class, '%s', "", "");
    1375        // }
    13761293        echo "</tr>\n";
    13771294    }
     
    14641381#
    14651382###########################################################################
    1466 function showServerStatus($server) {
    1467 
    1468     echo "<p> Status for $server server </p>";
     1383function showServerStatus($server, $proj) {
     1384
     1385    echo "<p> $server server status for $proj</p>";
    14691386
    14701387    $results=array();
    1471     exec("czartool_getServerStatus.pl -s $server", $results, $status);
     1388    exec("czartool_getServerStatus.pl -s $server -p $proj", $results, $status);
    14721389
    14731390    foreach ($results as &$line) {
     
    14751392        echo "$line\n";
    14761393        echo "</pre>\n";
    1477 
    14781394    }
    14791395}
     
    15831499#
    15841500###########################################################################
    1585 function createSummitDataTable2($projectdb) {
     1501function createSummitDataTable2($projectdb, $pass, $proj) {
    15861502
    15871503    // timer start
     
    16011517    echo $table;
    16021518    echo "<tr>";
    1603     createTableTitle("Data status tonight $date (UT) <br> current time $datetime", 4);
     1519    createTableTitle("Data status tonight $date <br> current time $datetime (UTC)", 4);
    16041520    echo "<tr>";
    1605     createTableColumnHeader("Exp_type at summit");
    1606     createTableColumnHeader("Status at summit");
    1607     createTableColumnHeader("Status at mhpcc");
    1608     createTableColumnHeader("Number");
     1521
     1522    createTableColumnHeader("Exposure type");
     1523    createTableColumnHeader("<a href=\"czartool_labels.php?pass=".$pass."&proj=".$proj."&label=all&stage=summitExp\"><font color=\"blue\">summitExp status</font></a>");
     1524    createTableColumnHeader("<a href=\"czartool_labels.php?pass=".$pass."&proj=".$proj."&label=all&stage=downloadExp\"><font color=\"blue\">downloadExp status</font></a>");
     1525    createTableColumnHeader("<a href=\"czartool_labels.php?pass=".$pass."&proj=".$proj."&label=all&stage=rawExp\"><font color=\"blue\">rawExp </a>/
     1526                             <a href=\"czartool_labels.php?pass=".$pass."&proj=".$proj."&label=all&stage=newExp\"><font color=\"blue\"> newExp</font></a>");
    16091527    $sql = "SELECT summitExp.exp_type,pzDownloadExp.state,rawExp.state,COUNT(*) FROM summitExp
    16101528            LEFT JOIN pzDownloadExp USING (summit_id) LEFT JOIN rawExp on summitExp.exp_name = rawExp.exp_name
     
    16141532        if ($tmp[1] == NULL) {
    16151533          echo  "<tr><td>$tmp[0]<td> null <td> null <td bgcolor=\"yellow\"> <font color=\"red\">$tmp[3]";
    1616         }
    1617         else {
     1534        } else {
    16181535          if ($tmp[1] == 'run') {
    16191536            echo  "<tr><td>$tmp[0]<td> loading <td> null <td bgcolor=$columnHeaderColor> <font color=\"red\">$tmp[3]";
    1620           }
    1621           else {
     1537          } else {
    16221538            if ($tmp[2] == NULL) {
    16231539              echo  "<tr><td>$tmp[0] <td> $tmp[1] <td> loading <td bgcolor=$columnHeaderColor> <font color=\"blue\">$tmp[3]";
    1624             }
    1625             else {
     1540            } else {
    16261541              echo  "<tr><td>$tmp[0]<td> $tmp[1] <td> downloaded <td> $tmp[3]";
    16271542            }
     
    16301545    }
    16311546
    1632     echo "<tr><th colspan=4>Last night $datem1 (UT)";
     1547    echo "<tr><th colspan=4>Last night $datem1 (UTC)";
    16331548    $sql = "SELECT summitExp.exp_type,pzDownloadExp.state,rawExp.state,COUNT(*) FROM summitExp
    16341549            LEFT JOIN pzDownloadExp USING (summit_id) LEFT JOIN rawExp on summitExp.exp_name = rawExp.exp_name
     
    16381553        if ($tmp[1] == NULL) {
    16391554          echo  "<tr><td>$tmp[0]<td> null <td> null <td bgcolor=\"yellow\"> <font color=\"red\">$tmp[3]";
    1640         }
    1641         else {
     1555        } else {
    16421556          if ($tmp[1] == 'run') {
    16431557            echo  "<tr><td>$tmp[0]<td> loading <td> null <td bgcolor=$columnHeaderColor> <font color=\"red\">$tmp[3]";
    1644           }
    1645           else {
     1558          } else {
    16461559            if ($tmp[2] == NULL) {
    16471560              echo  "<tr><td>$tmp[0] <td> $tmp[1] <td> loading <td bgcolor=$columnHeaderColor> <font color=\"blue\">$tmp[3]";
    1648             }
    1649             else {
     1561            } else {
    16501562              echo  "<tr><td>$tmp[0]<td> $tmp[1] <td> downloaded <td> $tmp[3]";
    16511563            }
     
    16651577    echo "</table><br>";
    16661578}
    1667 ////////////////////////////////////////////////////////////////////////////////
    1668 ///                         no needed functions                              ///
    1669 ////////////////////////////////////////////////////////////////////////////////
    1670 //function createSummitDataTable($projectdb) {
    1671 //
    1672 //    // timer start
    1673 //    $time = microtime();
    1674 //    $time = explode(' ', $time);
    1675 //    $time = $time[1] + $time[0];
    1676 //    $start = $time;
    1677 //
    1678 //    // function begin
    1679 //    $date = date("Y-m-d");
    1680 //    $sql = "SELECT DISTINCT exp_type FROM summitExp WHERE dateobs > '$date'";
    1681 //
    1682 //    $qry = $projectdb->query($sql);
    1683 //    if (dberror($qry)) {
    1684 //        echo "<b>error reading newExp table</b><br>\n";
    1685 //        echo "<br><small><b> table query : $sql </b></small><br>\n";
    1686 //        menu_end();
    1687 //    }
    1688 //
    1689 //    // set up the table
    1690 //    global $table;
    1691 //    echo $table;
    1692 //    echo "<tr>";
    1693 //    createTableTitle("Data status > $date", 4);
    1694 //    echo "<tr>";
    1695 //    createTableColumnHeader("Exposure type");
    1696 //    createTableColumnHeader("At summit");
    1697 //    createTableColumnHeader("Registered at MHPCC");
    1698 //    createTableColumnHeader("Summit (Drop/Null)");
    1699 //
    1700 //    $msg = "No science images taken since $date";
    1701 //
    1702 //    // list the results
    1703 //    while ($qry->fetchInto($expType)) {
    1704 //
    1705 //        $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id)
    1706 //                WHERE dateobs > '$date' AND exp_type = '$expType[0]'";
    1707 //             //   AND state != 'drop' AND state is not null AND fault != 1042";
    1708 //        $qry2 = $projectdb->query($sql);
    1709 //        $qry2->fetchInto($summit);
    1710 //
    1711 //        $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name
    1712 //                WHERE summitExp.dateobs > '$date' AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'";
    1713 //        $qry2 = $projectdb->query($sql);
    1714 //        $qry2->fetchInto($mhpcc);
    1715 //
    1716 //        $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id)
    1717 //                WHERE dateobs > '$date' AND exp_type = '$expType[0]' AND (state = 'drop' OR state is null)";
    1718 //        $qry2 = $projectdb->query($sql);
    1719 //        $qry2->fetchInto($dropped);
    1720 //
    1721 //
    1722 //        #Query with 30 minutes delay to check during the night if any exposures are missing.
    1723 //        $datehour = gmdate("Y-m-d H:i:s");
    1724 //        $sql = "SELECT COUNT(*) FROM summitExp LEFT JOIN pzDownloadExp USING (summit_id)
    1725 //                WHERE dateobs > '$date' AND dateobs <= date_sub('$datehour', interval 30 minute)
    1726 //                AND exp_type = '$expType[0]' AND (state != 'drop' OR state is null) and fault != 1042";
    1727 //
    1728 //        $qry2 = $projectdb->query($sql);
    1729 //        $qry2->fetchInto($summitdelay);
    1730 //
    1731 //        $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name
    1732 //                WHERE summitExp.dateobs > '$date' AND summitExp.dateobs <= date_sub('$datehour', interval 30 minute)
    1733 //                AND rawExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'";
    1734 //        $qry2 = $projectdb->query($sql);
    1735 //        $qry2->fetchInto($mhpccdelay);
    1736 //
    1737 //        echo "<tr>";
    1738 //
    1739 //        $DLdiff = $summit[0] - $mhpcc[0];
    1740 //        if ($DLdiff == 0) $error = 0;
    1741 //        else $error = 1;
    1742 //
    1743 //        $delayDLdiff = $summitdelay[0] - $mhpccdelay[0];
    1744 //        if ($delayDLdiff == 0) $errordelay = 0;
    1745 //        else $errordelay = 1;
    1746 //
    1747 //        echo "<td>$expType[0]</td>";
    1748 //        echo "<td>$summit[0]</td>";
    1749 //        if ($delayDLdiff==0) {
    1750 //           createFormattedTableCell("", "", $mhpcc[0], $error, 0);
    1751 //        } else {
    1752 //           $DLStatus = "<font style=\"BACKGROUND-COLOR: yellow\"  color=\"red\">$mhpcc[0] ($delayDLdiff)</font>";
    1753 //           echo "<td>$DLStatus</td>";
    1754 //        }
    1755 //
    1756 //        echo "<td>$dropped[0]</td>";
    1757 //
    1758 //        echo "</tr>";
    1759 //    }
    1760 //
    1761 //    // timer finished
    1762 //    echo "<tr><th colspan=4>";
    1763 //    $time = microtime();
    1764 //    $time = explode(' ', $time);
    1765 //    $time = $time[1] + $time[0];
    1766 //    $finish = $time;
    1767 //    $total_time = round(($finish - $start), 3);
    1768 //    echo "loading in $total_time seconds.";
    1769 //    $start= $finish;
    1770 //    echo "</th></tr>";
    1771 //    echo "</table><br>";
    1772 //}
     1579###########################################################################
     1580#
     1581# Gets disk status
     1582#
     1583###########################################################################
     1584function getHosts($db) {
     1585    // timer start
     1586    $time = microtime();
     1587    $time = explode(' ', $time);
     1588    $time = $time[1] + $time[0];
     1589    $start = $time;
     1590
     1591    #echo "<script type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"></script>";
     1592    echo "<script type=\"text/javascript\" src=\"loader.js\"></script>";
     1593    echo "<br><div class=\"chartWithOverlay\" style=\"position: relative; width: 640px\">";
     1594    echo "  <div id=\"disk_div\" style=\"width:640px; height:1200px\"></div>";
     1595    echo "  <div class=\"overlay\" style=\"position: absolute; width: 100px; top: 35px; right: 20px;\">";
     1596    echo "    <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: #00ff00\"><center>Free</div>";
     1597    echo "    <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: #ffff00\"><center>Used</div>";
     1598    echo "    <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: #ff0000\"><center>> 97% limit</div>";
     1599    echo "    <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: #bbbbbb\"><center>Down | Repair</div>";
     1600    echo "    <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: #ffffff\"><center>Power Off</div>";
     1601    echo "    <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: #ffffff\"><center>
     1602                 <a href=\"https://confluence.ipp.ifa.hawaii.edu/display/IKB/IPP+Hardware+Status#IPPHardwareStatus-StorageNodes\" target=new><font color=\"blue\">Notes</font></a></div>";
     1603    echo "  </div>";
     1604    echo "</div>";
     1605
     1606    echo "<script type=\"text/javascript\">";
     1607    echo "google.charts.load('current', {packages: ['corechart', 'bar']});";
     1608    echo "google.charts.setOnLoadCallback(drawBarColors);";
     1609    echo "function drawBarColors() {";
     1610    echo "  var data = google.visualization.arrayToDataTable([";
     1611    echo "    ['Host', ";
     1612    echo "     'used', {type: 'string', role: 'style'}, {type: 'string', role: 'tooltip', 'p': {'html': true}}, ";
     1613    echo "     'free', {type: 'string', role: 'style'}, {type: 'string', role: 'tooltip', 'p': {'html': true}}],";
     1614
     1615    $sql = "SELECT host, format(total,1), format(available,2), format(used,2), writable, readable, format(used/total*100,2) FROM hosts";
     1616    if ($debug) {echo "$sql<br>";}
     1617    $qry = $db->query($sql);
     1618    if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
     1619    # not sure why neb-host doesn't work on ipp113 CCL.20210216
     1620    exec("neb-host |cut -b 17-30,86-", $hostnoteall);
     1621    while ($qry->fetchInto($row)) {
     1622        list($host, $total, $available, $used, $writable, $readable, $ratio) = $row;
     1623       $hostnotes = preg_grep("/$host/", $hostnoteall);
     1624       $hostnote = array_values($hostnotes);
     1625       if ($writable == 1 && $readable == 1) {
     1626          if ($ratio >= 97) {
     1627            # space used over limits, up mode (read/write ok).
     1628            echo "[ \"$host\", ";
     1629            echo "      $used, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #ff0000;\", \"<i><b>$host: $ratio% of $total TB used</b></i><br>$hostnote[0]\", ";
     1630            echo " $available, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #00ff00;\", \"<i><b>$host: $available TB free</b></i>\"],";
     1631          }
     1632          else {
     1633            # enough space, up mode (read/write ok).
     1634            echo "[ \"$host\", ";
     1635            echo "      $used, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #ffff00;\", \"<i><b>$host: $ratio% of $total TB used</b></i><br>$hostnote[0]\", ";
     1636            echo " $available, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #00ff00;\", \"<i><b>$host: $available TB free</b></i>\"],";
     1637         }
     1638       }
     1639       else if ($writable == 0 && $readable == 1) {
     1640          if ($ratio >= 97) {
     1641            # space used over limits, repair mode (read only).
     1642            echo "[ \"$host\", ";
     1643            echo "      $used, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #ff0000;\", \"<i><b>$host: $ratio% of $total TB used<br><font color=red>$hostnote[0]\", ";
     1644            echo " $available, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #bbbbbb;\", \"<i><b>$host: $available TB free</b></i>\"],";
     1645          }
     1646          else {
     1647            # enough space, but hosts are unstable, repair mode (read only).
     1648            echo "[ \"$host\", ";
     1649            echo "      $used, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #ffff00;\", \"<i><b>$host: $ratio% of $total TB used<br>$hostnote[0]\", ";
     1650            echo " $available, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #bbbbbb;\", \"<i><b>$host: $available TB free</b></i>\"],";
     1651          }
     1652       }
     1653       else {
     1654            # down mode (can't read or write).
     1655            echo "[ \"$host\", ";
     1656            echo "      $used, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #bbbbbb;\", \"<i><b>$host: $ratio% used<br>$hostnote[0]\", ";
     1657            echo " $available, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #bbbbbb;\", \"<i><b>$host: $available TB free</b></i>\"],";
     1658       }
     1659    }
     1660   echo "  ]);";
     1661   echo "   var options = {";
     1662   echo "     title: 'Nebulous Disk Use across IPP Clusters',";
     1663   echo "     titleTextStyle: {color: 'black', fontSize: 15},";
     1664   echo "     width: '100%',";
     1665   echo "     height: '100%',";
     1666   echo "     tooltip: {isHtml: true},";
     1667   echo "     legend: { position: 'none',";
     1668   echo "               alignment: 'end',";
     1669   echo "               maxLines: 3},";
     1670   echo "     hAxis: {  title: 'Space (TB)',";
     1671   echo "               gridlines: {count: 10}";
     1672   echo "     },";
     1673   echo "     bar: { groupWidth: '95%' },";
     1674   echo "     chartArea: {left:70, top:30, right:20, bottom:40},";
     1675   echo "     fontSize: 12,";
     1676   echo "     isStacked: true";
     1677   echo "   };";
     1678   echo "   var chart = new google.visualization.BarChart(document.getElementById('disk_div'));";
     1679   echo "   chart.draw(data, options);";
     1680   echo " }";
     1681   echo "</script>";
     1682    $time = microtime();
     1683    $time = explode(' ', $time);
     1684    $time = $time[1] + $time[0];
     1685    $finish = $time;
     1686    $total_time = round(($finish - $start), 3);
     1687    $start= $finish;
     1688    echo "<center>loading in $total_time seconds<br></center>";
     1689}
     1690
     1691###########################################################################
     1692#
     1693# Gets disk spaces status
     1694#
     1695###########################################################################
     1696function getSpaces($db) {
     1697    // timer start
     1698    $time = microtime();
     1699    $time = explode(' ', $time);
     1700    $time = $time[1] + $time[0];
     1701    $start = $time;
     1702
     1703    $db->query("SELECT sum(format(available, 2)) FROM hosts where host like 'ippb%'")->fetchInto($row);
     1704    $ippbusable = $row[0];
     1705    $db->query("SELECT sum(format(available, 2)) FROM hosts where host like 'ippb%' and writable = 1")->fetchInto($row);
     1706    $ippbfree = $row[0];
     1707
     1708    $db->query("SELECT sum(format(available, 2)) FROM hosts where host not like 'ippb%'")->fetchInto($row);
     1709    $ippusable = $row[0];
     1710    $db->query("SELECT sum(format(available, 2)) FROM hosts where host not like 'ippb%' and writable = 1")->fetchInto($row);
     1711    $ippfree = $row[0];
     1712
     1713    $sql = "select format(used/total*100,1), usable from cluster_space order by timestamp desc limit 1;";
     1714    if ($debug) {echo "$sql<br>";}
     1715    $qry = $db->query($sql);
     1716    if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
     1717    $qry->fetchInto($row);
     1718    $allocated = $row[0];
     1719    $usable    = $row[1];
     1720
     1721    #echo "<script type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"></script>";
     1722    echo "<script type=\"text/javascript\" src=\"loader.js\"></script>";
     1723    echo "<br><div class=\"chartWithOverlay\" style=\"position: relative; width: 640; height:400\">";
     1724    echo "  <div id=\"space_div\" style=\"width:640; \"></div>";
     1725    echo "  <div class=\"overlay\" style=\"position: absolute; width: 400px; bottom: 60px; left: 85px;\">";
     1726    echo "    <div style=\"font-size: 16px; color:#0000ff; background-color:#ffffff\"><b>ipp + ippb nodes: $ippusable + $ippbusable TB (latest usable)</b></div>";
     1727    echo "    <div style=\"font-size: 16px; color:#33a532; background-color:#ffffff\"><b>ipp + ippb nodes: $ippfree + $ippbfree TB (latest free)</b></div>";
     1728    echo "  </div>";
     1729    echo "</div>";
     1730
     1731    echo "<script type=\"text/javascript\">";
     1732    echo "google.charts.load('current', {packages: ['corechart']});";
     1733    echo "google.charts.setOnLoadCallback(drawChart);";
     1734    echo "function drawChart() {";
     1735    echo "  var data = new google.visualization.DataTable();";
     1736    echo "        data.addColumn('datetime', 'Day');";
     1737    echo "        data.addColumn('number', 'Usable');";
     1738    echo "        data.addColumn('number', 'Free');";
     1739    echo "   data.addRows([";
     1740    $interval = 10;
     1741    $sql = "select sub.dated, sub.usable, sub.available from (select date_format(timestamp, \"%Y.%m.%d.%H.%i\") as dated, usable, available from cluster_space where timestamp > curdate() - INTERVAL $interval DAY) as sub group by dated;";
     1742    if ($debug) {echo "$sql<br>";}
     1743    $qry = $db->query($sql);
     1744    if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
     1745    while ($qry->fetchInto($row)) {
     1746        $tsp = explode('.', $row[0]);
     1747        $mon = $tsp[1]-1;
     1748        $timestamp = $row[0];
     1749        $usable    = $row[1];
     1750        $available = $row[2];
     1751#       new Date(Year, Month, Day, Hours, Minutes, Seconds, Milliseconds)
     1752       echo "[new Date($tsp[0], $mon, $tsp[2], $tsp[3], $tsp[4]), $usable, $available],";
     1753    }
     1754   echo "  ]);";
     1755   echo "   var options = {";
     1756   echo "      chart: {"; 
     1757   echo "               position: 'center', " ;
     1758   echo "              },";
     1759   echo "     title: 'Total Available Cluster Space in the Past $interval Days ($allocated% of total allocated)',";
     1760   echo "     titleTextStyle: {color: 'black', fontSize: 15},";
     1761   echo "     width: '100%',";
     1762   echo "     height: 400,";
     1763   echo "     legend: { position: 'top',";
     1764   echo "               alignment: 'center',";
     1765   echo "              },";
     1766   echo "     lineWidth: 2, ";
     1767   echo "     series: {";
     1768   echo "         0: { color: '#0000ff', lineWidth: 3 },      ";
     1769   echo "         1: { color: '#33a532', lineWidth: 3 },      ";
     1770   echo "              },";
     1771   echo "     hAxis: {  ";
     1772   echo "             title: 'Date/Time (HST)',";
     1773   echo "             format: 'MMM dd',";
     1774   echo "            gridlines: {count: -1},";
     1775   echo "     },";
     1776   echo "     vAxis: {  ";
     1777   echo "                  title: 'Available (TB)',";
     1778   echo "     viewWindow: {   min: 500    },  ";
     1779   echo "     },";
     1780   echo "     chartArea: {left:80, top:50, right:20, bottom:50},";
     1781   echo "     fontSize: 12,";
     1782   echo "   };";
     1783   echo "   var chart = new google.visualization.LineChart(document.getElementById('space_div'));";
     1784   echo "   chart.draw(data, options);";
     1785   echo " }";
     1786   echo "</script>";
     1787    $time = microtime();
     1788    $time = explode(' ', $time);
     1789    $time = $time[1] + $time[0];
     1790    $finish = $time;
     1791    $total_time = round(($finish - $start), 3);
     1792    $start= $finish;
     1793    echo "<center>loading in $total_time seconds<br></center>";
     1794}
     1795
     1796###########################################################################
     1797#
     1798# Gets time series plot
     1799#
     1800###########################################################################
     1801function Gettimeseries($db, $selectedMode, $selectedLabel, $proj, $selectedStage) {
     1802    // timer start
     1803    $time = microtime();
     1804    $time = explode(' ', $time);
     1805    $time = $time[1] + $time[0];
     1806    $start = $time;
     1807
     1808    // google chart javascript source code
     1809    #echo "<script type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"></script>";
     1810    echo "<script type=\"text/javascript\" src=\"loader.js\"></script>";
     1811
     1812    // if button doesn't work, maybe plot linear and log chart separately
     1813    #echo "<div id=\"time_series_div_lin\" style=\"width:640; height:400;\"></div><br>";
     1814    #echo "<div id=\"time_series_div_log\" style=\"width:640; height:400;\"></div>";
     1815    echo "<div id=\"time_series_div\" style=\"width:640; height:400;\"></div>";
     1816
     1817    // click button to switch linear or log plot, but sometimes it doesn't work well.
     1818    echo "<div><center><button id=\"linlogchart\"></button></div>";
     1819
     1820    // javascript start
     1821    echo "<script type=\"text/javascript\">";
     1822    echo "google.charts.load('current', {'packages': ['corechart', 'line']});";
     1823    echo "google.charts.setOnLoadCallback(drawChart);";
     1824    // draw funciton start
     1825    echo "function drawChart() {";
     1826    echo "  var button   = document.getElementById('linlogchart');";  // for linear and log button
     1827    echo "  var chartDiv = document.getElementById('time_series_div');";
     1828    echo "  var data = new google.visualization.DataTable();";
     1829   
     1830    // plot data
     1831    $dayshift = -0; // query back to N-th day
     1832    // check labels
     1833    if ($selectedLabel == "all") {
     1834      $selectedLabel = "stdscience_labels";
     1835      $plotlabel = "all";
     1836    } else {
     1837      $plotlabel = $selectedLabel;
     1838    }
     1839
     1840    // check stages
     1841    if ($selectedStage == "all_stages") {
     1842      $plotstage = "all";
     1843      if ($selectedLabel == "stdscience_labels") {
     1844        // all stages and all labels
     1845        $plotseries  = "    series: { 0: { color: '#a6cee3' , lineWidth: 2                       }, ";
     1846        $plotseries .= "              1: { color: '#1f78b4' , lineWidth: 2                       }, ";
     1847        $plotseries .= "              2: { color: '#fb9a99' , lineWidth: 2, lineDashStyle: [8, 4]}, ";
     1848        $plotseries .= "              3: { color: '#e31a1c' , lineWidth: 2                       }, ";
     1849        $plotseries .= "              4: { color: '#33a02c' , lineWidth: 2                       }, ";
     1850        $plotseries .= "              5: { color: '#b2df8a' , lineWidth: 2, lineDashStyle: [8, 4]}, ";
     1851        $plotseries .= "              6: { color: '#ff7f00' , lineWidth: 2                       }, ";
     1852        $plotseries .= "              7: { color: '#fdbf6f' , lineWidth: 2, lineDashStyle: [8, 4]}, ";
     1853        $plotseries .= "              8: { color: '#cab2d6' , lineWidth: 2                       }, ";
     1854        $plotseries .= "              9: { color: '#6a3d9a' , lineWidth: 2                       }, ";
     1855        $plotseries .= "             10: { color: 'cyan'    , lineWidth: 2, lineDashStyle: [3, 4]}, ";
     1856        $plotseries .= "             11: { color: '#c51b7d' , lineWidth: 2, lineDashStyle: [3, 4]}, ";
     1857        $plotseries .= "             12: { color: '#b15928' , lineWidth: 2, lineDashStyle: [3, 4]}, ";
     1858        $plotseries .= "             13: { color: '#000004' , lineWidth: 2, lineDashStyle: [3, 4]}, },";
     1859       
     1860        // data header
     1861        echo "  data.addColumn('datetime',        'Time');";
     1862        echo "  data.addColumn(  'number',        'chip'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1863        echo "  data.addColumn(  'number',         'cam'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1864        echo "  data.addColumn(  'number',        'fake'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1865        echo "  data.addColumn(  'number',        'warp'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1866        echo "  data.addColumn(  'number',       'stack'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1867        echo "  data.addColumn(  'number',   'staticsky'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1868        echo "  data.addColumn(  'number',        'diff'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1869        echo "  data.addColumn(  'number',   'fullforce'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1870        echo "  data.addColumn(  'number',        'dist'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1871        echo "  data.addColumn(  'number',         'pub'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1872        echo "  data.addColumn(  'number',   'summitExp'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1873        echo "  data.addColumn(  'number', 'downloadExp'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1874        echo "  data.addColumn(  'number',      'newExp'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1875        echo "  data.addColumn(  'number',      'rawExp'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1876        // data content
     1877        echo "  data.addRows([";
     1878 
     1879        //  query data from czardb
     1880        $sql = "select date_format(addtime(rawrun.timestamp, '10:00:00'), \"%Y.%m.%d.%H.%i.%s\") as dated, chiprun.proc as chipproc, camrun.proc as camproc, fakerun.proc as fakeproc, warprun.proc as warpproc, stackrun.proc as stackproc, statrun.proc as statproc, diffrun.proc as diffproc, ffrun.proc as ffproc, distrun.proc as distproc, pubrun.proc as pubproc, summrun.proc as sumproc, downrun.proc as downproc, newrun.proc as newproc, rawrun.proc as rawproc, timestamp";
     1881        $sql.= " from (select @rank1:=@rank1+1 AS rank, timestamp, processed as proc from rawExp   ,   (select @rank1:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as rawrun                ";
     1882        $sql.= " join (select @rank2:=@rank2+1 AS rank,            processed as proc from newExp   ,   (select @rank2:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as newrun   using (rank) ";
     1883        $sql.= " join (select @rank3:=@rank3+1 AS rank,            processed as proc from summitExp,   (select @rank3:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as summrun  using (rank) ";
     1884        $sql.= " join (select @rank4:=@rank4+1 AS rank,            processed as proc from downloadExp, (select @rank4:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as downrun  using (rank) ";
     1885        $sql.= " join (select @rank5:=@rank5+1 AS rank,            processed as proc from chip,        (select @rank5:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as chiprun  using (rank) ";
     1886        $sql.= " join (select @rank6:=@rank6+1 AS rank,            processed as proc from cam,         (select @rank6:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as camrun   using (rank) ";
     1887        $sql.= " join (select @rank7:=@rank7+1 AS rank,            processed as proc from fake,        (select @rank7:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as fakerun  using (rank) ";
     1888        $sql.= " join (select @rank8:=@rank8+1 AS rank,            processed as proc from cam,         (select @rank8:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as warprun  using (rank) ";
     1889        $sql.= " join (select @rank9:=@rank9+1 AS rank,            processed as proc from stack,       (select @rank9:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as stackrun using (rank) ";
     1890        $sql.= " join (select @rank10:=@rank10+1 AS rank,          processed as proc from staticsky,   (select @rank10:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as statrun  using (rank) ";
     1891        $sql.= " join (select @rank11:=@rank11+1 AS rank,          processed as proc from diff,        (select @rank11:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as diffrun  using (rank) ";
     1892        $sql.= " join (select @rank12:=@rank12+1 AS rank,          processed as proc from fullforce,   (select @rank12:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as ffrun    using (rank) ";
     1893        $sql.= " join (select @rank13:=@rank13+1 AS rank,          processed as proc from dist,        (select @rank13:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as distrun  using (rank) ";
     1894        $sql.= " join (select @rank14:=@rank14+1 AS rank,          processed as proc from pub,         (select @rank14:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as pubrun   using (rank);";
     1895
     1896        // define last process and total process
     1897        list($lastproc1 , $sumproc1 ) = array(-1, 0);
     1898        list($lastproc2 , $sumproc2 ) = array(-1, 0);
     1899        list($lastproc3 , $sumproc3 ) = array(-1, 0);
     1900        list($lastproc4 , $sumproc4 ) = array(-1, 0);
     1901        list($lastproc5 , $sumproc5 ) = array(-1, 0);
     1902        list($lastproc6 , $sumproc6 ) = array(-1, 0);
     1903        list($lastproc7 , $sumproc7 ) = array(-1, 0);
     1904        list($lastproc8 , $sumproc8 ) = array(-1, 0);
     1905        list($lastproc9 , $sumproc9 ) = array(-1, 0);
     1906        list($lastproc10, $sumproc10) = array(-1, 0);
     1907        list($lastproc11, $sumproc11) = array(-1, 0);
     1908        list($lastproc12, $sumproc12) = array(-1, 0);
     1909        list($lastproc13, $sumproc13) = array(-1, 0);
     1910        list($lastproc14, $sumproc14) = array(-1, 0);
     1911
     1912        // query from czardb 
     1913        if ($debug) {echo "$sql<br>";}
     1914        $qry = $db->query($sql);
     1915        if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
     1916        // define plot title
     1917        //$plottitle = "title: 'Items + N x 150 offset',";
     1918        $plottitle = "title: 'Items',";
     1919
     1920        // loading all the data
     1921        while ($qry->fetchInto($row)) {
     1922          // get UTC time info.
     1923          $tsp = explode('.', $row[0]);
     1924
     1925          // get processing info. from all stages and get time series.
     1926          $thisproc1  = $row[1] ; list($thisproc1 , $lastproc1 , $sumproc1 ) = gettotalprocessed($thisproc1 , $lastproc1 , $sumproc1 ); // chip
     1927          $thisproc2  = $row[2] ; list($thisproc2 , $lastproc2 , $sumproc2 ) = gettotalprocessed($thisproc2 , $lastproc2 , $sumproc2 ); // cam
     1928          $thisproc3  = $row[3] ; list($thisproc3 , $lastproc3 , $sumproc3 ) = gettotalprocessed($thisproc3 , $lastproc3 , $sumproc3 ); // fake
     1929          $thisproc4  = $row[4] ; list($thisproc4 , $lastproc4 , $sumproc4 ) = gettotalprocessed($thisproc4 , $lastproc4 , $sumproc4 ); // warp
     1930          $thisproc5  = $row[5] ; list($thisproc5 , $lastproc5 , $sumproc5 ) = gettotalprocessed($thisproc5 , $lastproc5 , $sumproc5 ); // stack
     1931          $thisproc6  = $row[6] ; list($thisproc6 , $lastproc6 , $sumproc6 ) = gettotalprocessed($thisproc6 , $lastproc6 , $sumproc6 ); // staticsky
     1932          $thisproc7  = $row[7] ; list($thisproc7 , $lastproc7 , $sumproc7 ) = gettotalprocessed($thisproc7 , $lastproc7 , $sumproc7 ); // diff
     1933          $thisproc8  = $row[8] ; list($thisproc8 , $lastproc8 , $sumproc8 ) = gettotalprocessed($thisproc8 , $lastproc8 , $sumproc8 ); // fullforce
     1934          $thisproc9  = $row[9] ; list($thisproc9 , $lastproc9 , $sumproc9 ) = gettotalprocessed($thisproc9 , $lastproc9 , $sumproc9 ); // dist
     1935          $thisproc10 = $row[10]; list($thisproc10, $lastproc10, $sumproc10) = gettotalprocessed($thisproc10, $lastproc10, $sumproc10); // pub
     1936          $thisproc11 = $row[11]; list($thisproc11, $lastproc11, $sumproc11) = gettotalprocessed($thisproc11, $lastproc11, $sumproc11); // rawExp
     1937          $thisproc12 = $row[12]; list($thisproc12, $lastproc12, $sumproc12) = gettotalprocessed($thisproc12, $lastproc12, $sumproc12); // newExp
     1938          $thisproc13 = $row[13]; list($thisproc13, $lastproc13, $sumproc13) = gettotalprocessed($thisproc13, $lastproc13, $sumproc13); // summitExp
     1939          $thisproc14 = $row[14]; list($thisproc14, $lastproc14, $sumproc14) = gettotalprocessed($thisproc14, $lastproc14, $sumproc14); // downloadExp
     1940
     1941          // get HST time info.
     1942          $hsttime    = $row[15];
     1943
     1944          // data content
     1945          echo "[new Date($tsp[0], $tsp[1]-1, $tsp[2], $tsp[3], $tsp[4], $tsp[5]), ";
     1946          echo "$sumproc1 , \"<i><b>$hsttime (HST) $sumproc1   chip        </i></b> \",";  //+ 7*150 chip
     1947          echo "$sumproc2 , \"<i><b>$hsttime (HST) $sumproc2   cam         </i></b> \",";  //+ 6*150 cam
     1948          echo "$sumproc3 , \"<i><b>$hsttime (HST) $sumproc3   fake        </i></b> \",";  //+ 5*150 fake
     1949          echo "$sumproc4 , \"<i><b>$hsttime (HST) $sumproc4   warp        </i></b> \",";  //+ 4*150 warp
     1950          echo "$sumproc5 , \"<i><b>$hsttime (HST) $sumproc5   stack       </i></b> \",";  //+ 0*150 stack
     1951          echo "$sumproc6 , \"<i><b>$hsttime (HST) $sumproc6   staticsky   </i></b> \",";  //+ 0*150 staticsky
     1952          echo "$sumproc7 , \"<i><b>$hsttime (HST) $sumproc7   diff        </i></b> \",";  //+10*150 diff
     1953          echo "$sumproc8 , \"<i><b>$hsttime (HST) $sumproc8   fullforce   </i></b> \",";  //+ 0*150 fullforce
     1954          echo "$sumproc9 , \"<i><b>$hsttime (HST) $sumproc9   dist        </i></b> \",";  //+ 8*150 dist
     1955          echo "$sumproc10, \"<i><b>$hsttime (HST) $sumproc10  pub         </i></b> \",";  //+ 9*150 pub
     1956          echo "$sumproc11, \"<i><b>$hsttime (HST) $sumproc11  summitExp   </i></b> \",";  //+ 3*150 summitExp
     1957          echo "$sumproc12, \"<i><b>$hsttime (HST) $sumproc12  downloadExp </i></b> \",";  //+ 2*150 downloadExp
     1958          echo "$sumproc13, \"<i><b>$hsttime (HST) $sumproc13  newExp      </i></b> \",";  //+ 1*150 newExp
     1959          echo "$sumproc14, \"<i><b>$hsttime (HST) $sumproc14  rawExp      </i></b> \" ";  //+ 0*150 rawExp
     1960          echo "], ";
     1961        }
     1962      } else {
     1963        // all stages, but selected label
     1964        $plotseries  = "    series: { 0: { color: '#a6cee3' , lineWidth: 2                       }, ";
     1965        $plotseries .= "              1: { color: '#1f78b4' , lineWidth: 2                       }, ";
     1966        $plotseries .= "              2: { color: '#fb9a99' , lineWidth: 2, lineDashStyle: [8, 4]}, ";
     1967        $plotseries .= "              3: { color: '#e31a1c' , lineWidth: 2                       }, ";
     1968        $plotseries .= "              4: { color: '#33a02c' , lineWidth: 2                       }, ";
     1969        $plotseries .= "              5: { color: '#b2df8a' , lineWidth: 2, lineDashStyle: [8, 4]}, ";
     1970        $plotseries .= "              6: { color: '#ff7f00' , lineWidth: 2                       }, ";
     1971        $plotseries .= "              7: { color: '#fdbf6f' , lineWidth: 2, lineDashStyle: [8, 4]}, ";
     1972        $plotseries .= "              8: { color: '#cab2d6' , lineWidth: 2                       }, ";
     1973        $plotseries .= "              9: { color: '#6a3d9a' , lineWidth: 2                       }, },";
     1974
     1975        // data header
     1976        echo "  data.addColumn('datetime',        'Time');";
     1977        echo "  data.addColumn(  'number',        'chip'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1978        echo "  data.addColumn(  'number',         'cam'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1979        echo "  data.addColumn(  'number',        'fake'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1980        echo "  data.addColumn(  'number',        'warp'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1981        echo "  data.addColumn(  'number',       'stack'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1982        echo "  data.addColumn(  'number',   'staticsky'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1983        echo "  data.addColumn(  'number',        'diff'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1984        echo "  data.addColumn(  'number',   'fullforce'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1985        echo "  data.addColumn(  'number',        'dist'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1986        echo "  data.addColumn(  'number',         'pub'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     1987
     1988        // data content
     1989        echo "  data.addRows([";
     1990 
     1991        //  query data from czardb
     1992        $sql = "select date_format(addtime(chiprun.timestamp, '10:00:00'), \"%Y.%m.%d.%H.%i.%s\") as dated, chiprun.proc as chipproc, camrun.proc as camproc, fakerun.proc as fakeproc, warprun.proc as warpproc, stackrun.proc as stackproc, statrun.proc as statproc, diffrun.proc as diffproc, ffrun.proc as ffproc, distrun.proc as distproc, pubrun.proc as pubproc, timestamp";
     1993        $sql.= " from (select @rank1:=@rank1+1 AS rank, timestamp, processed as proc from chip,        (select @rank1:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as chiprun              ";
     1994        $sql.= " join (select @rank6:=@rank6+1 AS rank,            processed as proc from cam,         (select @rank6:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as camrun   using (rank) ";
     1995        $sql.= " join (select @rank7:=@rank7+1 AS rank,            processed as proc from fake,        (select @rank7:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as fakerun  using (rank) ";
     1996        $sql.= " join (select @rank8:=@rank8+1 AS rank,            processed as proc from cam,         (select @rank8:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as warprun  using (rank) ";
     1997        $sql.= " join (select @rank9:=@rank9+1 AS rank,            processed as proc from stack,       (select @rank9:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as stackrun using (rank) ";
     1998        $sql.= " join (select @rank10:=@rank10+1 AS rank,          processed as proc from staticsky,   (select @rank10:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as statrun  using (rank) ";
     1999        $sql.= " join (select @rank11:=@rank11+1 AS rank,          processed as proc from diff,        (select @rank11:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as diffrun  using (rank) ";
     2000        $sql.= " join (select @rank12:=@rank12+1 AS rank,          processed as proc from fullforce,   (select @rank12:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as ffrun    using (rank) ";
     2001        $sql.= " join (select @rank13:=@rank13+1 AS rank,          processed as proc from dist,        (select @rank13:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as distrun  using (rank) ";
     2002        $sql.= " join (select @rank14:=@rank14+1 AS rank,          processed as proc from pub,         (select @rank14:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and dbname like '$proj') as pubrun   using (rank);";
     2003 
     2004        // define last process and total process
     2005        list($lastproc1 , $sumproc1 ) = array(-1, 0);
     2006        list($lastproc2 , $sumproc2 ) = array(-1, 0);
     2007        list($lastproc3 , $sumproc3 ) = array(-1, 0);
     2008        list($lastproc4 , $sumproc4 ) = array(-1, 0);
     2009        list($lastproc5 , $sumproc5 ) = array(-1, 0);
     2010        list($lastproc6 , $sumproc6 ) = array(-1, 0);
     2011        list($lastproc7 , $sumproc7 ) = array(-1, 0);
     2012        list($lastproc8 , $sumproc8 ) = array(-1, 0);
     2013        list($lastproc9 , $sumproc9 ) = array(-1, 0);
     2014        list($lastproc10, $sumproc10) = array(-1, 0);
     2015
     2016        // query from czardb 
     2017        if ($debug) {echo "$sql<br>";}
     2018        $qry = $db->query($sql);
     2019        if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
     2020        // define plot title
     2021        //$plottitle = "title: 'Items + N x 30 offset',";
     2022        $plottitle = "title: 'Items',";
     2023
     2024        // loading all the data
     2025        while ($qry->fetchInto($row)) {
     2026          // get UTC time info.
     2027          $tsp = explode('.', $row[0]);
     2028
     2029          // get processing info. from all stages and get time series.
     2030          $thisproc1  = $row[1] ; list($thisproc1 , $lastproc1 , $sumproc1 ) = gettotalprocessed($thisproc1 , $lastproc1 , $sumproc1 ); // chip
     2031          $thisproc2  = $row[2] ; list($thisproc2 , $lastproc2 , $sumproc2 ) = gettotalprocessed($thisproc2 , $lastproc2 , $sumproc2 ); // cam
     2032          $thisproc3  = $row[3] ; list($thisproc3 , $lastproc3 , $sumproc3 ) = gettotalprocessed($thisproc3 , $lastproc3 , $sumproc3 ); // fake
     2033          $thisproc4  = $row[4] ; list($thisproc4 , $lastproc4 , $sumproc4 ) = gettotalprocessed($thisproc4 , $lastproc4 , $sumproc4 ); // warp
     2034          $thisproc5  = $row[5] ; list($thisproc5 , $lastproc5 , $sumproc5 ) = gettotalprocessed($thisproc5 , $lastproc5 , $sumproc5 ); // stack
     2035          $thisproc6  = $row[6] ; list($thisproc6 , $lastproc6 , $sumproc6 ) = gettotalprocessed($thisproc6 , $lastproc6 , $sumproc6 ); // staticsky
     2036          $thisproc7  = $row[7] ; list($thisproc7 , $lastproc7 , $sumproc7 ) = gettotalprocessed($thisproc7 , $lastproc7 , $sumproc7 ); // diff
     2037          $thisproc8  = $row[8] ; list($thisproc8 , $lastproc8 , $sumproc8 ) = gettotalprocessed($thisproc8 , $lastproc8 , $sumproc8 ); // fullforce
     2038          $thisproc9  = $row[9] ; list($thisproc9 , $lastproc9 , $sumproc9 ) = gettotalprocessed($thisproc9 , $lastproc9 , $sumproc9 ); // dist
     2039          $thisproc10 = $row[10]; list($thisproc10, $lastproc10, $sumproc10) = gettotalprocessed($thisproc10, $lastproc10, $sumproc10); // pub
     2040
     2041          // get HST time info.
     2042          $hsttime  = $row[11];
     2043
     2044          // data content
     2045          echo "[new Date($tsp[0], $tsp[1]-1, $tsp[2], $tsp[3], $tsp[4], $tsp[5]), ";
     2046          echo "$sumproc1 , \"<i><b>$hsttime (HST) $sumproc1  chip      </i></b> \", "; //+ 3*30 chip
     2047          echo "$sumproc2 , \"<i><b>$hsttime (HST) $sumproc2  cam       </i></b> \", "; //+ 2*30 cam
     2048          echo "$sumproc3 , \"<i><b>$hsttime (HST) $sumproc3  fake      </i></b> \", "; //+ 1*30 fake
     2049          echo "$sumproc4 , \"<i><b>$hsttime (HST) $sumproc4  warp      </i></b> \", "; //+ 0*30 warp
     2050          echo "$sumproc5 , \"<i><b>$hsttime (HST) $sumproc5  stack     </i></b> \", "; //+ 0*30 stack
     2051          echo "$sumproc6 , \"<i><b>$hsttime (HST) $sumproc6  staticsky </i></b> \", "; //+ 0*30 staticsky
     2052          echo "$sumproc7 , \"<i><b>$hsttime (HST) $sumproc7  diff      </i></b> \", "; //+ 6*30 diff
     2053          echo "$sumproc8 , \"<i><b>$hsttime (HST) $sumproc8  fullforce </i></b> \", "; //+ 0*30 fullforce
     2054          echo "$sumproc9 , \"<i><b>$hsttime (HST) $sumproc9  dist      </i></b> \", "; //+ 5*30 dist
     2055          echo "$sumproc10, \"<i><b>$hsttime (HST) $sumproc10 pub       </i></b> \"  "; //+ 4*30 pub
     2056          echo "],";
     2057        }
     2058      } 
     2059    } else {
     2060      // selected stages and selected label
     2061      $plottitle = "title: 'Items',";
     2062      $plotseries  = "    series: { 0: { color: '#33a532', lineWidth: 3 }, ";   // traffic light green code
     2063      $plotseries .= "              1: { color: '#e7b416', lineWidth: 3 }, ";   // traffic light yellow code
     2064      $plotseries .= "              2: { color: '#cc3232', lineWidth: 3 }, },"; // traffic light red code
     2065      $plotstage = $selectedStage;
     2066
     2067      // data header
     2068      echo "   data.addColumn('datetime', 'Time');";
     2069      echo "   data.addColumn('number', 'Processed'); data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2070      echo "   data.addColumn('number', 'Pending')  ; data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2071      echo "   data.addColumn('number', 'Faults')   ; data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2072      echo "   data.addRows([";
     2073
     2074      //  query data from czardb
     2075      $sql = "select date_format(addtime(timestamp, '10:00:00'), \"%Y.%m.%d.%H.%i.%s\") as dated, processed, pending, faults, timestamp "
     2076            ."from $selectedStage where dbname like '$proj' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day) "
     2077            ."and (timestamp < utc_date() + INTERVAL 14 hour + interval $dayshift day) and label like '$selectedLabel';";
     2078      if ($debug) {echo "$sql<br>";}
     2079      $qry = $db->query($sql);
     2080      if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
     2081
     2082      // define last process and total process
     2083      list($lastproc, $sumproc) = array(-1, 0);
     2084      while ($qry->fetchInto($row)) {
     2085        // get UTC time info.
     2086        $tsp = explode('.', $row[0]);
     2087        $pending  = $row[2];
     2088        $faults   = $row[3];
     2089
     2090        // get HST time info.
     2091        $hsttime  = $row[4];
     2092
     2093        // get processing info. from selected stages and get time series.
     2094        $thisproc = $row[1]; list($thisproc, $lastproc, $sumproc) = gettotalprocessed($thisproc, $lastproc, $sumproc);
     2095        if ($pending < 200 & $faults < 200) {
     2096          echo "[new Date($tsp[0], $tsp[1]-1, $tsp[2], $tsp[3], $tsp[4], $tsp[5]), ";
     2097          echo "$sumproc, \"<i><b>$hsttime (HST) $sumproc $selectedStage processed </i></b> \", ";
     2098          echo "$pending, \"<i><b>$hsttime (HST) $pending $selectedStage pendings  </i></b> \", ";
     2099          echo "$faults , \"<i><b>$hsttime (HST) $faults  $selectedStage faults    </i></b> \" ], ";
     2100        } else {
     2101          echo "[new Date($tsp[0], $tsp[1]-1, $tsp[2], $tsp[3], $tsp[4], $tsp[5]), ";
     2102          echo "$sumproc, \"<i><b>$hsttime (HST) $sumproc $selectedStage processed </i></b> \", ";
     2103          echo "0,        \"<i><b>$hsttime (HST) $pending $selectedStage pendings  </i></b> \", ";
     2104          echo "0 ,       \"<i><b>$hsttime (HST) $faults  $selectedStage faults    </i></b> \" ], ";
     2105        }
     2106      }
     2107    }
     2108    // data content end
     2109    echo "  ]);";
     2110   
     2111    // define x-axis range in terms of UTC from 0 to current time
     2112    $utcyy = gmdate("Y", strtotime("$dayshift day"));
     2113    $utcmm = gmdate("m", strtotime("$dayshift day"));
     2114    $utcdd = gmdate("d", strtotime("$dayshift day"));
     2115    if ($dayshift != 0) {
     2116      $utchh = 23;
     2117      $utcmn = 59;
     2118    } else {
     2119      $utchh = gmdate("H", strtotime("$dayshift day"));
     2120      $utcmn = gmdate("i", strtotime("$dayshift day"));
     2121    }
     2122
     2123    // linear plot options
     2124    echo " var opt_linear = {
     2125      title: 'Processed Items: $plotstage stages for $plotlabel labels on $proj',
     2126      titleTextStyle: {color: 'black', fontSize: 16},
     2127      width:  640, height: 400, fontSize: 12,
     2128      legend: { position: 'top', maxLines: 3 },
     2129      chartArea: {left:60, top:70, right:20, bottom:40},
     2130      tooltip: {isHtml: true},
     2131      hAxis: { 
     2132        title: 'Time on $utcyy-$utcmm-$utcdd (UTC)',
     2133        format: 'HH:mm',
     2134        gridlines: {count: -1},
     2135        viewWindow: {
     2136          min: new Date($utcyy, $utcmm-1, $utcdd, 0, 0, 0),
     2137          max: new Date($utcyy, $utcmm-1, $utcdd, $utchh, $utcmn)
     2138        }, 
     2139      },
     2140      vAxis: { 
     2141        title: 'Items',
     2142        gridlines: {count: -1},
     2143        viewWindow: {
     2144          min: 0.1
     2145        }, 
     2146      },
     2147      $plotseries
     2148    };";
     2149 
     2150    // draw linear function
     2151    echo "      function drawLinearChart() { ";
     2152    // for separately plot
     2153    # echo "        var linearChart = new google.visualization.LineChart(time_series_div_lin);";
     2154    echo "        var linearChart = new google.visualization.LineChart(time_series_div);";
     2155    echo "        linearChart.draw(data, opt_linear);";
     2156    echo "        button.innerText = 'Change y-axis to Log scale'  ; ";
     2157    echo "        button.onclick = drawLogChart; ";
     2158    echo "      } ";
     2159 
     2160    // log scale options
     2161    echo " var opt_log = {
     2162      title: 'Processed Items: $plotstage stages for $plotlabel labels on $proj',
     2163      titleTextStyle: {color: 'black', fontSize: 16},
     2164      width:  640, height: 400, fontSize: 12,
     2165      legend: { position: 'top', maxLines: 3 },
     2166      chartArea: {left:60, top:70, right:20, bottom:40},
     2167      tooltip: {isHtml: true},
     2168      hAxis: { 
     2169        title: 'Time on $utcyy-$utcmm-$utcdd (UTC)',
     2170        format: 'HH:mm',
     2171        gridlines: {count: -1},
     2172        viewWindow: {
     2173          min: new Date($utcyy, $utcmm-1, $utcdd, 0, 0, 0),
     2174          max: new Date($utcyy, $utcmm-1, $utcdd, $utchh, $utcmn)
     2175        }, 
     2176      },
     2177      vAxis: { 
     2178        title: 'Log(Items)',
     2179        scaleType: 'log',
     2180        gridlines: {count: -1},
     2181        viewWindow: {
     2182          min: 0.1
     2183        }, 
     2184      },
     2185      $plotseries
     2186    };";
     2187 
     2188    // draw log function
     2189    echo "      function drawLogChart() { ";
     2190    // for separately plot
     2191    #echo "        var logChart    = new google.visualization.LineChart(time_series_div_log);";
     2192    echo "        var logChart    = new google.visualization.LineChart(time_series_div);";
     2193    echo "        logChart.draw(data,       opt_log);";
     2194    echo "        button.innerText = 'Change y-axis to Linear scale';";
     2195    echo "        button.onclick = drawLinearChart; ";
     2196    echo "      } ";
     2197 
     2198    // default plot in linear scale
     2199    echo "   drawLinearChart(); ";
     2200    #echo "   drawLogChart(); ";
     2201    echo " }";
     2202 
     2203    // end javascript
     2204    echo "</script>";
     2205 
     2206    // timer end
     2207    $time = microtime();
     2208    $time = explode(' ', $time);
     2209    $time = $time[1] + $time[0];
     2210    $finish = $time;
     2211    $total_time = round(($finish - $start), 3);
     2212    $start= $finish;
     2213    echo "<center>loading in $total_time seconds</center>";
     2214}
     2215
     2216// sub function to find total processed items
     2217function gettotalprocessed ($thisProcessed, $lastProcessed, $totalProcessed) {
     2218  if($thisProcessed > $lastProcessed & $lastProcessed != -1) {
     2219      if ($thisProcessed - $lastProcessed < 50) {
     2220          $totalProcessed = $totalProcessed + $thisProcessed - $lastProcessed;
     2221      } else {
     2222          $totalProcessed = $totalProcessed;
     2223      }
     2224  }
     2225  $lastProcessed = $thisProcessed;
     2226  return array($thisProcessed, $lastProcessed, $totalProcessed);
     2227}
     2228
     2229###########################################################################
     2230#
     2231# Gets rate series plot
     2232#
     2233###########################################################################
     2234function Getrate($db, $selectedMode, $selectedLabel, $proj, $selectedStage) {
     2235    // timer start
     2236    $time = microtime();
     2237    $time = explode(' ', $time);
     2238    $time = $time[1] + $time[0];
     2239    $start = $time;
     2240
     2241    #echo "<script type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"></script>";
     2242    echo "<script type=\"text/javascript\" src=\"loader.js\"></script>";
     2243    echo "<br><div id=\"rate_series_div\" style=\"width:640; height:400\"></div>";
     2244
     2245    echo "<script type=\"text/javascript\">";
     2246    echo "google.charts.load('current', {packages: ['corechart']});";
     2247    echo "google.charts.setOnLoadCallback(drawChart);";
     2248    // draw funciton start
     2249    echo "function drawChart() {";
     2250    echo "  var data = new google.visualization.DataTable();";
     2251
     2252    if ($selectedLabel == "all") {
     2253       $selectedLabel = "stdscience_labels";
     2254       $plotlabel = "all"; }
     2255    else {
     2256       $plotlabel = $selectedLabel;
     2257    }
     2258
     2259    $dayshift = -0;
     2260    $binsize = 30; // 30 mins gap
     2261    $bshift  = 5; // 10 mins step
     2262    $difflimit = 100; // diff items limit for a time interval
     2263    $plotscale = 50; // diff items limit for a time interval
     2264    if ($selectedStage == "all_stages") {
     2265      $plotstage = "all";
     2266      $plottitle = "title: 'Items per hour + N x 50 offset',";
     2267      $plotseries  = "    series: { 0: { color: '#a6cee3' , lineWidth: 2                       }, ";
     2268      $plotseries .= "              1: { color: '#1f78b4' , lineWidth: 2                       }, ";
     2269      $plotseries .= "              2: { color: '#fb9a99' , lineWidth: 2, lineDashStyle: [8, 4]}, ";
     2270      $plotseries .= "              3: { color: '#e31a1c' , lineWidth: 2                       }, ";
     2271      $plotseries .= "              4: { color: '#33a02c' , lineWidth: 2                       }, ";
     2272      $plotseries .= "              5: { color: '#b2df8a' , lineWidth: 2, lineDashStyle: [8, 4]}, ";
     2273      $plotseries .= "              6: { color: '#ff7f00' , lineWidth: 2                       }, ";
     2274      $plotseries .= "              7: { color: '#fdbf6f' , lineWidth: 2, lineDashStyle: [8, 4]}, ";
     2275      $plotseries .= "              8: { color: '#cab2d6' , lineWidth: 2                       }, ";
     2276      $plotseries .= "              9: { color: '#6a3d9a' , lineWidth: 2                       }, ";
     2277      $plotseries .= "             10: { color: 'cyan'    , lineWidth: 2, lineDashStyle: [3, 4]}, ";
     2278      $plotseries .= "             11: { color: '#c51b7d' , lineWidth: 2, lineDashStyle: [3, 4]}, ";
     2279      $plotseries .= "             12: { color: '#b15928' , lineWidth: 2, lineDashStyle: [3, 4]}, ";
     2280      $plotseries .= "             13: { color: '#000004' , lineWidth: 2, lineDashStyle: [3, 4]}, },";
     2281      if ($selectedLabel == "stdscience_labels") {
     2282        echo "  data.addColumn('datetime',        'Time');";
     2283        echo "  data.addColumn(  'number',        'chip');";
     2284        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2285        echo "  data.addColumn(  'number',         'cam');";
     2286        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2287        echo "  data.addColumn(  'number',        'fake');";
     2288        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2289        echo "  data.addColumn(  'number',        'warp');";
     2290        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2291        echo "  data.addColumn(  'number',       'stack');";
     2292        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2293        echo "  data.addColumn(  'number',   'staticsky');";
     2294        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2295        echo "  data.addColumn(  'number',        'diff');";
     2296        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2297        echo "  data.addColumn(  'number',   'fullforce');";
     2298        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2299        echo "  data.addColumn(  'number',        'dist');";
     2300        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2301        echo "  data.addColumn(  'number',         'pub');";
     2302        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2303        echo "  data.addColumn(  'number',   'summitExp');";
     2304        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2305        echo "  data.addColumn(  'number', 'downloadExp');";
     2306        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2307        echo "  data.addColumn(  'number',      'newExp');";
     2308        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2309        echo "  data.addColumn(  'number',      'rawExp');";
     2310        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2311        echo "   data.addRows([";
     2312
     2313      $datemin  = -$dayshift*1440+gmdate("H")*60+gmdate("i");
     2314      for ($t_i = 0; $t_i <= $datemin/$bshift; $t_i++) {
     2315        $sql = "select date_format(addtime(timestamp, '10:00:00'), \"%Y.%m.%d.%H.%i.%s\") as dated, chiprun.proc as chipproc, camrun.proc as camproc, fakerun.proc as fakeproc, warprun.proc as warpproc, stackrun.proc as stackproc, statrun.proc as statproc, diffrun.proc as diffproc, ffrun.proc as ffproc, distrun.proc as distproc, pubrun.proc as pubproc, summrun.proc as sumproc, downrun.proc as downproc, newrun.proc as newproc, rawrun.proc as rawproc, timestamp";
     2316        $sql.= " from (select @rank1:=@rank1+1 AS rank, timestamp, processed as proc from rawExp   ,   (select @rank1:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as rawrun                ";
     2317        $sql.= " join (select @rank2:=@rank2+1 AS rank,            processed as proc from newExp   ,   (select @rank2:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as newrun   using (rank) ";
     2318        $sql.= " join (select @rank3:=@rank3+1 AS rank,            processed as proc from summitExp,   (select @rank3:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as summrun  using (rank) ";
     2319        $sql.= " join (select @rank4:=@rank4+1 AS rank,            processed as proc from downloadExp, (select @rank4:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as downrun  using (rank) ";
     2320        $sql.= " join (select @rank5:=@rank5+1 AS rank,            processed as proc from chip,        (select @rank5:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as chiprun  using (rank) ";
     2321        $sql.= " join (select @rank6:=@rank6+1 AS rank,            processed as proc from cam,         (select @rank6:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as camrun   using (rank) ";
     2322        $sql.= " join (select @rank7:=@rank7+1 AS rank,            processed as proc from fake,        (select @rank7:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as fakerun  using (rank) ";
     2323        $sql.= " join (select @rank8:=@rank8+1 AS rank,            processed as proc from cam,         (select @rank8:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as warprun  using (rank) ";
     2324        $sql.= " join (select @rank9:=@rank9+1 AS rank,            processed as proc from stack,       (select @rank9:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as stackrun using (rank) ";
     2325        $sql.= " join (select @rank10:=@rank10+1 AS rank,          processed as proc from staticsky,   (select @rank10:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as statrun  using (rank) ";
     2326        $sql.= " join (select @rank11:=@rank11+1 AS rank,          processed as proc from diff,        (select @rank11:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as diffrun  using (rank) ";
     2327        $sql.= " join (select @rank12:=@rank12+1 AS rank,          processed as proc from fullforce,   (select @rank12:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as ffrun    using (rank) ";
     2328        $sql.= " join (select @rank13:=@rank13+1 AS rank,          processed as proc from dist,        (select @rank13:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as distrun  using (rank) ";
     2329        $sql.= " join (select @rank14:=@rank14+1 AS rank,          processed as proc from pub,         (select @rank14:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as pubrun   using (rank) order by timestamp limit 1;";
     2330        $qry = $db->query($sql);
     2331        $qry->fetchInto($row);
     2332        list($tstamp, $chipproc0, $camproc0, $fakeproc0, $warpproc0, $stackproc0, $statproc0, $diffproc0, $ffproc0, $distproc0, $pubproc0, $sumproc0, $downproc0, $newproc0, $rawproc0, $hsttime) = $row;
     2333//        $tsp = explode('.', $tstamp);
     2334 
     2335        $sql = "select date_format(addtime(timestamp, '10:00:00'), \"%Y.%m.%d.%H.%i.%s\") as dated, chiprun.proc as chipproc, camrun.proc as camproc, fakerun.proc as fakeproc, warprun.proc as warpproc, stackrun.proc as stackproc, statrun.proc as statproc, diffrun.proc as diffproc, ffrun.proc as ffproc, distrun.proc as distproc, pubrun.proc as pubproc, summrun.proc as sumproc, downrun.proc as downproc, newrun.proc as newproc, rawrun.proc as rawproc, timestamp";
     2336        $sql.= " from (select @rank1:=@rank1+1 AS rank, timestamp, processed as proc from rawExp   ,   (select @rank1:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as rawrun                ";
     2337        $sql.= " join (select @rank2:=@rank2+1 AS rank,            processed as proc from newExp   ,   (select @rank2:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as newrun   using (rank) ";
     2338        $sql.= " join (select @rank3:=@rank3+1 AS rank,            processed as proc from summitExp,   (select @rank3:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as summrun  using (rank) ";
     2339        $sql.= " join (select @rank4:=@rank4+1 AS rank,            processed as proc from downloadExp, (select @rank4:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as downrun  using (rank) ";
     2340        $sql.= " join (select @rank5:=@rank5+1 AS rank,            processed as proc from chip,        (select @rank5:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as chiprun  using (rank) ";
     2341        $sql.= " join (select @rank6:=@rank6+1 AS rank,            processed as proc from cam,         (select @rank6:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as camrun   using (rank) ";
     2342        $sql.= " join (select @rank7:=@rank7+1 AS rank,            processed as proc from fake,        (select @rank7:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as fakerun  using (rank) ";
     2343        $sql.= " join (select @rank8:=@rank8+1 AS rank,            processed as proc from cam,         (select @rank8:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as warprun  using (rank) ";
     2344        $sql.= " join (select @rank9:=@rank9+1 AS rank,            processed as proc from stack,       (select @rank9:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as stackrun using (rank) ";
     2345        $sql.= " join (select @rank10:=@rank10+1 AS rank,          processed as proc from staticsky,   (select @rank10:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as statrun  using (rank) ";
     2346        $sql.= " join (select @rank11:=@rank11+1 AS rank,          processed as proc from diff,        (select @rank11:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as diffrun  using (rank) ";
     2347        $sql.= " join (select @rank12:=@rank12+1 AS rank,          processed as proc from fullforce,   (select @rank12:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as ffrun    using (rank) ";
     2348        $sql.= " join (select @rank13:=@rank13+1 AS rank,          processed as proc from dist,        (select @rank13:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as distrun  using (rank) ";
     2349        $sql.= " join (select @rank14:=@rank14+1 AS rank,          processed as proc from pub,         (select @rank14:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as pubrun   using (rank) order by timestamp desc limit 1;";
     2350        $qry = $db->query($sql);
     2351        $qry->fetchInto($row);
     2352        list($tstamp, $chipproc1, $camproc1, $fakeproc1, $warpproc1, $stackproc1, $statproc1, $diffproc1, $ffproc1, $distproc1, $pubproc1, $sumproc1, $downproc1, $newproc1, $rawproc1, $hsttime) = $row;
     2353        list( $chip_diff,  $chip_rate) = getprocrate( $chipproc1 ,  $chipproc0, $binsize);
     2354        list(  $cam_diff,   $cam_rate) = getprocrate(  $camproc1 ,   $camproc0, $binsize);
     2355        list( $fake_diff,  $fake_rate) = getprocrate( $fakeproc1 ,  $fakeproc0, $binsize);
     2356        list( $warp_diff,  $warp_rate) = getprocrate( $warpproc1 ,  $warpproc0, $binsize);
     2357        list($stack_diff, $stack_rate) = getprocrate($stackproc1 , $stackproc0, $binsize);
     2358        list( $stat_diff,  $stat_rate) = getprocrate( $statproc1 ,  $statproc0, $binsize);
     2359        list( $diff_diff,  $diff_rate) = getprocrate( $diffproc1 ,  $diffproc0, $binsize);
     2360        list(   $ff_diff,    $ff_rate) = getprocrate(   $ffproc1 ,    $ffproc0, $binsize);
     2361        list( $dist_diff,  $dist_rate) = getprocrate( $distproc1 ,  $distproc0, $binsize);
     2362        list(  $pub_diff,   $pub_rate) = getprocrate(  $pubproc1 ,   $pubproc0, $binsize);
     2363        list(  $raw_diff,   $raw_rate) = getprocrate(  $rawproc1 ,   $rawproc0, $binsize);
     2364        list(  $new_diff,   $new_rate) = getprocrate(  $newproc1 ,   $newproc0, $binsize);
     2365        list(  $sum_diff,   $sum_rate) = getprocrate(  $sumproc1 ,   $sumproc0, $binsize);
     2366        list( $down_diff,  $down_rate) = getprocrate( $downproc1 ,  $downproc0, $binsize);
     2367
     2368        $sql = "select date_format(addtime(timestamp, '10:00:00'), \"%Y.%m.%d\"), time_format(sec_to_time(avg(time_to_sec(timestamp)) - 14*3600 ), \"%H.%i.%s\"), date_format(timestamp, \"%Y-%m-%d\"), time_format(sec_to_time(avg(time_to_sec(timestamp))), \"%H:%i:%s\") from rawExp where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj'";
     2369        $qry = $db->query($sql);
     2370        $qry->fetchinto($row);
     2371        list($datestamp, $timestamp, $hstdate, $hsttime) = $row;
     2372        $dsp = explode('.', $datestamp);
     2373        $tsp = explode('.', $timestamp);
     2374
     2375        $utcyy = gmdate("Y", strtotime("$dayshift day"));
     2376        $utcmm = gmdate("m", strtotime("$dayshift day"));
     2377        $utcdd = gmdate("d", strtotime("$dayshift day"));
     2378        $utchh = floor($t_i*$bshift/60);
     2379        $utcmn = $t_i*$bshift % 60;
     2380        $hstdatetime = date("Y-m-d H:i", strtotime($utcyy."-".$utcmm."-".$utcdd." ".$utchh.":".$utcmn.":00"." UTC"));
     2381        if ($row[0] != NULL & $dsp[2] == $utcdd) {
     2382          if ($chip_diff < 0 || $cam_diff < 0 || $fake_diff < 0 || $warp_diff < 0 || $stack_diff < 0 || $stat_diff < 0 || $diff_diff < 0 || $ff_diff < 0 || $dist_diff < 0 || $pub_diff < 0 || $raw_diff < 0 || $new_diff < 0 || $sum_diff < 0 || $down_idff < 0 || $chip_diff > $difflimit || $cam_diff > $difflimit || $fake_diff > $difflimit || $warp_diff > $difflimit || $stack_diff > $difflimit || $stat_diff > $difflimit || $diff_diff > $difflimit || $ff_diff > $difflimit || $dist_diff > $difflimit || $pub_diff > $difflimit || $raw_diff > $difflimit || $new_diff > $difflimit || $sum_diff > $difflimit || $down_idff > $difflimit) {
     2383//            echo "[new Date($tsp[0], $tsp[1]-1, $tsp[2], $tsp[3], $tsp[4]), ";
     2384            echo "[new Date($utcyy, $utcmm-1, $utcdd, $utchh, $utcmn), ";
     2385            echo " 0, \"<i><b>$hstdatetime (HST) 0 chip/hr       </i></b>\", "; //+10*50 chip
     2386            echo " 0, \"<i><b>$hstdatetime (HST) 0 cam/hr        </i></b>\", "; //+ 9*50 cam
     2387            echo " 0, \"<i><b>$hstdatetime (HST) 0 fake/hr       </i></b>\", "; //+ 8*50 fake
     2388            echo " 0, \"<i><b>$hstdatetime (HST) 0 warp/hr       </i></b>\", "; //+ 7*50 warp
     2389            echo " 0, \"<i><b>$hstdatetime (HST) 0 stack/hr      </i></b>\", "; //+ 0*50 stack
     2390            echo " 0, \"<i><b>$hstdatetime (HST) 0 staticsky/hr  </i></b>\", "; //+ 0*50 staticsky
     2391            echo " 0, \"<i><b>$hstdatetime (HST) 0 diff/hr       </i></b>\", "; //+ 6*50 diff
     2392            echo " 0, \"<i><b>$hstdatetime (HST) 0 fullforce/hr  </i></b>\", "; //+ 0*50 fullforce
     2393            echo " 0, \"<i><b>$hstdatetime (HST) 0 dist/hr       </i></b>\", "; //+ 5*50 dist
     2394            echo " 0, \"<i><b>$hstdatetime (HST) 0 pub/hr        </i></b>\", "; //+ 4*50 pub
     2395            echo " 0, \"<i><b>$hstdatetime (HST) 0 summitExp/hr  </i></b>\", "; //+ 3*50 summitExp
     2396            echo " 0, \"<i><b>$hstdatetime (HST) 0 downloadExp/hr</i></b>\", "; //+ 2*50 downloadExp
     2397            echo " 0, \"<i><b>$hstdatetime (HST) 0 newExp/hr     </i></b>\", "; //+ 1*50 newExp
     2398            echo " 0, \"<i><b>$hstdatetime (HST) 0 rawExp/hr     </i></b>\", "; //+ 0*50 rawExp
     2399            echo "],";
     2400//            echo "], $t_i, <br>";
     2401          } else {
     2402//            echo "[new Date($tsp[0], $tsp[1]-1, $tsp[2], $tsp[3], $tsp[4], $tsp[5]), ";
     2403            echo "[new Date($utcyy, $utcmm-1, $utcdd, $utchh, $utcmn), ";
     2404            echo "  $chip_rate, \"<i><b>$hstdatetime (HST)  $chip_rate  chip/hr       </i></b> \", "; //+10*50 chip
     2405            echo "   $cam_rate, \"<i><b>$hstdatetime (HST)   $cam_rate  cam/hr        </i></b> \", "; //+ 9*50 cam
     2406            echo "  $fake_rate, \"<i><b>$hstdatetime (HST)  $fake_rate  fake/hr       </i></b> \", "; //+ 8*50 fake
     2407            echo "  $warp_rate, \"<i><b>$hstdatetime (HST)  $warp_rate  warp/hr       </i></b> \", "; //+ 7*50 warp
     2408            echo " $stack_rate, \"<i><b>$hstdatetime (HST) $stack_rate  stack/hr      </i></b> \", "; //+ 0*50 stack
     2409            echo "  $stat_rate, \"<i><b>$hstdatetime (HST)  $stat_rate  staticsky/hr  </i></b> \", "; //+ 0*50 staticsky
     2410            echo "  $diff_rate, \"<i><b>$hstdatetime (HST)  $diff_rate  diff/hr       </i></b> \", "; //+ 6*50 diff
     2411            echo "    $ff_rate, \"<i><b>$hstdatetime (HST)    $ff_rate  fullforce/hr  </i></b> \", "; //+ 0*50 fullforce
     2412            echo "  $dist_rate, \"<i><b>$hstdatetime (HST)  $dist_rate  dist/hr       </i></b> \", "; //+ 5*50 dist
     2413            echo "   $pub_rate, \"<i><b>$hstdatetime (HST)   $pub_rate  pub/hr        </i></b> \", "; //+ 4*50 pub
     2414            echo "   $sum_rate, \"<i><b>$hstdatetime (HST)   $sum_rate  summitExp/hr  </i></b> \", "; //+ 3*50 summitExp
     2415            echo "  $down_rate, \"<i><b>$hstdatetime (HST)  $down_rate  downloadExp/hr</i></b> \", "; //+ 2*50 downloadExp
     2416            echo "   $new_rate, \"<i><b>$hstdatetime (HST)   $new_rate  newExp/hr     </i></b> \", "; //+ 1*50 newExp
     2417            echo "   $raw_rate, \"<i><b>$hstdatetime (HST)   $raw_rate  rawExp/hr     </i></b> \", "; //+ 0*50 rawExp
     2418            echo "],";
     2419//            echo "], $t_i, <br>";
     2420          }
     2421        } else {
     2422            echo "[new Date($utcyy, $utcmm-1, $utcdd, $utchh, $utcmn), ";
     2423            echo " 0, \"<i><b>$hstdatetime (HST) 0 chip/hr       </i></b>\", "; //+10*50 chip
     2424            echo " 0, \"<i><b>$hstdatetime (HST) 0 cam/hr        </i></b>\", "; //+ 9*50 cam
     2425            echo " 0, \"<i><b>$hstdatetime (HST) 0 fake/hr       </i></b>\", "; //+ 8*50 fake
     2426            echo " 0, \"<i><b>$hstdatetime (HST) 0 warp/hr       </i></b>\", "; //+ 7*50 warp
     2427            echo " 0, \"<i><b>$hstdatetime (HST) 0 stack/hr      </i></b>\", "; //+ 0*50 stack
     2428            echo " 0, \"<i><b>$hstdatetime (HST) 0 staticsky/hr  </i></b>\", "; //+ 0*50 staticsky
     2429            echo " 0, \"<i><b>$hstdatetime (HST) 0 diff/hr       </i></b>\", "; //+ 6*50 diff
     2430            echo " 0, \"<i><b>$hstdatetime (HST) 0 fullforce/hr  </i></b>\", "; //+ 0*50 fullforce
     2431            echo " 0, \"<i><b>$hstdatetime (HST) 0 dist/hr       </i></b>\", "; //+ 5*50 dist
     2432            echo " 0, \"<i><b>$hstdatetime (HST) 0 pub/hr        </i></b>\", "; //+ 4*50 pub
     2433            echo " 0, \"<i><b>$hstdatetime (HST) 0 summitExp/hr  </i></b>\", "; //+ 3*50 summitExp
     2434            echo " 0, \"<i><b>$hstdatetime (HST) 0 downloadExp/hr</i></b>\", "; //+ 2*50 downloadExp
     2435            echo " 0, \"<i><b>$hstdatetime (HST) 0 newExp/hr     </i></b>\", "; //+ 1*50 newExp
     2436            echo " 0, \"<i><b>$hstdatetime (HST) 0 rawExp/hr     </i></b>\", "; //+ 0*50 rawExp
     2437            echo "],";
     2438//            echo "], $t_i, <br>";
     2439        }
     2440       }
     2441      }
     2442      else {
     2443        $plottitle = "title: 'Items per hour + N x 50 offset',";
     2444        $plotseries  = "    series: { 0: { color: '#a6cee3' , lineWidth: 2                       }, ";
     2445        $plotseries .= "              1: { color: '#1f78b4' , lineWidth: 2                       }, ";
     2446        $plotseries .= "              2: { color: '#fb9a99' , lineWidth: 2, lineDashStyle: [8, 4]}, ";
     2447        $plotseries .= "              3: { color: '#e31a1c' , lineWidth: 2                       }, ";
     2448        $plotseries .= "              4: { color: '#33a02c' , lineWidth: 2                       }, ";
     2449        $plotseries .= "              5: { color: '#b2df8a' , lineWidth: 2, lineDashStyle: [8, 4]}, ";
     2450        $plotseries .= "              6: { color: '#ff7f00' , lineWidth: 2                       }, ";
     2451        $plotseries .= "              7: { color: '#fdbf6f' , lineWidth: 2, lineDashStyle: [8, 4]}, ";
     2452        $plotseries .= "              8: { color: '#cab2d6' , lineWidth: 2                       }, ";
     2453        $plotseries .= "              9: { color: '#6a3d9a' , lineWidth: 2                       }, },";
     2454        echo "  data.addColumn('datetime',        'Time');";
     2455        echo "  data.addColumn(  'number',        'chip');";
     2456        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2457        echo "  data.addColumn(  'number',         'cam');";
     2458        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2459        echo "  data.addColumn(  'number',        'fake');";
     2460        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2461        echo "  data.addColumn(  'number',        'warp');";
     2462        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2463        echo "  data.addColumn(  'number',       'stack');";
     2464        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2465        echo "  data.addColumn(  'number',   'staticsky');";
     2466        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2467        echo "  data.addColumn(  'number',        'diff');";
     2468        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2469        echo "  data.addColumn(  'number',   'fullforce');";
     2470        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2471        echo "  data.addColumn(  'number',        'dist');";
     2472        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2473        echo "  data.addColumn(  'number',         'pub');";
     2474        echo "  data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2475        echo "   data.addRows([";
     2476 
     2477      $datemin  = -$dayshift*1440+gmdate("H")*60+gmdate("i");
     2478      for ($t_i = 0; $t_i <= $datemin/$bshift; $t_i++) {
     2479        $sql = "select date_format(addtime(timestamp, '10:00:00'), \"%Y.%m.%d.%H.%i.%s\") as dated, chiprun.proc as chipproc, camrun.proc as camproc, fakerun.proc as fakeproc, warprun.proc as warpproc, stackrun.proc as stackproc, statrun.proc as statproc, diffrun.proc as diffproc, ffrun.proc as ffproc, distrun.proc as distproc, pubrun.proc as pubproc, timestamp";
     2480        $sql.= " from (select @rank1:=@rank1+1 AS rank, timestamp, processed as proc from chip,        (select @rank1:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as chiprun              ";
     2481        $sql.= " join (select @rank6:=@rank6+1 AS rank,            processed as proc from cam,         (select @rank6:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as camrun   using (rank) ";
     2482        $sql.= " join (select @rank7:=@rank7+1 AS rank,            processed as proc from fake,        (select @rank7:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as fakerun  using (rank) ";
     2483        $sql.= " join (select @rank8:=@rank8+1 AS rank,            processed as proc from cam,         (select @rank8:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as warprun  using (rank) ";
     2484        $sql.= " join (select @rank9:=@rank9+1 AS rank,            processed as proc from stack,       (select @rank9:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as stackrun using (rank) ";
     2485        $sql.= " join (select @rank10:=@rank10+1 AS rank,          processed as proc from staticsky,   (select @rank10:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as statrun  using (rank) ";
     2486        $sql.= " join (select @rank11:=@rank11+1 AS rank,          processed as proc from diff,        (select @rank11:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as diffrun  using (rank) ";
     2487        $sql.= " join (select @rank12:=@rank12+1 AS rank,          processed as proc from fullforce,   (select @rank12:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as ffrun    using (rank) ";
     2488        $sql.= " join (select @rank13:=@rank13+1 AS rank,          processed as proc from dist,        (select @rank13:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as distrun  using (rank) ";
     2489        $sql.= " join (select @rank14:=@rank14+1 AS rank,          processed as proc from pub,         (select @rank14:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as pubrun   using (rank) order by timestamp limit 1;";
     2490        $qry = $db->query($sql);
     2491        $qry->fetchInto($row);
     2492        list($tstamp, $chipproc0, $camproc0, $fakeproc0, $warpproc0, $stackproc0, $statproc0, $diffproc0, $ffproc0, $distproc0, $pubproc0, $hsttime) = $row;
     2493 //       $tsp = explode('.', $tstamp);
     2494
     2495        $sql = "select date_format(addtime(timestamp, '10:00:00'), \"%Y.%m.%d.%H.%i.%s\") as dated, chiprun.proc as chipproc, camrun.proc as camproc, fakerun.proc as fakeproc, warprun.proc as warpproc, stackrun.proc as stackproc, statrun.proc as statproc, diffrun.proc as diffproc, ffrun.proc as ffproc, distrun.proc as distproc, pubrun.proc as pubproc, timestamp";
     2496        $sql.= " from (select @rank1:=@rank1+1 AS rank, timestamp, processed as proc from chip,        (select @rank1:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as chiprun              ";
     2497        $sql.= " join (select @rank6:=@rank6+1 AS rank,            processed as proc from cam,         (select @rank6:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as camrun   using (rank) ";
     2498        $sql.= " join (select @rank7:=@rank7+1 AS rank,            processed as proc from fake,        (select @rank7:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as fakerun  using (rank) ";
     2499        $sql.= " join (select @rank8:=@rank8+1 AS rank,            processed as proc from cam,         (select @rank8:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as warprun  using (rank) ";
     2500        $sql.= " join (select @rank9:=@rank9+1 AS rank,            processed as proc from stack,       (select @rank9:=0)  r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as stackrun using (rank) ";
     2501        $sql.= " join (select @rank10:=@rank10+1 AS rank,          processed as proc from staticsky,   (select @rank10:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as statrun  using (rank) ";
     2502        $sql.= " join (select @rank11:=@rank11+1 AS rank,          processed as proc from diff,        (select @rank11:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as diffrun  using (rank) ";
     2503        $sql.= " join (select @rank12:=@rank12+1 AS rank,          processed as proc from fullforce,   (select @rank12:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as ffrun    using (rank) ";
     2504        $sql.= " join (select @rank13:=@rank13+1 AS rank,          processed as proc from dist,        (select @rank13:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as distrun  using (rank) ";
     2505        $sql.= " join (select @rank14:=@rank14+1 AS rank,          processed as proc from pub,         (select @rank14:=0) r where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj') as pubrun   using (rank) order by timestamp desc limit 1;";
     2506        $qry = $db->query($sql);
     2507        $qry->fetchInto($row);
     2508        list($tstamp, $chipproc1, $camproc1, $fakeproc1, $warpproc1, $stackproc1, $statproc1, $diffproc1, $ffproc1, $distproc1, $pubproc1, $hsttime) = $row;
     2509        list( $chip_diff,  $chip_rate) = getprocrate( $chipproc1 ,  $chipproc0, $binsize);
     2510        list(  $cam_diff,   $cam_rate) = getprocrate(  $camproc1 ,   $camproc0, $binsize);
     2511        list( $fake_diff,  $fake_rate) = getprocrate( $fakeproc1 ,  $fakeproc0, $binsize);
     2512        list( $warp_diff,  $warp_rate) = getprocrate( $warpproc1 ,  $warpproc0, $binsize);
     2513        list($stack_diff, $stack_rate) = getprocrate($stackproc1 , $stackproc0, $binsize);
     2514        list( $stat_diff,  $stat_rate) = getprocrate( $statproc1 ,  $statproc0, $binsize);
     2515        list( $diff_diff,  $diff_rate) = getprocrate( $diffproc1 ,  $diffproc0, $binsize);
     2516        list(   $ff_diff,    $ff_rate) = getprocrate(   $ffproc1 ,    $ffproc0, $binsize);
     2517        list( $dist_diff,  $dist_rate) = getprocrate( $distproc1 ,  $distproc0, $binsize);
     2518        list(  $pub_diff,   $pub_rate) = getprocrate(  $pubproc1 ,   $pubproc0, $binsize);
     2519
     2520        $sql = "select date_format(addtime(timestamp, '10:00:00'), \"%Y.%m.%d\"), time_format(sec_to_time(avg(time_to_sec(timestamp)) - 14*3600 ), \"%H.%i.%s\"), date_format(timestamp, \"%Y-%m-%d\"), time_format(sec_to_time(avg(time_to_sec(timestamp))), \"%H:%i:%s\") from chip where label like '$selectedLabel' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and dbname like '$proj'";
     2521        $qry = $db->query($sql);
     2522        $qry->fetchinto($row);
     2523        list($datestamp, $timestamp, $hstdate, $hsttime) = $row;
     2524        $dsp = explode('.', $datestamp);
     2525        $tsp = explode('.', $timestamp);
     2526
     2527        $utcyy = gmdate("Y", strtotime("$dayshift day"));
     2528        $utcmm = gmdate("m", strtotime("$dayshift day"));
     2529        $utcdd = gmdate("d", strtotime("$dayshift day"));
     2530        $utchh = floor($t_i*$bshift/60);
     2531        $utcmn = $t_i*$bshift % 60;
     2532        $hstdatetime = date("Y-m-d H:i", strtotime($utcyy."-".$utcmm."-".$utcdd." ".$utchh.":".$utcmn.":00"." UTC"));
     2533        if ($row[0] != NULL & $dsp[2] == $utcdd) {
     2534          if ($chip_diff < 0 || $cam_diff < 0 || $fake_diff < 0 || $warp_diff < 0 || $stack_diff < 0 || $stat_diff < 0 || $diff_diff < 0 || $ff_diff < 0 || $dist_diff < 0 || $pub_diff < 0 || $chip_diff > $difflimit || $cam_diff > $difflimit || $fake_diff > $difflimit || $warp_diff > $difflimit || $stack_diff > $difflimit || $stat_diff > $difflimit || $diff_diff > $difflimit || $ff_diff > $difflimit || $dist_diff > $difflimit || $pub_diff > $difflimit) {
     2535//            echo "[new Date($dsp[0], $dsp[1]-1, $dsp[2], $tsp[0], $tsp[1]), ";
     2536            echo "[new Date($utcyy, $utcmm-1, $utcdd, $utchh, $utcmn), ";
     2537            echo "  0, \"<i><b>$hstdatetime (HST) 0 chip/hr     </i></b> \","; //+ 6*50 chip
     2538            echo "  0, \"<i><b>$hstdatetime (HST) 0 cam/hr      </i></b> \","; //+ 5*50 cam
     2539            echo "  0, \"<i><b>$hstdatetime (HST) 0 fake/hr     </i></b> \","; //+ 4*50 fake
     2540            echo "  0, \"<i><b>$hstdatetime (HST) 0 warp/hr     </i></b> \","; //+ 3*50 warp
     2541            echo "  0, \"<i><b>$hstdatetime (HST) 0 stack/hr    </i></b> \","; //+ 0*50 stack
     2542            echo "  0, \"<i><b>$hstdatetime (HST) 0 staticsky/hr</i></b> \","; //+ 0*50 staticsky
     2543            echo "  0, \"<i><b>$hstdatetime (HST) 0 diff/hr     </i></b> \","; //+ 2*50 diff
     2544            echo "  0, \"<i><b>$hstdatetime (HST) 0 fullforce/hr</i></b> \","; //+ 0*50 fullforce
     2545            echo "  0, \"<i><b>$hstdatetime (HST) 0 dist/hr     </i></b> \","; //+ 1*50 dist
     2546            echo "  0, \"<i><b>$hstdatetime (HST) 0 pub/hr      </i></b> \","; //+ 0*50 pub
     2547            echo "], ";
     2548          } else {
     2549//            echo "[new Date($dsp[0], $dsp[1]-1, $dsp[2], $tsp[0], $tsp[1]), ";
     2550            echo "[new Date($utcyy, $utcmm-1, $utcdd, $utchh, $utcmn), ";
     2551            echo "  $chip_rate, \"<i><b>$hstdatetime (HST)  $chip_rate chip/hr     </i></b> \","; //+ 6*50 chip
     2552            echo "   $cam_rate, \"<i><b>$hstdatetime (HST)   $cam_rate cam/hr      </i></b> \","; //+ 5*50 cam
     2553            echo "  $fake_rate, \"<i><b>$hstdatetime (HST)  $fake_rate fake/hr     </i></b> \","; //+ 4*50 fake
     2554            echo "  $warp_rate, \"<i><b>$hstdatetime (HST)  $warp_rate warp/hr     </i></b> \","; //+ 3*50 warp
     2555            echo " $stack_rate, \"<i><b>$hstdatetime (HST) $stack_rate stack/hr    </i></b> \","; //+ 0*50 stack
     2556            echo "  $stat_rate, \"<i><b>$hstdatetime (HST)  $stat_rate staticsky/hr</i></b> \","; //+ 0*50 staticsky
     2557            echo "  $diff_rate, \"<i><b>$hstdatetime (HST)  $diff_rate diff/hr     </i></b> \","; //+ 2*50 diff
     2558            echo "    $ff_rate, \"<i><b>$hstdatetime (HST)    $ff_rate fullforce/hr</i></b> \","; //+ 0*50 fullforce
     2559            echo "  $dist_rate, \"<i><b>$hstdatetime (HST)  $dist_rate dist/hr     </i></b> \","; //+ 1*50 dist
     2560            echo "   $pub_rate, \"<i><b>$hstdatetime (HST)   $pub_rate pub/hr      </i></b> \","; //+ 0*50 pub
     2561            echo "], ";
     2562          } 
     2563        } else {
     2564            echo "[new Date($utcyy, $utcmm-1, $utcdd, $utchh, $utcmn), ";
     2565            echo "  0, \"<i><b>$hstdatetime (HST) 0 chip/hr     </i></b> \","; //+ 6*50 chip
     2566            echo "  0, \"<i><b>$hstdatetime (HST) 0 cam/hr      </i></b> \","; //+ 5*50 cam
     2567            echo "  0, \"<i><b>$hstdatetime (HST) 0 fake/hr     </i></b> \","; //+ 4*50 fake
     2568            echo "  0, \"<i><b>$hstdatetime (HST) 0 warp/hr     </i></b> \","; //+ 3*50 warp
     2569            echo "  0, \"<i><b>$hstdatetime (HST) 0 stack/hr    </i></b> \","; //+ 0*50 stack
     2570            echo "  0, \"<i><b>$hstdatetime (HST) 0 staticsky/hr</i></b> \","; //+ 0*50 staticsky
     2571            echo "  0, \"<i><b>$hstdatetime (HST) 0 diff/hr     </i></b> \","; //+ 2*50 diff
     2572            echo "  0, \"<i><b>$hstdatetime (HST) 0 fullforce/hr</i></b> \","; //+ 0*50 fullforce
     2573            echo "  0, \"<i><b>$hstdatetime (HST) 0 dist/hr     </i></b> \","; //+ 1*50 dist
     2574            echo "  0, \"<i><b>$hstdatetime (HST) 0 pub/hr      </i></b> \","; //+ 0*50 pub
     2575            echo "], ";
     2576        }
     2577      }
     2578    }
     2579    }
     2580    else {
     2581      $plottitle = "title: 'Items per hour',";
     2582      echo "  data.addColumn('datetime',          'Time');";
     2583      echo "  data.addColumn(  'number','$selectedStage');";
     2584      echo "   data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});";
     2585      echo "   data.addRows([";
     2586      $plotstage = $selectedStage;
     2587      $plotseries  = "    series: { 0: { color: '#33a532', lineWidth: 3 }, },";
     2588      $binsize = 30; // 30 mins gap
     2589      $bshift  = 2; // 2 mins step
     2590      $datemin  = -$dayshift*1440+gmdate("H")*60+gmdate("i");
     2591      for ($t_i = 0; $t_i <= $datemin/$bshift; $t_i++) {
     2592        $sql = "select date_format(addtime(timestamp, '10:00:00'), \"%Y.%m.%d.%H.%i\") as dated, processed, timestamp from $selectedStage where dbname like '$proj' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and label like '$selectedLabel' order by timestamp limit 1;";
     2593        $qry = $db->query($sql);
     2594        $qry->fetchinto($row);
     2595        list($tstamp, $stageproc0) = $row;
     2596 
     2597        $sql = "select date_format(addtime(timestamp, '10:00:00'), \"%Y.%m.%d.%H.%i\") as dated, processed, timestamp from $selectedStage where dbname like '$proj' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and label like '$selectedLabel' order by timestamp desc limit 1;";
     2598        $qry = $db->query($sql);
     2599        $qry->fetchinto($row);
     2600        list($tstamp, $stageproc1) = $row;
     2601
     2602        $sql = "select date_format(addtime(timestamp, '10:00:00'), \"%Y.%m.%d\"), time_format(sec_to_time(avg(time_to_sec(timestamp)) - 14*3600 ), \"%H.%i.%s\"), date_format(timestamp, \"%Y-%m-%d\"), time_format(sec_to_time(avg(time_to_sec(timestamp))), \"%H:%i:%s\") from $selectedStage where dbname like '$proj' and (timestamp > utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift-$binsize/2 minute) and (timestamp < utc_date() - INTERVAL 10 hour + interval $dayshift day + interval $t_i*$bshift+$binsize/2 minute) and label like '$selectedLabel';";
     2603        $qry = $db->query($sql);
     2604        $qry->fetchinto($row);
     2605        list($datestamp, $timestamp, $hstdate, $hsttime) = $row;
     2606        $dsp = explode('.', $datestamp);
     2607        $tsp = explode('.', $timestamp);
     2608
     2609
     2610        list(  $stage_diff,   $stage_rate) = getprocrate(  $stageproc1 , $stageproc0, $binsize);
     2611 
     2612        $utcyy = gmdate("Y", strtotime("$dayshift day"));
     2613        $utcmm = gmdate("m", strtotime("$dayshift day"));
     2614        $utcdd = gmdate("d", strtotime("$dayshift day"));
     2615        $utchh = floor($t_i*$bshift/60);
     2616        $utcmn = $t_i*$bshift % 60;
     2617        $hstdatetime = date("Y-m-d H:i", strtotime($utcyy."-".$utcmm."-".$utcdd." ".$utchh.":".$utcmn.":00"." UTC"));
     2618        if ($row[0] != null & $dsp[2] == $utcdd) {
     2619          if ($stage_diff < 0 || $stage_diff > $difflimit) {
     2620            echo "[new Date($utcyy, $utcmm-1, $utcdd, $utchh, $utcmn), ";
     2621            echo " 0, \"<i><b> $hstdatetime (HST) 0 $selectedStage/hr</i></b> \", ";
     2622            echo "], ";
     2623          } else {
     2624            echo "[new Date($utcyy, $utcmm-1, $utcdd, $utchh, $utcmn), ";
     2625            echo " $stage_rate, \"<i><b> $hstdatetime (HST) $stage_rate $selectedStage/hr</i></b> \", ";
     2626            echo "], ";
     2627          }
     2628        } else {
     2629            echo "[new Date($utcyy, $utcmm-1, $utcdd, $utchh, $utcmn), ";
     2630            echo " 0, \"<i><b> $hstdatetime (HST) 0 $selectedStage/hr</i></b> \", ";
     2631            echo "], ";
     2632        }
     2633      }
     2634   }
     2635
     2636   $utcyy = gmdate("Y", strtotime("$dayshift day"));
     2637   $utcmm = gmdate("m", strtotime("$dayshift day"));
     2638   $utcdd = gmdate("d", strtotime("$dayshift day"));
     2639   if ($dayshift != 0) {
     2640     $utchh = 23;
     2641     $utcmn = 59;
     2642   } else {
     2643     $utchh = gmdate("H", strtotime("$dayshift day"));
     2644     $utcmn = gmdate("i", strtotime("$dayshift day"));
     2645   }
     2646   echo "  ]);";
     2647
     2648
     2649    // linear plot options
     2650    echo " var options = {
     2651      title: 'Processed Items: $plotstage stages for $plotlabel labels on $proj',
     2652      titleTextStyle: {color: 'black', fontSize: 16},
     2653      width:  640, height: 400, fontSize: 12,
     2654      legend: { position: 'top', maxLines: 3 },
     2655      chartArea: {left:60, top:70, right:20, bottom:40},
     2656      tooltip: {isHtml: true},
     2657      hAxis: { 
     2658        title: 'Time on $utcyy-$utcmm-$utcdd (UTC)',
     2659        format: 'HH:mm',
     2660        gridlines: {count: -1},
     2661        viewWindow: {
     2662          min: new Date($utcyy, $utcmm-1, $utcdd, 0, 0, 0),
     2663          max: new Date($utcyy, $utcmm-1, $utcdd, $utchh, $utcmn)
     2664        }, 
     2665      },
     2666      vAxis: { 
     2667        title: 'Items per hour',
     2668        gridlines: {count: -1},
     2669      },
     2670      $plotseries
     2671    };";
     2672
     2673
     2674   echo "   var chart = new google.visualization.LineChart(document.getElementById('rate_series_div'));";
     2675   echo "   chart.draw(data, options);";
     2676   echo " }";
     2677   echo "</script>";
     2678
     2679    $time = microtime();
     2680    $time = explode(' ', $time);
     2681    $time = $time[1] + $time[0];
     2682    $finish = $time;
     2683    $total_time = round(($finish - $start), 3);
     2684    $start= $finish;
     2685    echo "<center>loading in $total_time seconds<br></center>";
     2686#    echo $sql;
     2687}
     2688
     2689function getprocrate ($proc1, $proc0, $trange) {
     2690  if($proc1 > $proc0) {
     2691    $diffproc = $proc1-$proc0;
     2692  } else {
     2693    $diffproc = 0;
     2694  }
     2695  $procrate = $diffproc / $trange * 60;
     2696  return array($diffproc, $procrate);
     2697}
     2698
     2699
    17732700
    17742701?>
  • trunk/ippMonitor/raw/site.php

    r41381 r41677  
    44// values below are set based on the binary, etc paths.
    55
    6 $WWWHOST    = "ipp113.ifa.hawaii.edu";
     6$WWWHOST    = "ipp117.ifa.hawaii.edu";
    77
    8 $PERLLIB    = "/data/ippc18.0/home/tdeboer/ipp/default.lin64/lib";
     8$PERLLIB    = "/data/ippc64.1/ippitc/psconfig/ipp-20170121.lin64/lib";
    99$BINDIR     = "/data/ippc64.1/ippitc/psconfig/ipp-20170121.lin64/bin";
    10 $LIBDIR     = "/data/ippc18.0/home/tdeboer/ipp/default.lin64/lib";
     10$LIBDIR     = "/data/ippc64.1/ippitc/psconfig/ipp-20170121.lin64/lib";
    1111$SITE       = "/data/ippc64.1/ippitc/ippconfig/ippmonitor.config";
    1212
    1313$DBI     = "DB";
     14
     15// location of plots produced by czarpoll.pl
     16$CZARPLOTDIR     = "./czartool_plots";
     17$METRICSPLOTDIR  = "./ippMetrics";
    1418
    1519// insert config.dat here. this contains a number of system-specific things like
     
    1822
    1923// host and user information for the main processing database (contains, e.g., gpc1, gpc2, etc)
    20 $DBHOST    = "ippdb08";
    21 $DBUSER    = "ippuser";
    22 $DBPASS    = "ippuser";
     24$DBHOST    = "ippdb05";
     25$DBUSER    = "ipp";
     26$DBPASS    = "ipp";
    2327
    2428// location of nebulous apache interface machine
    25 $NEB_SERVER = "http://ippc74/nebulous";
     29$NEB_SERVER = "http://ippc33/nebulous";
    2630
    2731// Czartool configuration variables
    2832// NOTE: These should match the configuration file used by the czartool perl modules: czartool/czarconfig.xml
    2933$CZARDBNAME = "czardb";
    30 $CZARDBHOST = "ippdb08";
     34$CZARDBHOST = "ippdb05";
    3135
    3236// location of plots produced by czarpoll.pl
    33 $CZARPLOTDIR = "/export/ipp113.0/ipp/czartool_plots";
     37//$CZARPLOTDIR = "/export/ipp113.0/ipp/czartool_plots";
     38//$CZARPLOTDIR = "/export/ipp117.0/ipp/czartool_plots";
    3439
    3540// Temporary files belonging to DELETION_USER and older than
     
    4045$DELETION_DELAY  = 15;
    4146
    42 $HOST_NEBULOUS  = "ippdb09.IfA.Hawaii.Edu";
     47$HOST_NEBULOUS  = "nebulous.ipp.ifa.hawaii.edu";
    4348$USER_NEBULOUS  = "ippMonitor";
    4449$PASSWORD_NEBULOUS  = "ippMonitor";
    45 $DBNAME_NEBULOUS  = "ippdb09 nebulous master";
    46 
    47 $REPL_HOST_NEBULOUS  = "ippdb01.IfA.Hawaii.Edu";
    48 $REPL_USER_NEBULOUS  = "ippMonitor";
    49 $REPL_PASSWORD_NEBULOUS  = "ippMonitor";
    50 $REPL_DBNAME_NEBULOUS  = "ippdb01 nebulous repl1 (50,000s behind is acceptable / usually stopped on Mon/Tues for backups)";
     50$DBNAME_NEBULOUS  = "ippdb11 nebulous master";
    5151
    5252$REPL_HOST_NEBULOUS_SECONDARY  = "ippdb06.IfA.Hawaii.Edu";
    5353$REPL_USER_NEBULOUS_SECONDARY  = "ippMonitor";
    5454$REPL_PASSWORD_NEBULOUS_SECONDARY  = "ippMonitor";
    55 $REPL_DBNAME_NEBULOUS_SECONDARY  = "ippdb06 nebulous repl2 (50,000s behind is acceptable / usually stopped on Mon/Tues for backups)";
     55$REPL_DBNAME_NEBULOUS_SECONDARY  = "ippdb06 nebulous repl2";
    5656
    5757$REPL_HOST_NEBULOUS_THIRD  = "ippdb12.IfA.Hawaii.Edu";
     
    7575$REPL_DBNAME_ISP  = "ippc17 (isp)";
    7676
    77 $HOST_GPC1  = "ippdb08.IfA.Hawaii.Edu";
     77$HOST_GPC1  = "ippdb05.IfA.Hawaii.Edu";
    7878$USER_GPC1  = "ippMonitor";
    7979$PASSWORD_GPC1  = "ippMonitor";
    80 $DBNAME_GPC1  = "ippdb08 master db(czardb, gpc1, gpc2, ippadmin, ipptopsps, megacam, ssp, uip)";
     80$DBNAME_GPC1  = "ippdb05 master db(czardb, gpc1, gpc2, ippadmin, ipptopsps, megacam, ssp, uip)";
    8181
    82 $REPL_HOST_GPC1  = "ippdb05.IfA.Hawaii.Edu";
     82$REPL_HOST_GPC1  = "ippdb01.IfA.Hawaii.Edu";
    8383$REPL_USER_GPC1  = "ippMonitor";
    8484$REPL_PASSWORD_GPC1  = "ippMonitor";
    85 $REPL_DBNAME_GPC1  = "ippdb05 repl1 (czardb, gpc1, gpc2, ippadmin, ipptopsps, megacam, ssp, uip)";
     85$REPL_DBNAME_GPC1  = "ippdb01 repl1 (czardb, gpc1, gpc2, ippadmin, ipptopsps, megacam, ssp, uip)";
    8686
    87 $REPL_HOST_GPC1_SECONDARY  = "ipp116.IfA.Hawaii.Edu";
     87$REPL_HOST_GPC1_SECONDARY  = "ippdb09.IfA.Hawaii.Edu";
    8888$REPL_USER_GPC1_SECONDARY  = "ippMonitor";
    8989$REPL_PASSWORD_GPC1_SECONDARY  = "ippMonitor";
    90 $REPL_DBNAME_GPC1_SECONDARY  = "ipp116 repl2 (czardb, gpc1, gpc2, ippadmin, ipptopsps, megacam, ssp, uip)";
     90$REPL_DBNAME_GPC1_SECONDARY  = "ippdb09 repl2 (czardb, gpc1, gpc2, ippadmin, ipptopsps, megacam, ssp, uip)";
     91
     92$REPL_HOST_GPC1_THIRD  = "ipp116.IfA.Hawaii.Edu";
     93$REPL_USER_GPC1_THIRD  = "ippMonitor";
     94$REPL_PASSWORD_GPC1_THIRD  = "ippMonitor";
     95$REPL_DBNAME_GPC1_THIRD  = "ipp116 repl3 (czardb, gpc1, gpc2, ippadmin, ipptopsps, megacam, ssp, uip)";
    9196
    9297$REPL_HOST_DATASTORE_SECONDARY  = "ipp117.IfA.Hawaii.Edu";
     
    102107$DBNAME_GATEWAY_SECONDARY  = "ipp117 (gateway backup)";
    103108
    104 $HOST_APACHE1  = "ippc70.IfA.Hawaii.Edu";
    105 $DBNAME_APACHE1  = "ippc70 (apache node)";
     109$HOST_APACHE1  = "ippc33.IfA.Hawaii.Edu";
     110$DBNAME_APACHE1  = "ippc33 (apache node)";
    106111
    107 $HOST_APACHE2  = "ippc71.IfA.Hawaii.Edu";
    108 $DBNAME_APACHE2  = "ippc71 (apache node)";
     112$HOST_APACHE2  = "ippc34.IfA.Hawaii.Edu";
     113$DBNAME_APACHE2  = "ippc34 (apache node)";
    109114
    110 $HOST_APACHE3  = "ippc72.IfA.Hawaii.Edu";
    111 $DBNAME_APACHE3  = "ippc72 (apache node)";
     115$HOST_APACHE3  = "ippc35.IfA.Hawaii.Edu";
     116$DBNAME_APACHE3  = "ippc35 (apache node)";
    112117
    113 $HOST_APACHE4  = "ippc73.IfA.Hawaii.Edu";
    114 $DBNAME_APACHE4  = "ippc73 (apache node)";
     118$HOST_APACHE4  = "ippc43.IfA.Hawaii.Edu";
     119$DBNAME_APACHE4  = "ippc43 (apache node)";
    115120
    116 $HOST_APACHE5  = "ippc74.IfA.Hawaii.Edu";
    117 $DBNAME_APACHE5  = "ippc74 (apache node)";
     121$HOST_APACHE5  = "ippc44.IfA.Hawaii.Edu";
     122$DBNAME_APACHE5  = "ippc44 (apache node)";
    118123
    119 $HOST_APACHE6  = "ippc75.IfA.Hawaii.Edu";
    120 $DBNAME_APACHE6  = "ippc75 (apache node)";
     124$HOST_APACHE6  = "ippc45.IfA.Hawaii.Edu";
     125$DBNAME_APACHE6  = "ippc45 (apache node)";
     126
     127$HOST_APACHE7  = "ippc36.IfA.Hawaii.Edu";
     128$DBNAME_APACHE7 = "ippc36 (backup apache)";
     129
     130$HOST_APACHE8  = "ippc46.IfA.Hawaii.Edu";
     131$DBNAME_APACHE8 = "ippc46 (backup apache)";
    121132
    122133$HOST_PROXY  = "ippops1.IfA.Hawaii.Edu";
    123134$DBNAME_PROXY  = "ippops1 (proxy server)";
    124135
    125 $HOST_SVN  = "ippops2.IfA.Hawaii.Edu";
    126 $DBNAME_SVN  = "ippops2 (svn server)";
     136$HOST_SVN  = "ippops4.IfA.Hawaii.Edu";
     137$DBNAME_SVN  = "ippops4 (svn server)";
    127138
    128139$HOST_CONFLUENCE  = "ippops4.IfA.Hawaii.Edu";
    129140$DBNAME_CONFLUENCE  = "ippops4 (confluence/JIRA)";
    130141
     142$HOST_NAGIOS  = "ipphome0.IfA.Hawaii.Edu";
     143$DBNAME_NAGIOS  = "ipphome0 (nagios/ITC home backup)";
     144
     145$HOST_HOME  = "ipphome0.IfA.Hawaii.Edu";
     146$DBNAME_HOME  = "ipphome0 (ITC homedir)";
    131147
    132148?>
Note: See TracChangeset for help on using the changeset viewer.