Exemplo n.º 1
0
}
if (!empty($result)) {
    foreach ($result as $rItem) {
        $lossDay[] = $rItem['DATE_JG'];
        $lossTimeOut[] = $rItem['TIME_OUT'];
        $lossPerc[] = floatval($rItem['PERC']);
    }
}
$lossDay = json_encode($lossDay);
$lossTimeOut = json_encode($lossTimeOut);
$lossPerc = json_encode($lossPerc);
//机房掉包量 总数
$lossSummaryData = array();
$lossSummaryData['TIME_OUT'] = 0;
$lossSummaryData['TIME_OUT_PERC'] = 0;
$result = PacketLossRate::getSumLossRateByroom($ip, $start_date, $end_date);
if (!empty($result) && count($result) > 0) {
    $sum = $result[0]['TIME_OUT'];
    if (empty($sum)) {
        $sum = 0;
    }
    $d1 = strtotime($start_date);
    $d2 = strtotime($end_date);
    $disDay = round(($d2 - $d1) / 3600 / 24);
    if ($disDay == 0) {
        $perc = 0;
    } else {
        $perc = number_format($sum / (86400 * $disDay), 6) * 100;
    }
    $lossSummaryData['TIME_OUT'] = $sum;
    $lossSummaryData['TIME_OUT_PERC'] = $perc;
Exemplo n.º 2
0
        }
    }
    if ($chk_ip500 == 1) {
        //ip500
        $queryTable = 'SPLUNK_PING_IP500';
        if ($queryType == 0) {
            //汇总方式: 0:分钟,1:小时,2:天
            $list_ip500 = PacketLossRate::getLossRateByMinute($ip, $start_date, $end_date, $queryTable);
        } else {
            if ($queryType == 1) {
                $list_ip500 = PacketLossRate::getLossRateByHours($ip, $start_date, $end_date, $queryTable);
            } else {
                if ($queryType == 2) {
                    $start_date = date('Ymd 00:00:00', $start_date_time);
                    $end_date = date('Ymd 00:00:00', $end_date_time);
                    $list_ip500 = PacketLossRate::getLossRateByDay($ip, $start_date, $end_date, $queryTable);
                }
            }
        }
    }
}
//内网
$day_i = array();
$pingnum_i = array();
$timeout_i = array();
$perc_i = array();
foreach ($list_i as $item) {
    $day_i[] = $item['DATE_JG'];
    if ($queryType == 0) {
        $pingnum_i[] = empty($item['PING_NUM']) ? 0 : $item['PING_NUM'];
    }
Exemplo n.º 3
0
$list = array();
$start_date_time = strtotime($start_date);
$end_date_time = strtotime($end_date);
$start_date = date('Ymd H:i:s', $start_date_time);
$end_date = date('Ymd H:i:s', $end_date_time);
$tableName = 'SPLUNK_PING';
if ($chkType == 1) {
    $tableName = 'SPLUNK_PING_WW';
} else {
    if ($chkType == 2) {
        $tableName = 'SPLUNK_PING_IP500';
    }
}
$return = PacketLossRate::getLossRateAllCount($start_date, $end_date, $tableName);
$row_count = $return[0]['NUM'];
$list = PacketLossRate::getLossRateAll($start_date, $end_date, $tableName, 0, $row_count);
export_csv($list);
function export_csv($list)
{
    $filename = date('YmdHis') . ".csv";
    //文件名
    header("Content-type:text/csv");
    header("Content-Disposition:attachment;filename=" . $filename);
    header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
    header('Expires:0');
    header('Pragma:public');
    echo array_to_string($list);
}
function array_to_string($result)
{
    $data = i('IP,PING次数,掉包量' . "\n");
Exemplo n.º 4
0
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2015/7/13
 * Time: 16:29
 * IP500掉包率导出
 */
require '../../include/init.inc.php';
$start_date = $end_date = $ip = "";
$_POST['ip'] = empty($_POST['ip']) ? '' : $_POST['ip'];
$_POST['start_date'] = empty($_POST['start_date']) ? date("Y-m-d", time() - 86400) : $_POST['start_date'];
$_POST['end_date'] = empty($_POST['end_date']) ? date("Y-m-d", time() + 86400) : $_POST['end_date'];
extract($_POST, EXTR_IF_EXISTS);
$list = array();
$list = PacketLossRate::getIp500LossRate($start_date, $end_date);
foreach ($list as &$item) {
    $item['PREC_TIME_OUT'] = floatval($item['PREC_TIME_OUT']);
}
export_csv($list);
function export_csv($list)
{
    $filename = date('YmdHis') . ".csv";
    //文件名
    header("Content-type:text/csv");
    header("Content-Disposition:attachment;filename=" . $filename);
    header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
    header('Expires:0');
    header('Pragma:public');
    echo array_to_string($list);
}
Exemplo n.º 5
0
$start_date_time = strtotime($start_date);
$end_date_time = strtotime($end_date);
$start_date = date('Ymd H:i:s', $start_date_time);
$end_date = date('Ymd H:i:s', $end_date_time);
$tableName = 'SPLUNK_PING';
if ($chkType == 1) {
    $tableName = 'SPLUNK_PING_WW';
} else {
    if ($chkType == 2) {
        $tableName = 'SPLUNK_PING_IP500';
    }
}
$return = PacketLossRate::getLossRateAllCount($start_date, $end_date, $tableName);
$row_count = $return[0]['NUM'];
$page_size = 15;
$page_no = $page_no < 1 ? 1 : $page_no;
$total_page = $row_count % $page_size == 0 ? $row_count / $page_size : ceil($row_count / $page_size);
$total_page = $total_page < 1 ? 1 : $total_page;
$page_no = $page_no > $total_page ? $total_page : $page_no;
$start = ($page_no - 1) * $page_size;
$list = PacketLossRate::getLossRateAll($start_date, $end_date, $tableName, $start, $page_size);
foreach ($list as &$item) {
    $item['PING'] = number_format($item['PING']);
    $item['TIME_OUT'] = number_format($item['TIME_OUT'], 2);
    $item['TIME_JG'] = number_format($item['TIME_JG'], 2);
}
$page_html = Pagination::showPager("lossRateAllPc.php?start_date={$start_date}&end_date={$end_date}&chkType={$chkType}", $page_no, 15, $row_count);
Template::assign('list', $list);
Template::assign('page_html', $page_html);
Template::assign('_GET', $_GET);
Template::display('netshow/idc/lossRateAllPc.tpl');