method=POST>

### CDN Storage System
( cs-gms.myskcdn.co.kr )

*/ $server_addr[0][0] = "127.0.0.1"; $server_addr[0][1] = "30001"; $server_addr[0][2] = "SKB"; $tot = count($server_addr); //echo "total server :".$tot."
"; for($i=0; $i < $tot; $i++){ //echo "server_addr = ".$server_addr[$i][0]."
"; //echo "server_port = ".$server_addr[$i][1]."
"; if($i%3 == 0) echo "

"; $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); $test .= trim($test2, " \0"); $j = strlen($test2); if($j < 1024) break; } $test = trim($test); fclose($fp); } //echo "Received Message Length : ".strlen($test); echo ""; ?>

nullTrim($test); $tmpArr = $pt->textArr($test); $serviceName = $pt->serviceName($test); $result = $pt->parseIt($tmpArr[$serviceType]); $tot_tr = $pt->countIt(); // get rc_list to Database $objConn = new DB_Sql; $strSQL = " SELECT " . " rcid, rc_name, arrange, reg_datetime, update_datetime " . " FROM t_rms_rc_index " . " WHERE deleted_yn = 'N' "; $objConn->query( $strSQL ); $rc_list; if( $objConn->nf() != 0 ) { while( $objConn->next_record() ) { $rc_list[$objConn->f("rcid")] = $objConn->f("rc_name"); } } $objConn->close(); echo "

\n"; echo "
\n"; $tmparry = array(); for($k=0; $k<sizeof($serviceName); $k++) { switch(substr($serviceName[$k][0],0,2)) { case "SK": $tmparry["SK"][$k]["name"] = $serviceName[$k][0]; $tmparry["SK"][$k]["index"] = $k; break; default: $tmparry["ETC"][$k]["name"] = $serviceName[$k][0]; $tmparry["ETC"][$k]["index"] = $k; } } // SK sort($tmparry["SK"]); foreach ($tmparry["SK"] as $value) { //echo " <td width='100' height='35'>\n"; switch($value["name"]) { //case 'SK51' : echo "
\n"; } // ETC foreach ($tmparry["ETC"] as $value) { echo "
\n"; } echo "

\n"; break; default : echo "

\n"; } if($serviceName[$value["index"]][1] != "dead") { echo ""; } else { echo ""; } echo ""; if($serviceType==$value["index"]) echo ""; echo $rc_list[$value["name"]]; echo "
(".$value["name"].")"; echo "

\n"; if($serviceName[$value["index"]][1] != "dead") { echo ""; } else { echo ""; } echo ""; if($serviceType==$value["index"]) echo ""; echo $rc_list[$value["name"]]; echo "
(".$value["name"].")"; echo "

\n"; echo "

\n"; ?>

".$rc_list[$serviceName[$serviceType][0]]; echo " (".$serviceName[$serviceType][0].")"; ?>
Name norm nomon fail | Server IP | Port | Status Changed | Disk Checked | Domain () | Total Disk | Used | Free | Stat ok ronly err out | Disk Busy(Lq) | Traffic INB(Packets) | Traffic OUTB(Packets) | Conn EASTAB(TOT)
translateIt($result[$j][0], 2).$add_alt. " [TYPE] : ". $pt->translateIt($result[$j][1], 0); $totalDisk += $result[$j][8]; $freeDisk += $result[$j][9]; $usedDisk += ($result[$j][8] - $result[$j][9]); $result_used = 0; $result_used = $result[$j][8] - $result[$j][9]; if ($result_used == 0) $result_used = "-"; if ($result[$j][1] == 2) { $totalRTSCount += 1; } /* Packets INB */ if ($result[$j][16] != '-') { $totalPacketsINB += $result[$j][16]; } /* Traffic INB */ if ($result[$j][17] != '-') { $totalTrafficINB += $result[$j][17]; } /* Packets OUTB */ if ($result[$j][18] != '-') { $totalPacketsOUTB += $result[$j][18]; } /* Traffic OUTB */ if ($result[$j][19] != '-') { $totalTrafficOUTB += $result[$j][19]; } /* Connection Estblished */ if ($result[$j][14] != '-') { $totalConnEstab += $result[$j][14]; } /* Connection All */ if ($result[$j][15] != '-') { $totalConnAll += $result[$j][15]; } ?>
translateIt($result[$j][20],100); } ?>
"; ?>

