init web ems all
This commit is contained in:
114
wxc2_omc/fault/serverStatusImprove/server_status_update.php
Executable file
114
wxc2_omc/fault/serverStatusImprove/server_status_update.php
Executable file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
require("../../inc/lib.inc");
|
||||
require("./function.inc")
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
$config=parse_ini_file("config.ini",true);
|
||||
$config_count=sizeof($config);
|
||||
|
||||
$total_response="";
|
||||
$show_num=0;
|
||||
|
||||
for($index=0;$index<$config_count;$index++)
|
||||
{
|
||||
$checksql="SELECT * FROM elementExistConf WHERE elementTypeNo={$config[$index]['SysTypeNo']} and existFlag=1 ";
|
||||
// $checkres=@mysqli_query($pubConn,$checksql);
|
||||
// $checknum=mysqli_num_rows($checkres);
|
||||
$checkres = mysqli_query($pubConn, $checksql);
|
||||
$checknum = mysqli_num_rows($checkres);
|
||||
for($sysNo=0;$sysNo<$config[$index]['MaxSysNo'];$sysNo++)
|
||||
{
|
||||
$sql_plat="select * from OMC_PUB.sysStat where sysTypeNo=200 and sysNo={$config[$index]['PlatNo']} and subSysNo={$sysNo} ";
|
||||
// $res_plat=mysqli_query($pubConn,$sql_plat);
|
||||
// $num_plat=mysqli_num_rows($res_plat);
|
||||
|
||||
$res_plat= mysqli_query($pubConn, $sql_plat);
|
||||
$num_plat = mysqli_num_rows($res_plat);
|
||||
|
||||
|
||||
if($config[$index]['PlatNo'] == 999)
|
||||
$num_plat=1;
|
||||
$sql="select * from OMC_PUB.sysInfo where sysTypeNo={$config[$index]['SysTypeNo']} and sysNo={$sysNo} ";
|
||||
// $res=mysqli_query($pubConn,$sql);
|
||||
// $num=mysqli_num_rows($res);
|
||||
|
||||
$res= mysqli_query($pubConn, $sql);
|
||||
$num = mysqli_num_rows($res);
|
||||
|
||||
$id="{$config[$index]['SysTypeNo']}_{$sysNo}";
|
||||
//Display Status
|
||||
if($num == 0 || $checknum == 0)
|
||||
{
|
||||
$response="{$id},none;";
|
||||
$total_response.=$response;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$response="{$id},block,";
|
||||
$show_num++;
|
||||
}
|
||||
|
||||
$row=mysqli_fetch_array($res);
|
||||
//Module Name
|
||||
//if($config[$index][SysTypeNo] == 362)
|
||||
// $response.="{$id}_Name,{$config[$index][Module]},#000000,";
|
||||
//else
|
||||
$response.="{$id}_Name,{$config[$index]['Module']}_{$sysNo},#000000,";
|
||||
|
||||
|
||||
//Refresh Time
|
||||
$refresh_time=$row['updateTime'];
|
||||
$due_date=date("Y-m-d H:i:s",mktime(date("H"),date("i"),date("s")-60,date("m"),date("d"),date("Y")));
|
||||
$ove_date=date("Y-m-d H:i:s",mktime(date("H"),date("i"),date("s")+60,date("m"),date("d"),date("Y")));
|
||||
if($refresh_time < $due_date || $refresh_time > $ove_date)
|
||||
{
|
||||
$response.="{$id}_RefreshTime,$refresh_time,#ff0000,";
|
||||
$valid_time=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$response.="{$id}_RefreshTime,$refresh_time,#0000ff,";
|
||||
$valid_time=1;
|
||||
}
|
||||
|
||||
//Application Status
|
||||
$baseStat=$row['baseStat']+0;
|
||||
if($valid_time && $baseStat)
|
||||
{
|
||||
$response.="{$id}_AppStatus,Y,#0000ff,";
|
||||
}
|
||||
else
|
||||
{
|
||||
$response.="{$id}_AppStatus,N,#ff0000,";
|
||||
}
|
||||
|
||||
//Platform Status
|
||||
if($num_plat == 1)
|
||||
{
|
||||
$response.="{$id}_PlatStatus,Y,#0000ff,";
|
||||
}
|
||||
else
|
||||
{
|
||||
$response.="{$id}_PlatStatus,N,#ff0000,";
|
||||
}
|
||||
|
||||
//Version
|
||||
$version=GetModuleVersion($config[$index]['SysTypeNo'],$sysNo,0);
|
||||
$response.="{$id}_Version,{$version},#000000,";
|
||||
|
||||
//IPAddress
|
||||
$response.="{$id}_IPAddress,{$row['ip']},#000000;";
|
||||
|
||||
$total_response.=$response;
|
||||
}
|
||||
}
|
||||
if($show_num)
|
||||
$total_response.="blank_line,none;";
|
||||
$total_response=substr($total_response,0,strlen($total_response)-1);
|
||||
echo $total_response;
|
||||
//system("echo '$total_response' >> /tmp/test.txt");
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user