function p($str) { u::p($str); }
# # $Id$ # include 'start.php'; # # What log do we want? # $type = u::request_val('type'); if ($type == 'hist') { u::p('Getting History log'); $sql = "select logfile log from dbamgr.dbsync_standby_hist where hist_id = :hist_id"; $binds = ''; $binds[] = array(":hist_id", u::request_val('hist_id')); } else { u::p('Getting log'); if ($type == 'full') { $col = 'last_full_refresh_log'; } else { $col = 'last_rollforward_log'; } $sql = "select {$col} log from dbamgr.dbsync_standby where standby_id = :standby_id"; $binds = ''; $binds[] = array(":standby_id", u::request_val('standby_id')); } p('<pre>'); # # The log # if ($rec = $db_obj->single_rec($sql, $binds)) { while (!$rec->LOG->eof()) {
static function info($msg, $in_comment = 0) { if (isset($_GET['info'])) { if ($in_comment) { $msg = "<!-- {$msg} -->"; } $tabs = u::tabs(u::$info_tabs); u::p($tabs . $msg); ob_flush(); flush(); } }
# Detail urls # $graph_extra_param = '&active_sessions=on&mins_hist=2'; $sql_extra_param = '&top_sql=on&mins_hist=2'; $sessions_extra_param = '&top_sessions=on&mins_hist=2'; $graph_icons_param = '&graph_icons=' . u::request_val('graph_icons', '0'); $chart_icons_param = '&chart_icons=' . u::request_val('chart_icons', '0'); $color_scheme_param = '&color_scheme=' . u::request_val('color_scheme', '2'); $cell_style_param = '&cell_style=' . u::request_val('cell_style', '3'); $max_cpu_param = '&display_max_cpu=' . u::request_val('display_max_cpu', 1); $sys_load_url = "system_load.php?&hide=on&snaps_table={$snaps_table}&db={$db}&sql_mins_hist=2&width={$chart_width}&max_width={$chart_max_width}" . $graph_icons_param . $chart_icons_param . $color_scheme_param . $cell_style_param . $max_cpu_param; $graph_url = $sys_load_url . $graph_extra_param; $sql_url = $sys_load_url . $sql_extra_param; $sessions_url = $sys_load_url . $sessions_extra_param; $sys_load_url = $sys_load_url . "&div_only=1"; u::p('<!DOCTYPE html>'); ?> <html> <head> <title>AVO - <?php echo $db; ?> </title> <style> <?php include 'table_css.php'; ?> .sess_detail {position:fixed;width:500px;top:310;left:140;z-index:2;background-color:white} </style> <script> var top_div_timer = { timer_ref: null, refresh_secs: 2 };
function html_results($cur, $fmt = 1, $link_col = 0, $link = '', $show_no_rows = 1) { if ($fmt) { u::p('<style>table td {white-space: nowrap;border: 1px solid silver;font-family:Courier New}</style>'); u::p('<table>'); } else { u::p('<pre>'); } $print_header = 1; $rows_fetched = 0; while ($rec = oci_fetch_object($cur)) { $rows_fetched++; if ($fmt) { u::p('<tr>'); } # # Display column headers # if ($print_header) { if ($fmt) { u::p('<tr>'); } foreach ($rec as $key => $val) { if ($fmt) { u::th($key, 'style="background-color:silver;color:white"'); } else { u::p($key); } } if ($fmt) { u::p('</tr>'); } $print_header = 0; } # # Row data # if ($fmt) { u::p('<tr>'); } $col = 0; foreach ($rec as $key => $val) { $col++; if ($col === $link_col) { $val = u::a($val, str_replace('__VAL__', $val, $link), 1); } if ($fmt) { # # Extra formatting? # if ($val == 'CRITICAL') { $extra = 'style="background-color:red;"'; } else { $extra = ''; } u::td($val, $extra); } else { u::p($val); } } if ($fmt) { u::p('</tr>'); } } oci_free_statement($cur); if (!$rows_fetched and $fmt and $show_no_rows) { u::trtd('No Rows Returned', 'style="background-color:red;"'); } if ($fmt) { u::p('</table>'); } else { u::p('</pre>'); } }
} else { $include_it = 0; } } # # Now excludes # $exclude_it = 0; if ($exc_str) { $search_pos = stripos($db, $exc_str); if ($search_pos === 0 or $search_pos > 0) { $exclude_it = 1; } } #u::p( $db . ' Inc : ' . $include_it . ' Exc : ' . $exclude_it . '<br>' ); if ($include_it and !$exclude_it) { echo $break . "DB : {$db} - Connecting to : {$db_detail->conn_str}, user : {$db_detail->user}\n"; u::flush(); $db_obj = new db($db_detail->user, $db_detail->pw, $db_detail->conn_str, 1); $just_checks = 1; if ($db_obj->connection_error) { u::p('<span style="background-color:red;">CRITICAL</span>'); } else { include 'db_checks.php'; } } } if (@$_GET['html']) { u::p('</body>'); u::p('</html>'); }
<?php # # $Id: //Infrastructure/GitHub/Database/asbo/web/standby_details.php#1 $ # include 'start.php'; # # Standby status # if ($db_obj->using_dbsync()) { $cur = $db_obj->exec_sql('BEGIN dbamgr.dbsync.process_logs; END;', ''); u::p('Current Details'); $binds = ''; $binds[] = array(":db_str", $db); $sql = file_get_contents("./sql/standby_check.sql"); $cur = $db_obj->exec_sql($sql, $binds); $db_obj->html_results($cur); u::p('Standby Action History'); $sql = file_get_contents("./sql/standby_history.sql"); $cur = $db_obj->exec_sql($sql, $binds); $db_obj->html_results($cur); } else { u::p('No standby for this database'); } include 'end.php';