IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 13, 2015, 9:19:19 AM (11 years ago)
Author:
bills
Message:

Working version of czartool with plots.
raw/ipp.czar.dat

Remove 'czartool - ipptopsps link' from Czar left panel menu

raw/ipp.php

Get czardb name and host from site.php

raw/czartool_getplot.php

czartool plots are now in project specific directory
get base directory from

raw/czartool_labels.php

XXX: a couple of testing hacks to remove
Include proj in arguments to links to czartool_getplot.php

czartool/czarpoll.pl

Support for gathering data from multiple project databases.
czartool::Plotter now has an optional project database member. 3 Plotter
instances now.

plotter0 is for non project specific plots.
plotter1 is for gpc1
plotter1 is for gpc2

Keep track and print out how long each poll iteration takes. If it takes
less than the supplied period, sleep for the remainder. Currently takes
about 140 seconds which is larger than the default 60 second period.

Turn off the ippToPsps data gathering by nulling out the stage list.

czartool/czarplot.pl

Support for multiple projects

czartool/czartool/Metrics.pm

Metrics has a projectDb pass to Plotter constructor.
hardcoded member gpc1Db is deleted

czartool/czartool/DayMetrics.pm

projectDb isntead of hard coded gpc1Db
pass dbname to StageMetrics and CzarDb methods.

czartool/czartool/Config.pm

Added support for 2 project databases

czartool/czartool/CzarDb.pm

Operations on the stage tables now take "dbname" parameter.
This is passed to StageMetrics constructor.
XXX: should we split query for getTimeMinMaxDiff by project.

czartool/czartool/Plotter.pm

Add _projectDb member. Save dbname to _project for use in many method
invocations

czartool/czartool/StageMetrics.pm

Add dbname parameter.
XXX: Actually I'm not sure this is used any longer. This may have been
from a previous iteration. I've since moved the DB info to Plotter and Metrics.
Leaving in for now since this version is fully tested.

czartool/czartool/MySQLDb.pm

Add method to get _dbName

czartool/czartool/MetricsIndex.pm

