IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29654


Ignore:
Timestamp:
Nov 3, 2010, 1:39:43 PM (16 years ago)
Author:
Serge CHASTEL
Message:

MySQL Replication status can now be seen through czartool/DB Connection parameters are in site.php.in

Location:
trunk/ippMonitor/raw
Files:
2 edited

Legend:

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

    r29650 r29654  
    156156echo "</td>\n";
    157157echo "<td>\n";
    158 echo "<b>Information about replication will be here soon</b>";
     158# This is awful
     159echo "<table border=\"1\"><tr><td colspan=\"2\"><b>Databases Replication Status</b></td></tr>";
     160echo "<tr><td>Database</td><td>Replication Status</td></tr>";
     161showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_DBNAME_GPC1);
     162showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_DBNAME_NEBULOUS);
     163echo "</table>";
    159164echo "</td>\n";
    160165echo "</tr>\n";
    161166
    162167echo "</table>\n";
    163 
    164168
    165169menu_end();
     
    679683
    680684    }
    681 
    682 }
    683 
     685}
     686
     687###########################################################################
     688#
     689# Shows the status of the various replication mysql servers
     690#
     691###########################################################################
     692function showReplicationsStatus($replHost, $replUser, $replPassword, $replDatabaseName) {
     693  #print "<br>$replHost, $replUser, $replPassword, $replDatabaseName<br/>";
     694  $dbRepl = DB::connect("mysql://$replUser:$replPassword@$replHost");
     695  if (PEAR::isError($dbRepl)) {
     696    die("MySQL DB connection error: Check the configuration for $replDatabaseName");
     697  }
     698  $res = $dbRepl->query('SHOW SLAVE STATUS');
     699  while ($res->fetchInto($row)) {
     700    # Have a look for Last_Errno in http://dev.mysql.com/doc/refman/5.0/en/show-slave-status.html
     701    $errorStatusInMySql = $row[18];
     702    $replStatus = ($errorStatusInMySql==0?"OK":"<font color=\"red\">PROBLEM</font>");
     703    echo "<tr><td>$replDatabaseName</td><td>$replStatus</td></tr>";
     704    if ($errorStatusInMySql!=0) {
     705      echo "<tr><td colspan=\"2\">Connect to $replDatabaseName replication host, execute 'SHOW SLAVE STATUS', and fix the problem.<br/>";
     706      echo "Information <a href=\"http://dev.mysql.com/doc/refman/5.0/en/show-slave-status.html\">here</a></td></tr>";
     707    }
     708  }
     709  $dbRepl->disconnect();
     710}
    684711
    685712?>
  • trunk/ippMonitor/raw/site.php.in

    r28616 r29654  
    2121$DELETION_USER  = "apache";
    2222$DELETION_DELAY = 15;
     23
     24$REPL_HOST_GPC1 = "ipp0012.IfA.Hawaii.Edu";
     25$REPL_USER_GPC1 = "ipp";
     26$REPL_PASSWORD_GPC1 = "ipp";
     27$REPL_DBNAME_GPC1 = "gpc1";
     28
     29$REPL_HOST_NEBULOUS = "ipp0222.IfA.Hawaii.Edu";
     30$REPL_USER_NEBULOUS = "ippMonitor";
     31$REPL_PASSWORD_NEBULOUS = "ippMonitor";
     32$REPL_DBNAME_NEBULOUS = "Nebulous";
     33
    2334?>
Note: See TracChangeset for help on using the changeset viewer.