parse_all(); function getSelectOptions($selType, $selValue) { if ($selType == 'REFRESH') { $options = ['0'=>'Stop', '10'=>'10 Seconds','15'=>'15 Seconds', '30'=>'30 Seconds','60'=>'60 Seconds', '120' => '2 Minutes', '300' => '5 Minutes']; } else if ($selType == 'SHOW_TOP') { $options = ['5'=>'Top 5', '10'=>'Top 10', '20'=>'Top 20', '50'=>'Top 50', '0'=>'All']; } else if ($selType == 'VH_SHOW_SORTBY') { $options = [ 'vhname'=>'Virtual Host Name', 'req_processing'=>'Requests in Processing', 'req_per_sec'=>'Request/Second', 'eap_process'=>'ExtApp Processes', 'eap_inuse'=>'EAProc In Use', 'eap_idle'=>'EAProc Idle', 'eap_waitQ'=>'EAProc WaitQ', 'eap_req_per_sec'=>'EAProc Req/Sec']; } else if ($selType == 'EAP_SHOW_SORTBY') { $options = [ 'vhost'=>'Scope', 'type'=>'Type', 'extapp'=>'Name', 'config_max_conn'=>'Max CONN', 'effect_max_conn'=>'Eff Max', 'pool_size'=>'Pool', 'inuse_conn'=>'In Use', 'idle_conn'=>'Idle', 'waitqueue_depth'=>'WaitQ', 'req_per_sec'=>'Req/Sec']; } return DUtil::genOptions($options, $selValue); } function td_number($label, $number, $suffix = '', $decimals = 0, $col = 1) { $colspan = ($col == 1) ? '' : "colspan=\"$col\" "; return sprintf('%s%s%s', $label, $colspan, number_format($number, $decimals), $suffix); } function td_num2($number, $decimals = 0) { return '' . number_format($number, $decimals) . ''; } function td_num3($hits, $hits_per_sec) { return '' . number_format($hits) . ' | ' . number_format($hits_per_sec, 1) . ''; } function td_val($value) { return ''. $value . ''; } function td_label($label, $width = 0, $help_key = '') { if ($help_key) { $dhelp_item = DATTR_HELP::GetInstance()->GetItem($help_key); $help = '    ' . $dhelp_item->render($help_key); } else { $help = ''; } return '' . $label . $help . ''; } function input_val($name) { return DUtil::getGoodVal(DUtil::grab_input('REQUEST', $name)); } function graph_icon($gtype, $vhost='', $extapp='') { $param = ['gtype' => $gtype]; if ($vhost) { $param['vhost'] = $vhost; } if ($extapp) { $param['extapp'] = $extapp; } $url = 'graph_html.php?' . http_build_query($param); $window_name = md5($url); return '"; } $etr = "\n"; $refresh = input_val('refresh'); $vh_show_ind = input_val('vh_show_ind'); $vh_show_top = input_val('vh_show_top'); $vh_show_filter = input_val('vh_show_filter'); $vh_show_sort = input_val('vh_show_sort'); $eap_show_ind = input_val('eap_show_ind'); $eap_show_top = input_val('eap_show_top'); $eap_show_filter = input_val('eap_show_filter'); $eap_show_sort = input_val('eap_show_sort'); $cur_time = gmdate("D M j H:i:s T"); $server_info = "server {$service->serv['name']} snapshot at $cur_time"; // setting defaults if ($vh_show_ind == '') { $vh_show_ind = 'Show'; } if ($vh_show_top === '') { $vh_show_top = '5'; } if ($vh_show_sort == '') { $vh_show_sort = 'req_per_sec'; } if ($eap_show_ind == '') { $eap_show_ind = 'Show'; } if ($eap_show_top === '') { $eap_show_top = '5'; } if ($eap_show_sort == '') { $eap_show_sort = 'req_per_sec'; } if ($refresh > 0 && $refresh < 10) { $refresh = 10; } if($refresh >= 10) { echo ''; } ?>
Real-Time Statistics    Refresh Interval:
' . td_label('Uptime', 120) . td_val(ucwords($stats->uptime)) . $etr; $buf .= '' . td_label('Load', 120) . td_val($stats->load_avg) . $etr; $blocked_count = count($stats->blocked_ip); $blocked_sample = 'NONE'; if ($blocked_count > 14) { $blocked_sample = join(', ', array_slice($stats->blocked_ip, 0, 14) ); $blocked_sample .= '
...
Total ' . $blocked_count . ' blocked    Show All'; } else if ($blocked_count > 0) { $blocked_sample = join(', ', $stats->blocked_ip); } $buf .= ''. td_label('Anti-DDoS Blocked IP', 120, 'antiddos_blocked_ip') . td_val($blocked_sample) . $etr; echo $buf; ?>
Server Health
$etr"; $buf .= '' . td_label('Network Throughput') . td_number('Http In', $stats->bps_in, 'KB') . td_number('Http Out', $stats->bps_out, 'KB') . $etr; $buf .= '' . td_val('') . td_number('Https In', $stats->ssl_bps_in, 'KB') . td_number('Https Out', $stats->ssl_bps_out, 'KB') . $etr; $buf .= '' . td_label('Connections') . td_number('Max', $stats->max_conn) . td_number('Idle', $stats->idle_conn) . $etr; $buf .= '' . td_val('') . td_number('Http Used', $stats->plain_conn) . td_number('Http Free', $stats->avail_conn) . $etr; $buf .= '' . td_val('') . td_number('Https Used', $stats->ssl_conn) . td_number('Https Free', $stats->avail_ssl_conn) . $etr; $buf .= '' . td_label('Requests   (Details)') . td_number('In Processing', $stats->serv->req_processing) . td_number('Req/Sec', $stats->serv->req_per_sec, '', 1) . $etr; $buf .= '' . td_val('') . td_number('Total Req', $stats->serv->req_total, '', 0, 3) . $etr; $buf .= '' . td_val('') . td_number('Total Static Hits', $stats->serv->total_static_hits) . td_number('Static Hits/Sec', $stats->serv->static_hits_per_sec, '', 1) . $etr; $buf .= '' . td_val('') . td_number('Total Public Cache Hits', $stats->serv->total_cache_hits) . td_number('Public Cache Hits/Sec', $stats->serv->cache_hits_per_sec, '', 1) . $etr; $buf .= '' . td_val('') . td_number('Total Private Cache Hits', $stats->serv->total_private_cache_hits) . td_number('Private Cache Hits/Sec', $stats->serv->private_cache_hits_per_sec, '', 1) . $etr; echo $buf; ?>
Server ' . graph_icon('Server') . "
' . '' . '' . '' . '' . '' . "\n"; $vhlist = $stats->apply_vh_filter($vh_show_top, $vh_show_filter, $vh_show_sort); foreach ($vhlist as $vhname) { if ($vhname == '_Server') continue; $vh = $stats->vhosts[$vhname]; $buf .= ''; $buf .= ''; $buf .= td_num2($vh->req_processing) . td_num2($vh->req_per_sec, 1) . td_num3($vh->total_static_hits, $vh->static_hits_per_sec) . td_num3($vh->total_cache_hits, $vh->cache_hits_per_sec) . td_num3($vh->total_private_cache_hits, $vh->private_cache_hits_per_sec) . td_num2($vh->eap_process) . td_num2($vh->eap_inuse) . td_num2($vh->eap_idle) . td_num2($vh->eap_waitQ) . td_num2($vh->eap_req_per_sec, 1) . $etr; } echo $buf; } ?>
' . "\n"; $buf .= '' . "\n"; $buf .= '' . "\n"; $buf .= '
Virtual Host Hide'; } else { $buf = ''; } $buf .= 'Display: Filter by Name (take regExp): Sort by: '; echo $buf; ?>
VH Name Req in ProcessingReq/SecTotal Static Hits | Hits/SecPublic Cache Hits | Hits/SecPrivate Cache Hits | Hits/SecExtApp ProcessesEAProc In UseEAProc IdleEAProc WaitQEAProc Req/Sec
' . $vhname . '' . graph_icon('VH', $vhname) . '
' . "\n"; if ($eap_show_ind == 'Show') { $buf .= '' . '' . '' . '' . $etr; $exapps = $stats->apply_eap_filter($eap_show_top, $eap_show_filter, $eap_show_sort); foreach ($exapps as $eap) { $buf .= ''; $buf .= ''; $buf .= ''; $buf .= ''; $buf .= td_num2($eap->config_max_conn) . td_num2($eap->effect_max_conn) . td_num2($eap->pool_size) . td_num2($eap->inuse_conn) . td_num2($eap->idle_conn) . td_num2($eap->waitqueue_depth) . td_num2($eap->req_per_sec, 1) . $etr; } } echo $buf; ?>
' . '' . '' . "\n"; $buf .= '' . "\n"; $buf .= '' . "\n"; $buf .= '' . '
External Application'; if ($eap_show_ind == 'Show') { $buf .= ''; } else { $buf .= ''; } $buf .= 'Display: Filter by Name (take regExp): Sort by:
ScopeTypeName Max ConnEff MaxPoolIn UseIdleWaitQReq/Sec
' . $eap->vhost . '' . $eap->type . '' . $eap->extapp . '' . graph_icon('EXTAPP', $eap->vhost, $eap->extapp) . '