translateIt($result[$j][0],1)?> translateIt($result[$j][1],999) */ ?> tailer($result[$j][2])?>

translateIt($result[$j][4],4)?>

noYear(date("Y-m-d H:i:s", $result[$j][5]))?>

noYear(date("Y-m-d H:i:s", $result[$j][6])); } ?>

translateIt($result[$j][7],7)); ?>

translateIt($result[$j][8],8)?>

translateIt($result_used,8)?>

translateIt(trim($result[$j][9]), 8)?>

translateIt($result[$j][10],10)?> 2) { echo ""; } else if ($result[$j][11] == 2) { echo ""; } else if ($result[$j][11] == 1) { echo ""; } else { echo ""; } ?>

= 20) { echo ""; } else if ($result[$j][12] >= 10) { echo ""; } else { echo ""; } ?> %()

translateIt($result[$j][17],3)?>()

translateIt($result[$j][19],3)?>()

= 100) { echo ""; } else if ($result[$j][14] >= 50) { echo ""; } else { echo ""; } ?> () "; ?>

-
| Storage Total | Total FHS : | translateIt($totalDisk, 9)?>

"; echo "
-

"; } else { $totalUsedPercent = round( $usedDisk*100/$totalDisk, 1 ); if( $totalUsedPercent > 80.0 ) { echo "
"; echo $pt->translateIt($usedDisk, 9) ; echo "
"; echo $totalUsedPercent; echo " %

"; echo "
"; echo $pt->translateIt($freeDisk, 9) ; echo "
"; echo round( $freeDisk*100/$totalDisk, 1 ); echo " %

"; } else { echo "
"; echo $pt->translateIt($usedDisk, 9) ; echo "
"; echo $totalUsedPercent; echo " %

"; echo "
"; echo $pt->translateIt($freeDisk, 9) ; echo "
"; echo round( $freeDisk*100/$totalDisk, 1 ); echo " %

"; } } ?>
Network Total