Add database paramter to constructor for superclass Metrics. (It used to
have hard coded gpc1 db

File:
1 edited

Legend:

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

    r38257 r38258  
    88if (! $ID['proj']) { projectform ($ID); }
    99
    10 //$db = dbconnect($ID['proj']);
    11 $czardb = dbconnect("czardb"); // HACK to connect to czarDb
     10// connect to czarDb
     11$czardb = dbconnect($CZARDBNAME);
    1212$lastUpdateTime = getLastUpdateTime($czardb);
    1313
    14 $gpc1db = dbconnect($ID['proj']);
     14$projectdb = dbconnect($ID['proj']);
    1515
    1616$PATH = getenv("PATH");
     
    9999$menu = $ID['menu'];
    100100
    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
    102106$selectedStage = $_GET[stage];
    103107$selectedLabel = $_GET[label];
     
    135139$labels = getLabels($czardb, $selectedMode);
    136140$distLabels = getLabels($czardb, "distribution");
     141// publishing is in stdscience now
    137142# $pubLabels = getLabels($czardb, "publishing");
    138143$pubLabels = $labels;
     
    145150}
    146151
     152// The Update mode of czartool is obsolete. selectedMode is hardcoded to stdscience above.
    147153$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";
     160if ($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";
    152166
    153167// set up the form
     
    164178echo "<td colspan=\"3\" style=\"background-color:#0080c0;\">";
    165179echo "<h1 align=\"middle\">Czartool</h1>";
    166 echo "<h4 align=\"middle\">$modeText (change to <a href=\"$link\"><font color=\"blue\">$modeLinkText</font></a>)</h4>";
     180echo "<h2 align=\"middle\">$modeText (change to <a href=\"$link&proj=$newproj\"><font color=\"blue\">$newproj</font></a>)</h2>";
    167181echo "</td>";
    168182echo "</tr>";
    169183
     184// PLOTS
    170185echo "<tr valign=\"top\">";
    171186echo "<td style=width:100px;text-align:top;\">";
    172187 # time series plot
    173 echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&stage=$selectedStage&plottype=$plotType\"><br>";
     188echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=$plotType\"><br>";
    174189 # rate time series plot
    175 echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=rt&label=$selectedLabel&stage=$selectedStage&plottype=linear\"><br>";
     190echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=rt&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br>";
    176191 # 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>";
    178193 # 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>";
    180195 # storage plot
    181196echo "<br><a href=\"czartool_getplot.php?type=sl\"><img title=\"Click to enlarge me\" src=\"czartool_getplot.php?type=s\"></a><br>";
     
    186201 if ($selectedServer && !$serverCmd) showServerStatus($selectedServer);
    187202echo "</td>";
     203
     204
    188205echo "<td style=height:200px;width:10px;text-align:top;\">";
    189206echo "<td style=height:200px;width:400px;text-align:top;\">";
     
    240257      createServersTable($pass, $proj,$selectedMode,$czardb, $servers, $selectedLabel, $selectedStage, $plotType);
    241258echo "<br>";
    242       createSummitDataTable($gpc1db);
     259      createSummitDataTable($projectdb);
    243260echo "<br>";
    244261      createDatesTable($czardb);
     
    253270      createTableColumnHeader("Status (sec behind master)");
    254271      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
     275if (0) {
    255276      # XXX EAM : problem showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_DBNAME_NEBULOUS);
    256277      showReplicationsStatus($REPL_HOST_PSTAMP, $REPL_USER_PSTAMP, $REPL_PASSWORD_PSTAMP, $REPL_DBNAME_PSTAMP);
     
    258279      showReplicationsStatus($REPL_HOST_ISP, $REPL_USER_ISP, $REPL_PASSWORD_ISP, $REPL_DBNAME_ISP);
    259280      showReplicationsStatus($REPL_HOST_NEBULOUS_SECONDARY, $REPL_USER_NEBULOUS_SECONDARY, $REPL_PASSWORD_NEBULOUS_SECONDARY, $REPL_DBNAME_NEBULOUS_SECONDARY);
     281}
    260282      echo "</table>";
    261283
     
    315337#
    316338###########################################################################
    317 function createSummitDataTable($gpc1db) {
     339function createSummitDataTable($projectdb) {
    318340
    319341    $date = date("Y-m-d");
    320342    $sql = "SELECT DISTINCT exp_type FROM summitExp WHERE dateobs > '$date'";
    321343
    322     $qry = $gpc1db->query($sql);
     344    $qry = $projectdb->query($sql);
    323345    if (dberror($qry)) {
    324346        echo "<b>error reading newExp table</b><br>\n";
     
    343365
    344366        $sql = "SELECT COUNT(*) FROM summitExp WHERE dateobs > '$date' AND exp_type = '$expType[0]'";
    345         $qry2 = $gpc1db->query($sql);
     367        $qry2 = $projectdb->query($sql);
    346368        $qry2->fetchInto($summit);
    347369        $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);
    349371        $qry2->fetchInto($mhpcc);
    350372
     
    373395function getLabels($db, $server) {
    374396
    375     # order by descending priority as set in gpc1 database
     397    # order by descending priority as set in project database
    376398    $sql = "SELECT label FROM current_labels WHERE server LIKE '$server' ORDER BY priority DESC";
    377399    if ($debug) {echo "$sql<br>";}
     
    490512          $myTable    = $mainTable[$stage];
    491513          $myFailures = $getFailures[$stage];
    492           # echo "myTable: $myTable";
     514          # echo "myTable: $myTable";
    493515
    494516          if ("$myFailures" == "NONE") {
     
    501523            }
    502524          }
    503           getStateAndFaults($db, $thisLabel, $selectedState, $stage, $str, $anyFaults);
     525          getStateAndFaults($db, $thisLabel, $proj, $selectedState, $stage, $str, $anyFaults);
    504526
    505527          $cellcolor = 0;
     
    647669#
    648670###########################################################################
    649 function getStateAndFaults($db, $label, $state, $stage, &$str, &$anyFaults) {
     671function getStateAndFaults($db, $label, $proj, $state, $stage, &$str, &$anyFaults) {
    650672
    651673    $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";
    653675    if ($debug) {echo "$sql<br>";}
    654676
Note: See TracChangeset for help on using the changeset viewer.