Files
web.ems/wxc2_omc/performance/mhcCsta/csta_down.php
agtuser 16a3fd1e1b init
2024-11-11 17:56:00 +08:00

290 lines
8.5 KiB
PHP
Executable File

<?php
require("../../inc/header.inc");
?>
<?php
//============scroll the page====================
if($scroll_y > 0){
//echo "<body style=\"overflow-x:hidden\" topmargin=\"5\" leftmargin=\"12\" onLoad='self.scrollBy(0,$scroll_y)'>";
echo "<body leftmargin=\"15\" rightmargin=\"10\" onload=\"javascript:scroll_div('$scroll_y');javascript:adjust_frame('down');\" onresize=\"javascript:adjust_frame('down');\" style=\"overflow:hidden;overflow-x:hidden;overflow-y:hidden;\">";
}else{
echo "<body leftmargin=\"15\" rightmargin=\"10\" onload=\"javascript:adjust_frame('down');\" onresize=\"javascript:adjust_frame('down');\" style=\"overflow:hidden;overflow-x:hidden;overflow-y:hidden;\">";
}
adjust_head_frame("down");
adjust_title_head_frame("down");
adjust_title_tail_frame("down");
adjust_content_head_frame("down");
echo "<br>";
//=====================================================================================|
//============================Function Flag============================================|
//=====================================================================================|
$Hide_Show_Function_On=0;
$DEBUG=0;
//=====================================================================================|
//============================Data From Index Page=====================================|
//=====================================================================================|
if(0)
{
$url_temp=$_SERVER["REQUEST_URI"];
echo "This page URL:$url_temp<br>";
echo "sel_date_from:$sel_date_from<br>";
echo "sel_date_to:$sel_date_to<br>";
}
//=====================================================================================|
//============================Define The Data==========================================|
//=====================================================================================|
$csta_field=array(
0=>"hlr_noti_mhc",
1=>"mhc_noti_hlr",
2=>"rep_att",
3=>"rep_suc",
4=>"rep_fail",
5=>"veri_att",
6=>"veri_suc",
7=>"veri_fail",
8=>"veri_del_att",
9=>"veri_del_suc",
10=>"veri_del_fail",
11=>"veri_dld_att",
12=>"veri_dld_suc",
13=>"veri_dld_fail",
14=>"mhc_msg_sent",
15=>"mhc_msg_recv",
);
$csta_show_field=array(
0=>"HLR Notify MHC",
1=>"MHC Notify HLR",
2=>"Replication Attempt",
3=>"Replication Success",
4=>"Replication Fail",
5=>"Verification Attempt",
6=>"Verification Success",
7=>"Verification Fail",
8=>"Verification Deleted Attempt",
9=>"Verification Deleted Success",
10=>"Verification Deleted Fail",
11=>"Verification Download Attempt",
12=>"Verification Download Success",
13=>"Verification Download Fail",
14=>"MHC Message Sent",
15=>"MHC Message Received",
);
//data define
for($i=0;$i<sizeof($csta_field);$i++)
{
$service_csta[$i]=0;
}
/*
0-16 MHC Node
0-6 out_attempt,out_success,out_fail,in_attempt,in_success,in_fail
*/
for($i=0;$i<16;$i++)
{
for($j=0;$j<6;$j++)
{
$sync_csta[$i][$j]=0;
}
}
//===================================================================================|
//========================Get The Data From DB=======================================|
//===================================================================================|
$db="CSTA_DB";
$bgn_time=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
$end_time=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_to,date("Y")));
//get the numbers of days that selected
$slot=$sel_date_from-$sel_date_to+1;
if(0)
{
echo "bgn_time:$bgn_time<br>";
echo "end_time:$end_time<br>";
echo "slot:$slot<br>";
echo "db:$csta_db<br>";
}
$sql_sum="";
for($i=0;$i<sizeof($csta_field);$i++)
{
$sql_sum.="sum(".$csta_field[$i].") as ".$csta_field[$i].",";
}
for($i=0;$i<96;$i++)
{
$j=$i%6;
$k=floor($i/6);
switch($j)
{
case 0:
$sql_sum.="sum(syn_o_a_".$k.") as syn_o_a_".$k.",";
break;
case 1:
$sql_sum.="sum(syn_o_s_".$k.") as syn_o_s_".$k.",";
break;
case 2:
$sql_sum.="sum(syn_o_f_".$k.") as syn_o_f_".$k.",";
break;
case 3:
$sql_sum.="sum(syn_i_a_".$k.") as syn_i_a_".$k.",";
break;
case 4:
$sql_sum.="sum(syn_i_s_".$k.") as syn_i_s_".$k.",";
break;
case 5:
$sql_sum.="sum(syn_i_f_".$k.") as syn_i_f_".$k.",";
break;
}
}
$sql_sum=substr($sql_sum,0,strlen($sql_sum)-1);
//$key_type_relation=array(5=>0,6=>1,7=>2,8=>3,9=>4,10=>5,11=>6,12=>7,13=>8,14=>9,15=>10,16=>11);
for($day=0;$day<$slot;$day++)
{
$table_name="mhcDetail";
$temp=date("d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day,date("Y")));
$table_name=$table_name."_".$temp;
//echo "table_name:$table_name<br>";
$from_time=date("Y-m-d H:i:s",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day,date("Y")));
$to_time=date("Y-m-d H:i:s",mktime(23,0,0,date("m"),date("d")-$sel_date_from+$day,date("Y")));
//echo "from:$from_time--to:$to_time<br>";
$select="select $sql_sum ";
$from="from $table_name ";
$service_where="and key_type=1 ";
$where="where csta_datetime >='$from_time' and csta_datetime <'$to_time' ".$service_where;
$group="group by key_type ";
$order="order by key_type ";
$sql=$select.$from.$where.$group.$order;
//echo "$sql<br>";
$result=@mysqli_query($pubConn,$sql);
$rows=@mysqli_fetch_array($result);
if(!$rows)
continue;
do{
$field_num=sizeof($csta_field);
for($tt=0;$tt<$field_num;$tt++)
{
$service_csta[$tt]+=$rows[$tt];
}
for($tt=0;$tt<16;$tt++)
{
for($i=0;$i<6;$i++)
{
$sync_csta[$tt][$i]+=$rows[$field_num+$tt*6+$i]+0;
}
}
}while($rows=mysqli_fetch_array($result));
}
//get the 0-hour of the day
for($day=0;$day<$slot;$day++)
{
$table_name="mhcDetail";
$temp=date("d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day-1,date("Y")));
$table_name=$table_name."_".$temp;
//echo "table_name:$table_name<br>";
$from_time=date("Y-m-d H:i:s",mktime(23,0,0,date("m"),date("d")-$sel_date_from+$day-1,date("Y")));
$to_time=date("Y-m-d H:i:s",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day,date("Y")));
//echo "from:$from_time--to:$to_time<br>";
$select="select $sql_sum ";
$from="from $table_name ";
$service_where="and key_type=1 ";
$where="where csta_datetime >='$from_time' and csta_datetime <'$to_time' ".$service_where;
$group="group by key_type ";
$order="order by key_type ";
$sql=$select.$from.$where.$group.$order;
//echo "$sql<br>";
$result=@mysqli_query($pubConn,$sql);
$rows=@mysqli_fetch_array($result);
if(!$rows)
continue;
do{
$field_num=sizeof($csta_field);
for($tt=0;$tt<$field_num;$tt++)
{
$service_csta[$tt]+=$rows[$tt];
}
for($tt=0;$tt<16;$tt++)
{
for($i=0;$i<6;$i++)
{
$sync_csta[$tt][$i]+=$rows[$field_num+$tt*6+$i]+0;
}
}
}while($rows=mysqli_fetch_array($result));
}
//===================================================================================|
//=======================Show The Table-1============================================|
//===================================================================================|
//===table title
if($slot==1)
$table_title="Statistic Date:".$bgn_time;
else
$table_title="Statistic Date:".$bgn_time." to ".$end_time;
echo "<center><b>$table_title</b></center>";
echo "<table border=\"1\" width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
echo "<tr bgcolor=\"#E6E6E6\">";
echo "<td align=\"center\" width=\"50%\">Type</td>";
echo "<td align=\"center\" width=\"50%\">Value</td>";
echo "</tr>";
for($i=0;$i<sizeof($csta_field);$i++)
{
echo "<tr>";
echo "<td>{$csta_show_field[$i]}</td>";
echo "<td>{$service_csta[$i]}</td>";
echo "</tr>";
}
echo "</table>";
echo "<table border=\"1\" width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
echo "<tr bgcolor=\"#E6E6E6\">";
echo "<td rowspan=2 width=10%>Node Index</td>";
echo "<td colspan=3 align=center>Synchronization Outgoing</td>";
echo "<td colspan=3 align=center>Synchronization Incoming</td>";
echo "</tr>";
echo "<tr bgcolor=\"#E6E6E6\">";
echo "<td align=center>Attempt</td>";
echo "<td align=center>Success</td>";
echo "<td align=center>Fail</td>";
echo "<td align=center>Attempt</td>";
echo "<td align=center>Success</td>";
echo "<td align=center>Fail</td>";
echo "</tr>";
echo "</tr>";
for($i=0;$i<16;$i++)
{
echo "<tr>";
echo "<td>$i</td>";
for($j=0;$j<6;$j++)
{
echo "<td>{$sync_csta[$i][$j]}</td>";
}
echo "</tr>";
}
echo "</table>";
adjust_content_tail("down");
?>
</body>