0) { ?> translateIt($totalTrafficINB,30)?>B(translateIt($totalPacketsINB,30)?>p) -

0) { ?> translateIt($totalTrafficOUTB,30)?>B(translateIt($totalPacketsOUTB,30)?>p) -

0) { ?> () -

"; // } ?>

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($temp_arr[$i]!='') { $result_arr[$i] = explode("|", $temp_arr[$i]); $result_arr[$i][20] = ""; $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]; } } */ if ($result_arr[$i][11] != '-' && $result_arr[$i] != '' && $result_arr[$i] != 0) { if ($minLevel > $result_arr[$i][11]) { $minLevel = $result_arr[$i][11]; } } } } for ($i = 0; $i < $tot_tr; $i++) { if ($result_arr[$i][11] != '-' && $result_arr[$i] != '' && $result_arr[$i] != 0 && $result_arr[$i][11] <= $minLevel) { 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]; } } } } //echo "minLevel $minLevel minValue $minValue
"; $cnt = 0; arsort($tmp_arr); reset($tmp_arr); while (list ($key, $val) = each ($tmp_arr)) { //echo "$key = $val
"; if($val != 0) { if($cnt == 0) { if ($minLevel < $result_arr[$key][11] || $result_arr[$key][10] > 0) { $result_arr[$key][20] = "yellow";//$maxValue; } else { //echo "11 ".$result_arr[$key][11]." 10 ".$result_arr[$key][10]."
"; $maxValue = $val; $result_arr[$key][20] = "99FFFF"; $cnt++; } } else { // 2018-01-19 huibong disk free 1% under color pink... //if($val < (2 * 1024 * 1024 * 1024 * 10)) { if( $val <= ($result_arr[$key][8] * 1 / 100) ) { $result_arr[$key][20] = "#FAC1C1"; } else if(($maxValue - $val) < (1024 * 1024 * 1024) && $minLevel == $result_arr[$key][11]) { //echo "1GB Highed
"; //echo "minLevel $minLevel maxValue $maxValue
"; $result_arr[$key][20] = "99FFFF"; } else { //echo "1GB Lowed
"; $result_arr[$key][20] = "yellow";//$maxValue; } } } else { $result_arr[$key][20] = "white"; } } return $result_arr; } function countIt(){ return $this->tot_line; } function translateIt($parsedText, $type){ if($parsedText == '') return; $eServerType = array('RC', 'STAT', 'RTS', 'RCTS', 'RCDB', 'WWW', 'CCDB'); /*$eStatus = array('UNKNOWN', 'ALIVE', 'DEAD');*/ $eStatus = array('', '', '', ''); $eStatusUP = array('', '', '', ''); $eStatusChar = array('UNKNOWN', 'ALIVE', 'DEAD', 'NO MONITORING'); switch($type){ case 0: return $eServerType[$parsedText]; return ''; case 1: return $eStatus[$parsedText]; case 2: return $eStatusChar[$parsedText]; case 3: if(trim($parsedText) == "-" || $parsedText == "" ) return "-"; else { if (trim($parsedText) / 1024 / 1024 > 1024) { return sprintf("%.2f GB", trim($parsedText) / 1024 / 1024 / 1024 ); } else { if (trim($parsedText) / 1024 > 1024) { if (trim($parsedText) / 1024 / 1024 > 10) { return sprintf("%.2f MB", trim($parsedText) / 1024 / 1024 ); } else { return sprintf("%.2f MB", trim($parsedText) / 1024 / 1024 ); } } else { if (trim($parsedText) > 1024) { return sprintf("%.2f KB", trim($parsedText) / 1024 ); } else { return sprintf("%d B", trim($parsedText)); } } } } case 8: if(trim($parsedText) == "-" || $parsedText == "") return "-"; else return sprintf("%.2lf G", (trim($parsedText) / 1024) / 1024 / 1024); case 9: if(trim($parsedText) == "-" || $parsedText == "" ) return "-"; else { if (trim($parsedText) / 1024 / 1024 / 1024 > 1024) { return sprintf("%.2f T", trim($parsedText) / 1024 / 1024 / 1024 / 1024); } else return sprintf("%.2f G", trim($parsedText) / 1024 / 1024 / 1024); } case 10: return $eStatusUP[$parsedText]; case 30: if(trim($parsedText) == "-" || $parsedText == "" ) return "-"; else { if (trim($parsedText) / 1024 / 1024 > 1024) { return sprintf("%.2f G", trim($parsedText) / 1024 / 1024 / 1024 ); } else { if (trim($parsedText) / 1024 > 1024) { return sprintf("%.2f M", trim($parsedText) / 1024 / 1024 ); } else { if (trim($parsedText) > 1024) { return sprintf("%.2f K", trim($parsedText) / 1024 ); } else { return sprintf("%d", trim($parsedText)); } } } } 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 || $tmp_str != " ") { $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); for($i=0; $i<sizeof($temp_arr); $i++) { $split_str = explode("|", $temp_arr[$i]); $search_str = explode("_", $split_str[2]); // added by roolu 090224 : reason AION is ICS20 if (substr_count($split_str[2], "AION") >= 1) continue; 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]."
".$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]); // added by roolu 090224 : reason AION is ICS20 if (substr_count($split_str[2], "AION") >= 1) continue; if(($tmp_search_str != $search_str[0])) { $tmp_search_str = $search_str[0]; $cnt++; } $str_arr[$cnt][0] = $tmp_search_str; if(($tmp_search_str == $search_str[0]) && $split_str[7] != "-") { $a = explode(".", $split_str[7]); if(!strncmp($a[3], "kr", 2)) { $b = $a[1].".".$a[2]."."."kr"; } else if(!strncmp($a[2], "com", 3)) { $b = $a[1]."."."com"; } $str_arr[$cnt][2] = $b; } if($split_str[0] == 2) { $str_arr[$cnt][1] = "dead"; } // $str_arr[4][1] = "dead"; // $str_arr[1][1] = "dead"; } return $str_arr; } function tailer($name) { $temp_arr = explode("_", $name); $temp_arr2 = substr($name, strlen($temp_arr[0]) + 1, strlen($name)); return $temp_arr2; } function noYear($date) { $date = substr($date, 5, 14); return $date; } } ?>