method=POST>

### ######## SYSTEM-HOSTING SERVICE STATUS ########

"; $fp = @fsockopen("udp://{$server_addr[$i][0]}", $server_addr[$i][1], $errno, $errstr); if (!$fp) { echo "ERROR: $errno - $errstr
\n"; continue; } else { fwrite($fp,"GET_SERVSTATUS", 15); while(1) { $test2 = fread($fp, 2048); $test .= trim($test2); $j = strlen($test2); if($j < 1024) break; } fclose($fp); } ?> "; //$test = str_replace("1|6|SORIBADA_DB01|222.122.153.2|5432|1151049193|-|-|-|-|\r\n1|6|SORIBADA_DB03|222.122.153.4|5432|1151049193|-|-|-|-|\r\n", "", $test); $pt = new parsePipe(); $test = $pt->nullTrim($test); //echo ""; $tmpArr = $pt->textArr($test); $serviceName = $pt->serviceName($test); $result = $pt->parseIt($tmpArr[$serviceType]); $tot_tr = $pt->countIt(); //print_r($serviceName); if($serviceName[$serviceType] != 'SORIBADA') exit; ?>

Name | Server IP | Server Port | Last Status Changed At | Last Disk Checked At | Domain | Total Disk | Free | Used
translateIt($result[$j][0], 2). " [SERVER NAME] : ".$result[$j][2]. " [SERVER IP] : ".$pt->translateIt($result[$j][3],3). " [SERVER PORT] : ".$pt->translateIt($result[$j][4],4); $totalDisk += $result[$j][8]; $freeDisk += $result[$j][9]; $usedDisk += ($result[$j][8] - $result[$j][9]); if($result[$j][2]=="SORIBADA_DB01" || $result[$j][2] == "SORIBADA_DB02" || $result[$j][2] == "SORIBADA_DB03") { continue; } ?>
(translateIt($result[$j][0],1)?> translateIt($result[$j][1],0)?>) | translateIt($result[$j][3],3)?> | translateIt($result[$j][4],4)?> |  |  | translateIt($result[$j][7],7)?> | translateIt($result[$j][8],8)?> | translateIt(trim($result[$j][9]), 8)?> | translateIt($result[$j][8]-$result[$j][9], 8); ?>
Storage Total | translateIt($totalDisk, 9)?> | translateIt($freeDisk, 9)?> | translateIt($usedDisk, 9)?>

"; // } ?>

1000) $refresh_rate = 60; ?>

Refresh Rate : > (MIN : 1, MAX : 1000)

method=POST>
tot_line = count($temp_arr) == 1 ? 0 : count($temp_arr) - 1; for($i=0; $i < $this->tot_line; $i++){ //if(!strpos($temp_arr[$i], "DB") && $temp_arr[$i]!='') { if($temp_arr[$i]!='') { $result_arr[$i] = explode("|", $temp_arr[$i]); $result_arr[$i][10] = ""; $tmp_arr[$i] = ($result_arr[$i][9] == '' || $result_arr[$i][9] == '-') ? 0 : $this->nullTrim($result_arr[$i][9]); $result_arr[$i][8] = $this->nullTrim($result_arr[$i][8]); $result_arr[$i][9] = $this->nullTrim($result_arr[$i][9]); $result_arr[$i][10] = $this->nullTrim($result_arr[$i][10]); if($result_arr[$i][9] != '-' && $result_arr[$i] != '' && $result_arr[$i] != 0) { if($cnt == 0) { $minValue = $result_arr[$i][9]; $cnt++; } if($minValue > $result_arr[$i][9]) { $minValue = $result_arr[$i][9]; } } } } $cnt = 0; arsort($tmp_arr); reset($tmp_arr); while (list ($key, $val) = each ($tmp_arr)) { //echo "$key = $val
"; if($val != 0) { if($cnt == 0) { $maxValue = $val; $result_arr[$key][10] = "99FFFF"; $cnt++; } else { //if($minValue == $val) { if($val < (2 * 1024 * 1024 * 1024 * 10)) { $result_arr[$key][10] = "red"; }else if(($maxValue - $val) < (1024 * 1024 * 1024)) { //echo "1GB Highed
"; $result_arr[$key][10] = "99FFFF"; } else { //echo "1GB Lowed
"; $result_arr[$key][10] = "yellow";//$maxValue; } } } else { $result_arr[$key][10] = "white"; } } return $result_arr; } function countIt(){ return $this->tot_line; } function translateIt($parsedText, $type){ if($parsedText == '') return; $eServerType = array('WWW', 'RTS', 'RC', 'CCDB', 'RCTS', 'GTS', "RCDB"); /*$eStatus = array('UNKNOWN', 'ALIVE', 'DEAD');*/ $eStatus = array('UNKNOWN', '', ''); $eStatusChar = array('UNKNOWN', 'ALIVE', 'DEAD'); switch($type){ case 0: return $eServerType[$parsedText]; case 1: return $eStatus[$parsedText]; case 2: return $eStatusChar[$parsedText]; case 8: if(trim($parsedText) == "-" || $parsedText == "") return "-"; else return sprintf("%.2lfG", (trim($parsedText) / 1024) / 1024 / 1024); case 9: if(trim($parsedText) == "-" || $parsedText == "" ) return "-"; else { if (trim($parsedText) / 1024 / 1024 / 1024 > 1024) { return sprintf("%.2fT", trim($parsedText) / 1024 / 1024 / 1024 / 1024); } else return sprintf("%.2fG", trim($parsedText) / 1024 / 1024 / 1024); } default: return $parsedText; } } function nullTrim($tmp_str) { $return_str = ""; $maxLength = strlen($tmp_str); for($i=0 ; $i < $maxLength ; $i++) { if(ord(substr($tmp_str, $i, 1)) != 0) { $return_str .= substr($tmp_str, $i, 1); } } return $return_str; } function textArr($text) { $cnt = -1; $tmp_cnt = 0; $str_arr = array(); $tmp_search_str = ""; $temp_arr = explode("\r\n", $text); //echo ""; for($i=0; $i<sizeof($temp_arr); $i++) { $split_str = explode("|", $temp_arr[$i]); $search_str = explode("_", $split_str[2]); if($tmp_search_str != $search_str[0]) { $tmp_search_str = $search_str[0]; //$str_arr[$cnt][30] = $search_str[0]; //echo $str_arr[$cnt][0]."<br>".$tmp_search_str."->".$cnt."<-"."
"; $cnt++; } $str_arr[$cnt] .= $temp_arr[$i]."\r\n"; } return $str_arr; } function serviceName($text) { $cnt = -1; $tmp_cnt = 0; $str_arr = array(); $tmp_search_str = ""; $temp_arr = explode("\r\n", $text); for($i=0; $i<sizeof($temp_arr); $i++) { $split_str = explode("|", $temp_arr[$i]); $search_str = explode("_", $split_str[2]); if($tmp_search_str != $search_str[0]) { $tmp_search_str = $search_str[0]; $cnt++; } $str_arr[$cnt] = $tmp_search_str; } return $str_arr; } } ?>