static function box($width, $color, $offset, $bg_image, $hover_txt, $text, $height, $container = false) { if ($color) { $color_str = 'background-color:' . $color . ';'; } else { $color_str = ''; } $styles = 'width:' . $width . 'px; height:' . $height . 'px; ' . $color_str . 'left:' . $offset . 'px; top:0px;'; if ($container) { # # Wrapper div so just open tag # $styles = $styles . 'position:relative;'; u::start_tag('div', 'style="' . $styles . '"', 1); } else { # # Graph element # - wrap in a lable and set background # $styles = $styles . "position:absolute;background-image:url('" . $bg_image . "')"; u::tagged_item('a', '<div style="' . $styles . '">' . $text . '</div>', 'title="' . $hover_txt . '"', 1); } }
#$display_name_lower = array_map('strtolower', $display_name); array_multisort($display_name, SORT_ASC, SORT_STRING, $values); # # Add choose # $choose_str = 'Choose'; array_unshift($values, array($choose_str, $choose_str)); if (!$db) { $db = $choose_str; } u::select_list('db', $values, $db); u::end_tag('form'); # # Reports now # u::start_tag('form', 'action="show_page.php" style="display:inline"'); u::tag('input', 'type="hidden" name="db" value="' . $db . '"'); $values = array(); $values[] = array('db_monitor.php', 'DB Monitoring'); $values[] = array('blocking_tree.php', 'Blocking Sessions'); $values[] = array('db_checks.php?html=1', 'DB Checks'); $yest = strtotime("yesterday"); $start = date('o_m_d__09', $yest); $end = date('o_m_d__17', $yest); $top_sql_report_url = "top_sql_report.php?start={$start}&end={$end}&order_by_id="; $values[] = array($top_sql_report_url . '1', 'Top SQL Report'); $values[] = array('db_size.php', 'Database Size'); $values[] = array('standby_details.php', 'Standby Details'); $values[] = array('db_checks_all_dbs.php?html=1', 'Checks all DB'); if (u::request_val('full', 0)) { $values[] = array('undo_monitor.php', 'Undo Monitor');
u::tagged_item('div', $active_sessions, $div_format, 1); } else { # # Add cell to page # u::tagged_item('div', '', $div_format, 1); } $current_row++; } } } } # # Main graph boundry div # u::start_tag('div', "onscroll=\"toggle_button('Stop');\" class=\"graph\" style=\"top:{$chart_top};left:{$chart_left_pos}\" id=\"active_sessions_graph\""); if ($display_max_cpu) { # # Max CPU info # u::tagged_item('div', 'Max CPU', 'class="max_cpu"', 1); } # # Move pos for next chart # $chart_top = $chart_top + $chart_height + 10; $graph_heights = array(); $max_height_cells = 0; while ($rec = oci_fetch_object($cur)) { $col++; u::fill_in_missing_snaps($last_snap_time, $rec->S_TIME, $col);
xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200){ document.getElementById(div_to_replace).innerHTML=xmlhttp.responseText; } } // Get all the graphs base_url = "<?php echo $sys_load_url; ?> "; xmlhttp.open("GET",base_url + extra_param,true); xmlhttp.send(); } function toggle_button(current_val){ if ( current_val == 'Stop' ){ alter_timers('stop'); document.getElementById("btn").value='Start'; }else{ alter_timers('start'); document.getElementById("btn").value='Stop'; } } </script> </head> <?php u::start_tag('body', 'onload="start_monitoring();"');
u::start_tag('table', 'id="data1"'); u::tr('<th>sql_id</th><th>% of ' . $sql_mins_hist . ' mins busy</th><th>Execs</th><th>Avg Disk Reads</th><th>Avg Secs</th><th>SQL Text</th>', '', 1); $i = 0; while ($rec = oci_fetch_object($cur)) { # # Row formatting # $class_str = u::odd_even_class_str($i++); u::start_tag('tr', $class_str); $highlight_graph_str = "onmouseover=\"highlight('{$rec->SQL_ID}');\" "; $sql_cell = "<div {$highlight_graph_str}>" . sql_details_link($rec->SQL_ID, $db) . "</div>"; u::td($sql_cell, '', 1); # # Barchart # $values = array($rec->PERCENT_ON_CPU, $rec->PERCENT_USER_IO, $rec->PERCENT_SYSTEM_IO, $rec->PERCENT_BLOCKED, $rec->PERCENT_OTHER); u::start_tag('td', 'style="padding:0px 0px 0px 0px"'); include 'bar_chart.php'; u::end_tag('td'); u::td($rec->EXECS, '', 1); u::td($rec->AVG_DISK_READS, '', 1); u::td($rec->AVG_SECS, '', 1); u::tagged_item('td', $rec->SQL_TEXT, 'style="border-right:0px;font-size:xx-small;font-family:Courier New;"', 1); u::end_tag('tr'); } # # Fill table up if needed # u::filler_rows($table_rows, $i, 6); u::end_tag('table'); u::end_tag('div');
{$snaps_table} sd WHERE sample_time > sysdate - :mins_hist/(24*60) ORDER BY sample_time , session_id __SQL_END; $binds = ''; $binds[] = array(":mins_hist", $mins_hist); $cur = $db_obj->exec_sql($sql, $binds); $last_snap_time = $oracle_sysdate; while ($rec = oci_fetch_object($cur)) { $col++; $div_id = $rec->SAMPLE_TIME . '_' . $rec->SESSION_ID; u::start_tag('div', 'id="' . $div_id . '" class="sess_detail" style="display:none;position:absolute;top:270px;left:100px;border:2px solid black"'); u::start_tag('table', 'class="data1"'); u::tr("<th>Info</th><th>Value</th>"); u::tr("<td>Time</td><td>" . $rec->SAMPLE_TIME . "</td>", 'class=alt'); u::tr("<td>State</td><td>" . $rec->SESSION_STATE . "</td>"); u::tr("<td>Waitclass</td><td>" . $rec->WAIT_CLASS . "</td>", 'class=alt'); u::tr("<td>SID</td><td>" . $rec->SESSION_ID . "</td>"); u::tr("<td>Program</td><td>" . $rec->PROGRAM . "</td>", 'class=alt'); # # session running some sql? # if ($rec->SQL_ID) { u::tr("<td>sqlid</td><td>" . $rec->SQL_ID . "</td>"); } # # Blocked? #
# # Row formatting # $class_str = u::odd_even_class_str($i++); u::start_tag('tr', $class_str); $sid_cell = "<div " . highlight_js_str($rec->SID) . ">" . drilldown_links($rec->SID, $db, '', $snaps_table) . "</div>"; u::td($sid_cell, '', 1); u::td($rec->USERNAME, '', 1); # # Covert seconds to % for plotting # $values = array($rec->SECONDS_ON_CPU, $rec->SECONDS_USER_IO, $rec->SECONDS_SYSTEM_IO, $rec->SECONDS_BLOCKED, $rec->SECONDS_OTHER); foreach ($values as $key => $value) { $values[$key] = round($value * 100 / ($mins_hist * 60)); } u::start_tag('td', 'style="padding:0;"'); # # Draw percentages as a bar chart # u::info('Draw Bar chart', 1); include 'bar_chart.php'; u::info('Draw Bar chart - Done', 1); u::end_tag('td'); $highlight_graph_str = "onmouseover=\"highlight('{$rec->CURRENT_BLOCKING_SESSION}');\" "; $sid_cell = "<div {$highlight_graph_str}>" . drilldown_links($rec->CURRENT_BLOCKING_SESSION, $db, '', $snaps_table) . "</div>"; u::td($sid_cell, '', 1); u::td("<div " . highlight_js_str($rec->CURRENT_SQL_ID) . ">" . sql_details_link($rec->CURRENT_SQL_ID, $db) . "</div>", '', 1); u::td("<div " . highlight_js_str($rec->PREV_SQL_ID) . ">" . sql_details_link($rec->PREV_SQL_ID, $db) . "</div>", '', 1); u::td($rec->CURRENT_PROGRAM, '', 1); u::td($rec->CURRENT_MACHINE, 'style="border-right:0px;"', 1); u::end_tag('tr');