Changeset 38258 for trunk/ippMonitor/raw/czartool_labels.php
- Timestamp:
- May 13, 2015, 9:19:19 AM (11 years ago)
- File:
-
- 1 edited
-
trunk/ippMonitor/raw/czartool_labels.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/raw/czartool_labels.php
r38257 r38258 8 8 if (! $ID['proj']) { projectform ($ID); } 9 9 10 // $db = dbconnect($ID['proj']);11 $czardb = dbconnect( "czardb"); // HACK to connect to czarDb10 // connect to czarDb 11 $czardb = dbconnect($CZARDBNAME); 12 12 $lastUpdateTime = getLastUpdateTime($czardb); 13 13 14 $ gpc1db = dbconnect($ID['proj']);14 $projectdb = dbconnect($ID['proj']); 15 15 16 16 $PATH = getenv("PATH"); … … 99 99 $menu = $ID['menu']; 100 100 101 $selectedMode = $_GET[mode]; 101 // The Update mode of czartool is obsolete since we don't use the update 102 // pantasks. 103 // $selectedMode = $_GET[mode]; 104 $selectedMode = "stdscience"; 105 102 106 $selectedStage = $_GET[stage]; 103 107 $selectedLabel = $_GET[label]; … … 135 139 $labels = getLabels($czardb, $selectedMode); 136 140 $distLabels = getLabels($czardb, "distribution"); 141 // publishing is in stdscience now 137 142 # $pubLabels = getLabels($czardb, "publishing"); 138 143 $pubLabels = $labels; … … 145 150 } 146 151 152 // The Update mode of czartool is obsolete. selectedMode is hardcoded to stdscience above. 147 153 $isUpdate = ($selectedMode == "update"); 148 $modeText = $isUpdate ? "Showing update processing" : "Showing standard processing"; 149 $modeLinkText = $isUpdate ? "standard" : "update"; 150 $modeLink = $isUpdate ? "stdscience" : "update"; 151 $link = "czartool_labels.php?pass=".$pass."&proj=".$proj."&mode=".$modeLink."&label=all&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotType"; 154 $isUpdate = 0; 155 156 // hijack the text and link at the top to create a link to the czartool monitoring the other project database 157 // I.E. Switch from gpc1 to gpc2 or gpc2 to gpc1 158 159 $modeText = "Monitoring $proj"; 160 if ($proj == 'gpc1') { 161 $newproj = 'gpc2'; 162 } else { 163 $newproj = 'gpc1'; 164 } 165 $link = "czartool_labels.php?pass=".$pass."&mode=".$selectedMode."&label=all&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotType"; 152 166 153 167 // set up the form … … 164 178 echo "<td colspan=\"3\" style=\"background-color:#0080c0;\">"; 165 179 echo "<h1 align=\"middle\">Czartool</h1>"; 166 echo "<h 4 align=\"middle\">$modeText (change to <a href=\"$link\"><font color=\"blue\">$modeLinkText</font></a>)</h4>";180 echo "<h2 align=\"middle\">$modeText (change to <a href=\"$link&proj=$newproj\"><font color=\"blue\">$newproj</font></a>)</h2>"; 167 181 echo "</td>"; 168 182 echo "</tr>"; 169 183 184 // PLOTS 170 185 echo "<tr valign=\"top\">"; 171 186 echo "<td style=width:100px;text-align:top;\">"; 172 187 # time series plot 173 echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel& stage=$selectedStage&plottype=$plotType\"><br>";188 echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=$plotType\"><br>"; 174 189 # rate time series plot 175 echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=rt&label=$selectedLabel& stage=$selectedStage&plottype=linear\"><br>";190 echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=rt&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br>"; 176 191 # rate stacked histo plot 177 # echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=rh&label=$selectedLabel& stage=$selectedStage&plottype=linear\"><br>";192 # echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=rh&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br>"; 178 193 # histogram plot 179 # echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=h&label=$selectedLabel& stage=$selectedStage&plottype=linear\"><br>";194 # echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=h&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br>"; 180 195 # storage plot 181 196 echo "<br><a href=\"czartool_getplot.php?type=sl\"><img title=\"Click to enlarge me\" src=\"czartool_getplot.php?type=s\"></a><br>"; … … 186 201 if ($selectedServer && !$serverCmd) showServerStatus($selectedServer); 187 202 echo "</td>"; 203 204 188 205 echo "<td style=height:200px;width:10px;text-align:top;\">"; 189 206 echo "<td style=height:200px;width:400px;text-align:top;\">"; … … 240 257 createServersTable($pass, $proj,$selectedMode,$czardb, $servers, $selectedLabel, $selectedStage, $plotType); 241 258 echo "<br>"; 242 createSummitDataTable($ gpc1db);259 createSummitDataTable($projectdb); 243 260 echo "<br>"; 244 261 createDatesTable($czardb); … … 253 270 createTableColumnHeader("Status (sec behind master)"); 254 271 showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_DBNAME_GPC1); 272 273 // XXX: avoid replication status checking errors due to missing passwords from my test host 274 // XXX: TODO: remove this conditional before committing changes 275 if (0) { 255 276 # XXX EAM : problem showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_DBNAME_NEBULOUS); 256 277 showReplicationsStatus($REPL_HOST_PSTAMP, $REPL_USER_PSTAMP, $REPL_PASSWORD_PSTAMP, $REPL_DBNAME_PSTAMP); … … 258 279 showReplicationsStatus($REPL_HOST_ISP, $REPL_USER_ISP, $REPL_PASSWORD_ISP, $REPL_DBNAME_ISP); 259 280 showReplicationsStatus($REPL_HOST_NEBULOUS_SECONDARY, $REPL_USER_NEBULOUS_SECONDARY, $REPL_PASSWORD_NEBULOUS_SECONDARY, $REPL_DBNAME_NEBULOUS_SECONDARY); 281 } 260 282 echo "</table>"; 261 283 … … 315 337 # 316 338 ########################################################################### 317 function createSummitDataTable($ gpc1db) {339 function createSummitDataTable($projectdb) { 318 340 319 341 $date = date("Y-m-d"); 320 342 $sql = "SELECT DISTINCT exp_type FROM summitExp WHERE dateobs > '$date'"; 321 343 322 $qry = $ gpc1db->query($sql);344 $qry = $projectdb->query($sql); 323 345 if (dberror($qry)) { 324 346 echo "<b>error reading newExp table</b><br>\n"; … … 343 365 344 366 $sql = "SELECT COUNT(*) FROM summitExp WHERE dateobs > '$date' AND exp_type = '$expType[0]'"; 345 $qry2 = $ gpc1db->query($sql);367 $qry2 = $projectdb->query($sql); 346 368 $qry2->fetchInto($summit); 347 369 $sql = "SELECT COUNT(*) FROM summitExp JOIN rawExp ON summitExp.exp_name = rawExp.exp_name WHERE summitExp.dateobs > '$date' AND summitExp.exp_type = '$expType[0]'"; 348 $qry2 = $ gpc1db->query($sql);370 $qry2 = $projectdb->query($sql); 349 371 $qry2->fetchInto($mhpcc); 350 372 … … 373 395 function getLabels($db, $server) { 374 396 375 # order by descending priority as set in gpc1database397 # order by descending priority as set in project database 376 398 $sql = "SELECT label FROM current_labels WHERE server LIKE '$server' ORDER BY priority DESC"; 377 399 if ($debug) {echo "$sql<br>";} … … 490 512 $myTable = $mainTable[$stage]; 491 513 $myFailures = $getFailures[$stage]; 492 # echo "myTable: $myTable";514 # echo "myTable: $myTable"; 493 515 494 516 if ("$myFailures" == "NONE") { … … 501 523 } 502 524 } 503 getStateAndFaults($db, $thisLabel, $ selectedState, $stage, $str, $anyFaults);525 getStateAndFaults($db, $thisLabel, $proj, $selectedState, $stage, $str, $anyFaults); 504 526 505 527 $cellcolor = 0; … … 647 669 # 648 670 ########################################################################### 649 function getStateAndFaults($db, $label, $ state, $stage, &$str, &$anyFaults) {671 function getStateAndFaults($db, $label, $proj, $state, $stage, &$str, &$anyFaults) { 650 672 651 673 $anyFaults = false; 652 $sql = "SELECT pending, faults FROM $stage WHERE label LIKE '$label' ORDER BY timestamp DESC LIMIT 1";674 $sql = "SELECT pending, faults FROM $stage WHERE label LIKE '$label' AND dbname LIKE '$proj' ORDER BY timestamp DESC LIMIT 1"; 653 675 if ($debug) {echo "$sql<br>";} 654 676
Note:
See TracChangeset
for help on using the changeset viewer.
