Files
web.ems/wxc2_omc/fault/serverStatusImprove/server_status.php
agtuser 16a3fd1e1b init
2024-11-11 17:56:00 +08:00

271 lines
9.4 KiB
PHP
Executable File

<?php
require("../../inc/header.inc");
?>
<script language="JavaScript">
var line_id_arr = new Array();
var line_id_index = 0;
function clearAll() {
// for (i = 0; i < line_id_index; i++) {
// document.getElementById(line_id_arr[i]).style.display = 'none';
// }
// document.getElementById('blank_line').style.display = '';
window.location.href = "./server_status.php?clearAll=1";
}
</script>
<body onload="javascript:adjust();" onresize="javascript:adjust();" leftmargin="15"
style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">
<?php
require("./function.inc");
function AddLine($line_id)
{
echo "\n<script language=\"JavaScript\">\n";
echo "line_id_arr[line_id_index++]='$line_id';\n";
echo "</script>\n";
}
?>
<?php
adjust_head();
adjust_title_head();
echo "<meta http-equiv=\"refresh\" content=\"10; url=$PHP_SELF\">";
echo "<FORM NAME=\"downForm\" action=\"./server_status.php\" method=\"post\">";
echo "<table id=\"table_up\" border=\"0\" width=\"100%\">";
echo "<tr>";
echo "<td width=\"50%\">";
echo "$strSysStatus > NSS > Application";
echo "</td>";
echo "<td width=\"50%\" align=\"right\" title=\"Help\">";
$helpId = "1.2.2";
showHelp($helpId);
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"50%\">";
echo "&nbsp;";
echo "</td>";
echo "<td width=\"50%\" align=\"right\" title=\"Clear\">";
echo "<a href=# onClick=\"javascript:clearAll();\"><img align=absBottom border=0 src=\"../../images/delete.gif\" width=\"14\" height=\"14\">$strClear</a>";
echo "</td>";
echo "</tr>";
echo "</table>";
adjust_title_tail();
adjust_content_head();
if ($_REQUEST['clearAll'] == 1) {
$sql = "delete from OMC_PUB.sysInfo ";
@mysqli_query($pubConn, $sql);
echo mysqli_error($pubConn);
}
$config = parse_ini_file("config.ini", true);
$config_count = sizeof($config);
//echo "config_count=$config_count<br>";
echo "<br>";
echo "<center><font size=2 color=\"blue\">Server summary information</font></center>";
echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#ffffff\">";
echo "<tr bgcolor=\"#E6E6E6\">";
echo "<td width=\"15%\">Item</td>";
echo "<td width=\"15%\">Application Status</td>";
echo "<td width=\"15%\">Platform Module</td>";
echo "<td width=\"20%\">Refresh Time</td>";
echo "<td width=\"15%\">Version</td>";
echo "<td width=\"20%\">IP Address</td>";
echo "</tr>";
for ($index = 0; $index < $config_count; $index++) {
$module = GetModuleInfo($config[$index]);
if (is_array($module)) $module_count = sizeof($module);
if ($module == 0) continue;
for ($sysNo = 0; $sysNo < $config[$index]['MaxSysNo']; $sysNo++) {
$isfind = 0;
$module_index = -1;
for ($i = 0; $i < $module_count; $i++) {
if ($module[$i]['sysNo'] == $sysNo) {
$isfind = 1;
$module_index = $i;
break;
}
}
$line_id = "{$config[$index]['SysTypeNo']}_{$sysNo}";
AddLine($line_id);
if ($isfind) {
echo "<tr id=\"$line_id\">";
//Name
echo "<td>";
echo "<span id=\"{$line_id}_Name\" style=\"color:{$module[$module_index]['Name']['Color']};\">";
echo "{$module[$module_index]['Name']['Value']}";
echo "</span>";
echo "</td>";
//Application Status
echo "<td>";
echo "<a href=\"server_status_detail.php?sysTypeNo={$config[$index]['SysTypeNo']}&sysNo={$sysNo}\">";
echo "<span id=\"{$line_id}_AppStatus\" style=\"color:{$module[$module_index]['AppStatus']['Color']};\">";
echo "{$module[$module_index]['AppStatus']['Value']}";
echo "</span>";
echo "</a>";
echo "</td>";
//Platform Status
echo "<td>";
echo "<span id=\"{$line_id}_PlatStatus\" style=\"color:{$module[$module_index]['PlatStatus']['Color']};\">";
echo "{$module[$module_index]['PlatStatus']['Value']}";
echo "</span>";
echo "</td>";
//Refresh Time
echo "<td>";
echo "<span id=\"{$line_id}_RefreshTime\" style=\"color:{$module[$module_index]['RefreshTime']['Color']};\">";
echo "{$module[$module_index]['RefreshTime']['Value']}";
echo "</span>";
echo "</td>";
//Version
echo "<td>";
echo "<span id=\"{$line_id}_Version\" style=\"color:{$module[$module_index]['Version']['Color']};\">";
echo "{$module[$module_index]['Version']['Value']}";
echo "</span>";
echo "</td>";
//IPAddress
echo "<td>";
echo "<span id=\"{$line_id}_IPAddress\" style=\"color:{$module[$module_index]['IPAddress']['Color']};\">";
echo "{$module[$module_index]['IPAddress']['Value']}";
echo "</span>";
echo "</td>";
echo "</tr>";
} else {
echo "<tr id=\"$line_id\" style=\"display:none;\">";
//Name
echo "<td>";
echo "<span id=\"{$line_id}_Name\" style=\"color:#000000;\">";
echo "{$config[$index]['Module']}_{$sysNo}";
echo "</span>";
echo "</td>";
//Application Status
echo "<td>";
echo "<a href=\"server_status_detail.php?sysTypeNo={$config[$index]['SysTypeNo']}&sysNo={$sysNo}\">";
echo "<span id=\"{$line_id}_AppStatus\" style=\"color:#000000;\">";
echo "--";
echo "</span>";
echo "</a>";
echo "</td>";
//Platform Status
echo "<td>";
echo "<span id=\"{$line_id}_PlatStatus\" style=\"color:#000000;\">";
echo "--";
echo "</span>";
echo "</td>";
//Refresh Time
echo "<td>";
echo "<span id=\"{$line_id}_RefreshTime\" style=\"color:#000000;\">";
echo "--";
echo "</span>";
echo "</td>";
//Version
echo "<td>";
echo "<span id=\"{$line_id}_Version\" style=\"color:#000000;\">";
echo "--";
echo "</span>";
echo "</td>";
//IPAddress
echo "<td>";
echo "<span id=\"{$line_id}_IPAddress\" style=\"color:#000000;\">";
echo "--";
echo "</span>";
echo "</td>";
echo "</tr>";
}
}
}
echo "</table>";
echo "<table border=\"0\" width=\"100%\">";
echo "<tr>";
echo "<td width=\"50%\" align=\"left\">";
echo "Remarks: <font color=\"blue\">Y</font> = Normal, <font color=\"red\">N</font> = Abnormal, -- = None.";
echo "</td>";
echo "<td width=\"50%\" align=\"right\" title=\"Clear\">";
echo "<a href=# onClick=\"javascript:clearAll();\"><img align=absBottom border=0 src=\"../../images/delete.gif\" width=\"14\" height=\"14\">$strClear</a>";
echo "</td>";
echo "</tr>";
echo "</table>";
adjust_content_tail();
?>
<script language="JavaScript">
function updateStatus() {
var nowTime = new Date().getTime();
var fixurl = "./server_status_update.php?time=" + nowTime;
var browserr = navigator.appName;
if (browserr == "Microsoft Internet Explorer") {
request_oo = new ActiveXObject("Microsoft.XMLHTTP");
} else {
request_oo = new XMLHttpRequest();
}
request_oo.open("GET", fixurl, "false");
request_oo.onreadystatechange = function () {
checUpdateState();
}
request_oo.send(null);
setTimeout("updateStatus()", 10000);
}
function checUpdateState() {
//not
if (request_oo.readyState == 3) {
//alert("not finish");
}
if (request_oo.readyState == 4) {
var response = request_oo.responseText;
//alert(response);
var module = response.split(';');
for (i = 0; i < module.length; i++) {
var items = module[i].split(',');
//alert(items.length);
if (items.length < 2)
continue;
var line_id = items[0].replace(/(^\s*)|(\s*$)/g, "");
var line_state = items[1].replace(/(^\s*)|(\s*$)/g, "");
if (line_state == 'none') {
document.getElementById(line_id).style.display = 'none';
} else {
document.getElementById(line_id).style.display = '';
var z = 0;
var item_id;
var item_value;
var item_color;
for (j = 2; j < items.length; j++) {
if (z == 0) {
item_id = items[j].replace(/(^\s*)|(\s*$)/g, "");
} else if (z == 1) {
item_value = items[j].replace(/(^\s*)|(\s*$)/g, "");
} else {
item_color = items[j].replace(/(^\s*)|(\s*$)/g, "");
//alert("value:"+item_value+",color:"+item_color);
document.getElementById(item_id).style.color = item_color;
document.getElementById(item_id).innerHTML = item_value;
}
z++;
z = z % 3;
}
}
}
}
}
//updateStatus();
</script>