@extends('admin.layouts.app')

@section('content')
<div class="container-fluid">
    <h2>Server 정보</h2>
    <hr/>

    @if(PHP_OS !== 'WINNT')
    <div class="card">
        <div class="card-header">
            <span>Server Parameters</span>
        </div>
        <div class="card-body table-responsive">
            <table class="table table-bordered">
                <colgroup>
                    <col width="15%">
                    <col width="*">
                    <col width="15%">
                    <col width="*">
                </colgroup>
                <tr>
                    <th>Server Domain/IP</th>
                    <td colspan="3" class="text-start">
                        {{ @get_current_user() }} - {{ $_SERVER['SERVER_NAME'] }}( @if('/' == DIRECTORY_SEPARATOR) {{ $_SERVER['SERVER_ADDR'] }} @else {{ @gethostbyname($_SERVER['SERVER_NAME']) }} @endif )&nbsp;&nbsp;Your IP address is: {{ @$_SERVER['REMOTE_ADDR'] }}
                    </td>
                </tr>
                <tr>
                    <th>Server identifies the</th>
                    <td colspan="3" class="text-start">
                        @if(!php_uname()) {{ $sysInfo["win_n"] }} @else {{ php_uname() }} @endif
                    </td>
                </tr>
                <tr>
                    <th>Server OS</th>
                    <td class="text-start">
                        {{ $os[0] }} &nbsp;Kernel version: @if('/' == DIRECTORY_SEPARATOR) {{ $os[2] }} @else {{ $os[1] }} @endif
                    </td>
                    <th>Web Server</th>
                    <td class="text-start">
                        {{ $_SERVER['SERVER_SOFTWARE'] }}
                    </td>
                </tr>
                <tr>
                    <th>Server Language</th>
                    <td class="text-start">
                        {{ getenv("HTTP_ACCEPT_LANGUAGE") }}
                    </td>
                    <th>Server Port</th>
                    <td class="text-start">
                        {{ $_SERVER['SERVER_PORT'] }}
                    </td>
                </tr>
                <tr>
                    <th>Server HostName</th>
                    <td class="text-start">
                        @if('/' == DIRECTORY_SEPARATOR) {{ $os[1] }} @else {{ $os[2] }} @endif
                    </td>
                    <th>Absolute Path</th>
                    <td class="text-start">
                        {{ $_SERVER['DOCUMENT_ROOT'] ? str_replace('\\','/',$_SERVER['DOCUMENT_ROOT']) : str_replace('\\','/',dirname(__FILE__)) }}
                    </td>
                </tr>
                <tr>
                    <th>Administrator Mail</th>
                    <td class="text-start">
                        @isset($_SERVER['SERVER_ADMIN']) {{ $_SERVER['SERVER_ADMIN'] }} @else 없음 @endisset
                    </td>
                    <th>Program Path</th>
                    <td class="text-start">
                        {{ str_replace('\\', '/', __FILE__) ? str_replace('\\', '/', __FILE__) : $_SERVER['SCRIPT_FILENAME'] }}
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <br/>
    <div class="card">
        <div class="card-header">
            <span>Real-time Data Server</span>
        </div>
        <div class="card-body table-responsive">
            <table class="table table-bordered">
                <colgroup>
                    <col width="15%">
                    <col width="35%">
                    <col width="15%">
                    <col width="35%">
                </colgroup>
                <tr>
                    <th>Current Server Time</th>
                    <td class="text-start"><span class="currentServerTime"></span></td>
                    <th>Server Uptime</th>
                    <td class="text-start"><span class="serverTime"></span></td>
                </tr>
                <tr>
                    <th>CPU Model [{{ $sysInfo['cpu']['num'] }}-Core]</th>
                    <td colspan="3" class="text-start">{!! $sysInfo['cpu']['model'] !!}</td>
                </tr>
                <tr>
                    <th>CPU usage</th>
                    <td colspan="3" class="text-start">@if('/' == DIRECTORY_SEPARATOR) {{ $cpuInfo }} @else Only supports the Linux system @endif</td>
                </tr>
                <tr>
                    <th>Space usage</th>
                    <td colspan="3" class="text-start">
                        Total Space <span class="totalSpace">{{ $memInfo['dt'] }}&nbsp;</span>
                        Used <span class="used">{{ $memInfo['du'] }}</span>&nbsp;
                        Free <span class="free">{{ $memInfo['df'] }}</span>&nbsp;
                        Rate <span class="rate">{{ $memInfo['hdPercent'] }}</span>%

                        <div class="progress">
                            <div class="progress-bar bg-danger" role="progressbar" aria-valuenow="{{ $memInfo['hdPercent'] }}" aria-valuemin="0" aria-valuemax="100" style="width: {{ $memInfo['hdPercent'] }}%">
                                {{ $memInfo['hdPercent'] }}
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <th>Memory usage</th>
                    <td colspan="3" class="text-start">
                        @php
                        $title = [
                            'memTotal', 'memUsed', 'memFree', 'memPercent',
                            'memCached', 'memRealPercent',
                            'swapTotal', 'swapUsed', 'swapFree', 'swapPercent'
                        ];
                        foreach ($title AS $t) {
                            $sysInfo[$t] = ($sysInfo[$t] ? $sysInfo[$t] : 0);
                        }
                        @endphp
                        <div id="totalMemory">
                            Total Memory <span class="totalMemory text-danger"><strong>{{ $sysInfo['memTotal'] }}</strong></span>,
                            Used <span class="used text-danger">{{ $sysInfo['mu'] }}</span>,
                            Buffers <span class="free text-danger">{{ $sysInfo['mf'] }}</span>,
                            Rate <span class="rate text-danger"><strong>{{ $sysInfo['memPercent'] }}</strong></span>%
                            <div class="progress">
                                <div class="progress-bar progress-bar-success bg-info" role="progressbar" aria-valuenow="{{ $sysInfo['memPercent'] }}" aria-valuemin="0" aria-valuemax="100" style="width: {{ $sysInfo['memPercent'] }}%">
                                    {{ $sysInfo['memPercent'] }}%
                                </div>
                            </div>
                        </div>

                        @if($sysInfo['memCached'] > 0)
                        <div id="cacheMemory">
                            Cache Memory <span class="cacheMemory">{{ $sysInfo['mc'] }}</span>,
                            Rate <span class="rate"><strong>{{ $sysInfo['memCachedPercent'] }}</strong></span>%,
                            Buffers <span class="buffers">{{ $sysInfo['mb'] }}</span>
                            <div class="progress">
                                <div class="progress-bar progress-bar-warning bg-success" role="progressbar" aria-valuenow="{{ $sysInfo['memCachedPercent'] }}" aria-valuemin="0" aria-valuemax="100" style="width: {{ $sysInfo['memCachedPercent'] }}%">
                                    {{ $sysInfo['memCachedPercent'] }}%
                                </div>
                            </div>
                        </div>

                        <div id="realMemory">
                            Real Memory Used <span class="memRealUsed">{{ $sysInfo["memRealUsed"] }}</span>,
                            Real Memory Free <span class="memRealFree">{{ $sysInfo["memRealFree"] }}</span>,
                            Rate <span class="memRealPercent"><strong>{{ $sysInfo["memRealPercent"] }}</strong></span>%
                            <div class="progress">
                                <div class="progress-bar progress-bar-info bg-warning" role="progressbar" aria-valuenow="{{ $sysInfo['memRealPercent'] }}" aria-valuemin="0" aria-valuemax="100" style="width: {{ $sysInfo['memRealPercent'] }}%">
                                    {{ $sysInfo['memRealPercent'] }}%
                                </div>
                            </div>
                        </div>
                        @endif

                        @if($sysInfo['swapTotal'] > 0)
                        <div id="swapMemory">
                            SWAP <span class="swap">{{ $sysInfo['st'] }}</span>,
                            Used <span class="used">{{ $sysInfo['su'] }}</span>,
                            Free <span class="free">{{ $sysInfo['sf'] }}</span>
                            Rate <span class="rate"><strong>{{ $sysInfo['swapPercent'] }}</strong></span>%
                            <div class="progress">
                                <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="{{ $sysInfo['swapPercent'] }}" aria-valuemin="0" aria-valuemax="100" style="width: {{ $sysInfo['swapPercent'] }}%">
                                    {{ $sysInfo['swapPercent'] }}%
                                </div>
                            </div>
                        </div>
                        @endif
                    </td>
                </tr>
                <tr>
                    <th>Average System Load</th>
                    <td colspan="3"><span class="averageSystemLoad">{{ $sysInfo['loadAvg'] }}</span></td>
                </tr>
            </table>
        </div>
    </div>
    <br/>
    <div class="card">
        <div class="card-header">
            <span>Real-time NetWork</span>
        </div>
        <div class="card-body table-responsive">
            <table class="table table-bordered">
                @foreach($networkInfo as $k => $networks)
                <tr>
                    <td>{{ $networks['networkName'] }}</td>
                    <td>In : <span class="netInput">-</span></td>
                    <td>Real time: <span class="netInRealTime">0</span>B/s</td>
                    <td>Out : <span class="netOutput">-</span></td>
                    <td>Real time: <span class="netOutRealTime">0</span>B/s</td>
                </tr>
                @endforeach
            </table>
        </div>
    </div>
    <br/>
    <div class="card">
        <div class="card-header">
            <span>PHP has been compiled module testing</span>
        </div>
        <div class="card-body table-responsive">
            <table class="table table-bordered">
                <tr>
                    <td class="text-start">
                    <span>
                    @php
                        $able = get_loaded_extensions();
                        foreach ($able as $key=>$value) {
                            /*
                            if ($key != 0 && $key % 13 == 0) {
                                echo '<br />';
                            }*/
                            echo " $value, ";
                        }
                    @endphp
                    </span>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <br/>
    <div class="card">
        <div class="card-header">
            <span>PHP Parameters</span>
        </div>
        <div class="card-body table-responsive">
            <table class="table table-bordered table-nowrap">
                <colgroup>
                    <col width="15%">
                    <col width="35%">
                    <col width="15%">
                    <col width="35%">
                </colgroup>
                <tr>
                    <th>PHP Info</th>
                    <td>
                        @php
                            $phpSelf = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
                            $disFuns = get_cfg_var("disable_functions");
                        @endphp
                        @isset($disFuns)
                            Г—
                        @else
                            <a href="{{ $phpSelf }}?act=phpinfo" target="_blank">PHP INFO</a>
                        @endisset
                    </td>
                    <th>PHP Version</th>
                    <td>{{ PHP_VERSION }}</td>
                </tr>
                <tr>
                    <th>Run PHP</th>
                    <td>{!!strtoupper(php_sapi_name()) !!}</td>
                    <th>Memory Limit</th>
                    <td>{!!show("memory_limit") !!}</td>
                </tr>
                <tr>
                    <th>PHP Safe Mode</th>
                    <td>{!!show("safe_mode") !!}</td>
                    <th>Post Max Size</th>
                    <td>{!!show("post_max_size") !!}</td>
                </tr>
                <tr>
                    <th>Upload Max Filesize</th>
                    <td>{!!show("upload_max_filesize") !!}</td>
                    <th>Floating-point data of significant digits</th>
                    <td>{!!show("precision") !!}</td>
                </tr>
                <tr>
                    <th>Max Execution Time</th>
                    <td>{!!show("max_execution_time") !!}초</td>
                    <th>Socket TimeOut</th>
                    <td>{!!show("default_socket_timeout") !!}초</td>
                </tr>
                <tr>
                    <th>PHP Doc Root</th>
                    <td>{!!show("doc_root") !!}</td>
                    <th>User Dir</th>
                    <td>{!!show("user_dir") !!}</td>
                </tr>
                <tr>
                    <th>Enable Dl</th>
                    <td>{!!show("enable_dl") !!}</td>
                    <th>Include Path</th>
                    <td>{!!show("include_path") !!}</td>
                </tr>
                <tr>
                    <th>Display Errors</th>
                    <td>{!!show("display_errors") !!}</td>
                    <th>Register Globals</th>
                    <td>{!!show("register_globals") !!}</td>
                </tr>
                <tr>
                    <th>Magic Quotes Gpc</th>
                    <td>{!!show("magic_quotes_gpc") !!}</td>
                    <th>Ignore Repeated Errors</th>
                    <td>{!!show("ignore_repeated_errors") !!}</td>
                </tr>
                <tr>
                    <th>Ignore Repeated Source</th>
                    <td>{!!show("ignore_repeated_source") !!}</td>
                    <th>Ignore Repeated Errors</th>
                    <td>{!!show("report_memleaks") !!}</td>
                </tr>
                <tr>
                    <th>Magic Quotes Gpc</th>
                    <td>{!!show("magic_quotes_gpc") !!}</td>
                    <th>Magic Quotes Runtime</th>
                    <td>{!!show("magic_quotes_runtime") !!}</td>
                </tr>
                <tr>
                    <th>Allow URL Fopen</th>
                    <td>{!!show("allow_url_fopen") !!}</td>
                    <th>Register Argc Argv</th>
                    <td>{!!show("register_argc_argv") !!}</td>
                </tr>
                <tr>
                    <th>Cookie</th>
                    <td>@isset($_COOKIE) <span class="text-success">사용가능</span> @else <span class="text-danger">Г—</span> @endisset</td>
                    <th>Spell check(ASpell Library)</th>
                    <td>{!!isFun("aspell_check_raw") !!}</td>
                </tr>
                <tr>
                    <th>High-precision math(BCMath)</th>
                    <td>{!!isFun("bcadd") !!}</td>
                    <th>PREL(PCRE)</th>
                    <td>{!!isFun("preg_match") !!}</td>
                </tr>
                <tr>
                    <th>PDF</th>
                    <td>{!!isFun("pdf_close") !!}</td>
                    <th>SNMP</th>
                    <td>{!!isFun("snmpget") !!}</td>
                </tr>
                <tr>
                    <th>VMailMgr</th>
                    <td>{!!isFun("vm_adduser") !!}</td>
                    <th>Curl</th>
                    <td>{!!isFun("curl_init") !!}</td>
                </tr>
                <tr>
                    <th>SMTP</th>
                    <td>@if(get_cfg_var("SMTP")) <span class="text-success">사용가능</span> @else <span class="text-danger">Г—</span> @endisset</td>
                    <th>SMTP</th>
                    <td>@if(get_cfg_var("SMTP")) {{ get_cfg_var("SMTP") }} @else <span class="text-danger">Г—</span> @endisset</td>
                </tr>
                <tr>
                    <th>Enable Functions</th>
                    <td colspan="3" class="text-start">
                        <button type="button" class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#enableFunctions">보기</button>
                        <div id="enableFunctions" class="modal" role="dialog">
                            <div class="modal-dialog">
                                <div class="modal-content">
                                    <div class="modal-header bg-dark text-white">
                                        <h4 class="modal-title">Enable Functions</h4>
                                        <button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
                                    </div>
                                    <div class="modal-body">
                                        <pre>{{ print_r(get_defined_functions()) }}</pre>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">확인</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                        <strong>Disable Functions</strong>
                        <br/><br/>
                        @php
                            $disFuns = get_cfg_var("disable_functions");
                        @endphp
                        @empty($disFuns)
                            Г—
                        @else
                            @php
                            $disFunsArray = explode(',', $disFuns);
                            $i = 0;
                            @endphp
                            @foreach ($disFunsArray as $key => $value)
                                {{ $value }}
                            @endforeach
                        @endempty
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <br/>
    <div class="card">
        <div class="card-header">
            <span>Components</span>
        </div>
        <div class="card-body table-responsive">
            <table class="table table-bordered">
                <colgroup>
                    <col width="15%">
                    <col width="35%">
                    <col width="15%">
                    <col width="35%">
                </colgroup>
                <tr>
                    <th>FTP</th>
                    <td>{!! isFun("ftp_login") !!}</td>
                    <th>XML</th>
                    <td>{!! isFun("xml_set_object") !!}</td>
                </tr>
                <tr>
                    <th>Session: </th>
                    <td>{!! isFun("session_start") !!}</td>
                    <th>Socket: </th>
                    <td>{!! isFun("socket_accept") !!}</td>
                </tr>
                <tr>
                    <th>Calendar</th>
                    <td>{!! isFun('cal_days_in_month') !!}
                    </td>
                    <th>Allow Url Fopen: </th>
                    <td>{!! show("allow_url_fopen") !!}</td>
                </tr>
                <tr>
                    <th>GD Library: </th>
                    <td>
                        @if(function_exists("gd_info"))
                            @php $gdInfo = @gd_info() @endphp
                            {{ $gdInfo["GD Version"] }}
                        @else
                            <span class="text-danger">Г—</span>
                        @endif
                    </td>
                    <th>Zlib: </th>
                    <td>{!! isFun("gzclose") !!}</td>
                </tr>
                <tr>
                    <th>IMAP: </th>
                    <td>{!! isFun("imap_close") !!}</td>
                    <th>JDToGregorian: </th>
                    <td>{!! isFun("JDToGregorian") !!}</td>
                </tr>
                <tr>
                    <th>Preg Match: </th>
                    <td>{!! isFun("preg_match") !!}</td>
                    <th>WDDX: </th>
                    <td>{!! isFun("wddx_add_vars") !!}</td>
                </tr>
                <tr>
                    <th>Iconv: </th>
                    <td>{!! isFun("iconv") !!}</td>
                    <th>mbstring: </th>
                    <td>{!! isFun("mb_eregi") !!}</td>
                </tr>
                <tr>
                    <th>BCADD: </th>
                    <td>{!! isFun("bcadd") !!}</td>
                    <th>LDAP: </th>
                    <td>{!! isFun("ldap_close") !!}</td>
                </tr>
                <tr>
                    <th>MCrypt: </th>
                    <td>{!! isFun("mcrypt_cbc") !!}</td>
                    <th>Mhash Count: </th>
                    <td>{!! isFun("mhash_count") !!}</td>
                </tr>
            </table>
        </div>
    </div>
    <br/>
    <div class="card">
        <div class="card-header">
            <span>Other Components</span>
        </div>
        <div class="card-body table-responsive">
            <table class="table table-bordered">
                <colgroup>
                    <col width="15%">
                    <col width="35%">
                    <col width="15%">
                    <col width="35%">
                </colgroup>
                <tr>
                    <th>Zend Version</th>
                    <td>
                        @php $zend_version = zend_version(); @endphp
                        @empty($zend_version) <span class="text-success">Г—</span> @else {{ $zend_version }} @endempty
                    </td>
                    <th>
                        @php
                            $PHP_VERSION = PHP_VERSION;
                            $PHP_VERSION = substr($PHP_VERSION, 2, 1);
                            if($PHP_VERSION > 2) {
                                echo "ZendGuardLoader[On]";
                            } else {
                                echo "Zend Optimizer";
                            }
                        @endphp
                    </th>
                    <td>
                        @if ($PHP_VERSION > 2)
                            @if(get_cfg_var("zend_loader.enable")) <span class="text-success">사용가능</span> @else <span class="text-danger">Г—</span> @endif
                        @else
                            @if(function_exists('zend_optimizer_version'))
                                {{ zend_optimizer_version() }}
                            @else
                                @if(get_cfg_var("zend_optimizer.optimization_level") || get_cfg_var("zend_extension_manager.optimizer_ts") || get_cfg_var("zend.ze1_compatibility_mode") || get_cfg_var("zend_extension_ts"))
                                    <span class="text-success">в€љ</span>
                                @else
                                    <span class="text-danger">Г—</span>
                                @endif
                            @endif
                        @endif
                    </td>
                </tr>
                <tr>
                    <th>eAccelerator</th>
                    <td>@if((phpversion('eAccelerator')) != '') {{ phpversion('eAccelerator') }} @else <span class="text-danger">Г—</span> @endif</td>
                    <th>ioncube</th>
                    <td>
                        @if(extension_loaded('ionCube Loader')) {{
                            $ys = ioncube_loader_iversion() }}
                            {{ $gm = "." . (int)substr($ys, 3, 2) }}
                            {{ ionCube_Loader_version() . $gm }}
                        @else
                            <span class="text-danger">Г—</span>
                        @endif
                    </td>
                </tr>
                <tr>
                    <th>XCache</th>
                    <td>@if((phpversion('XCache')) != '') {{ phpversion('XCache') }} @else <span class="text-danger">Г—</span> @endif</td>
                    <th>APC</th>
                    <td>@if((phpversion('APC')) != '') {{ phpversion('APC') }} @else <span class="text-danger">Г—</span> @endif</td>
                </tr>
            </table>
        </div>
    </div>
    <br/>
    <div class="card">
        <div class="card-header">
            <span>Database</span>
        </div>
        <div class="card-body table-responsive">
            <table class="table table-bordered">
                <colgroup>
                    <col width="15%">
                    <col width="35%">
                    <col width="15%">
                    <col width="35%">
                </colgroup>
                <tr>
                    <th>MySQL</th>
                    <td>{!! isFun("mysqli_close") !!}
                        @if(function_exists("mysql_get_server_info"))
                            @php
                            $s = @mysqli_get_server_info();
                            $s = ($s ? '&nbsp; mysql_server version: ' . $s : '');
                            $c = ('&nbsp; mysql_client version: ' . @mysqli_get_client_info());
                            @endphp
                            {{ $s }}
                        @endif
                    </td>
                    <th>ODBC</th>
                    <td>{!! isFun("odbc_close") !!}</td>
                </tr>
                <tr>
                    <th>Oracle</th>
                    <td>{!! isFun("ora_close") !!}</td>
                    <th>SQL Server</th>
                    <td>{!! isFun("mssql_close") !!}</td>
                </tr>
                <tr>
                    <th>dBASE</th>
                    <td>{!! isFun("dbase_close") !!}</td>
                    <th>mSQL</th>
                    <td>{!! isFun("msql_close") !!}</td>
                </tr>
                <tr>
                    <th>SQLite</th>
                    <td>
                        @if (extension_loaded('sqlite3'))
                            @php $sqliteVer = SQLite3::version(); @endphp
                            <span class="text-green">사용가능</span>
                            {{ "SQLite3" }}
                            {{ $sqliteVer["versionString"] }}
                        @else
                            {{ isFun("sqlite_close") }}
                            @if (isFun("sqlite_close") == '<span class="text-green">사용가능</span>')
                                &nbsp;{{ @sqlite_libversion() }}
                            @endif
                        @endif
                    </td>
                    <th>Hyperwave</th>
                    <td>{!! isFun("hw_close") !!}</td>
                </tr>
                <tr>
                    <th>Postgre SQL</th>
                    <td>{!! isFun("pg_close") !!}</td>
                    <th>Informix: </th>
                    <td>{!! isFun("ifx_close") !!}</td>
                </tr>
                <tr>
                    <th>DBA database</th>
                    <td>{!! isFun("dba_close") !!}</td>
                    <th>DBM database</th>
                    <td>{!! isFun("dbmclose") !!}</td>
                </tr>
                <tr>
                    <th>FilePro database</th>
                    <td>{!! isFun("filepro_fieldcount") !!}</td>
                    <th>SyBase database</th>
                    <td>{!! isFun("sybase_close") !!}</td>
                </tr>
            </table>
        </div>
    </div>
    @else
    윈도우 계열의 서버는 지원하지 않는 기능입니다.
    @endif
</div>

@if(PHP_OS !== 'WINNT')
<script type="module">
    function getJSONData() {
        setInterval(function() {
            $.getJSON(ADMIN_URL + '/config/server/ajaxData', displayData);
        }, 3000);
    }

    $(function () {
        getJSONData();
    });

    var totalMemory = $("#totalMemory");
    var cacheMemory = $("#cacheMemory");
    var realMemory = $("#realMemory");
    var swapMemory = $("#swapMemory");
    var inputSpeed = [];
    var outputSpeed = [];

    function displayData(dataJSON) {
        $("span.currentServerTime").text(dataJSON.sTime);
        $("span.serverTime").text(dataJSON.upTime);
        totalMemory.find("span.totalMemory").text(dataJSON.sysInfo.memTotal);
        totalMemory.find("span.used").text(dataJSON.sysInfo.mu);
        totalMemory.find("span.buffers").text(dataJSON.sysInfo.mf);
        totalMemory.find("span.rate").text(dataJSON.sysInfo.memPercent);
        totalMemory.find("div.progress-bar").text(dataJSON.sysInfo.memPercent + '%');

        cacheMemory.find("span.cacheMemory").text(dataJSON.sysInfo.mc);
        cacheMemory.find("span.rate").text(dataJSON.sysInfo.memCachedPercent);
        cacheMemory.find("span.buffers").text(dataJSON.sysInfo.mf);
        cacheMemory.find("div.progress-bar").text(dataJSON.sysInfo.memCachedPercent + '%');

        realMemory.find("span.memRealUsed").text(dataJSON.sysInfo.memRealUsed);
        realMemory.find("span.memRealFree").text(dataJSON.sysInfo.memRealFree);
        realMemory.find("div.progress-bar").text(dataJSON.sysInfo.memRealPercent + '%');

        swapMemory.find("span.used").text(dataJSON.sysInfo.st);
        swapMemory.find("span.free").text(dataJSON.sysInfo.su);
        swapMemory.find("span.rate").text(dataJSON.sysInfo.sf);
        swapMemory.find("div.progress-bar").text(dataJSON.sysInfo.swapPercent + '%');

        $("span.averageSystemLoad").text(dataJSON.sysInfo.loadAvg);

        if (dataJSON.networkInfo.length > 0) {
            for (var index in dataJSON.networkInfo) {
                eval('inputSpeed[' + index + ']=0;');
                eval('outputSpeed[' + index + ']=0;');

                $("span.netInput").eq(index).text(dataJSON.networkInfo[index].NetInput);
                $("span.netOutput").eq(index).text(dataJSON.networkInfo[index].NetOut);

                // 변수생성
                $("span.netInRealTime").eq(index).text(ForDight((dataJSON.networkInfo[index].NetInputSpeed - inputSpeed[index]), 3));
                inputSpeed[index] = dataJSON.networkInfo[index].NetInputSpeed;
                $("span.netOutRealTime").eq(index).text(ForDight((dataJSON.networkInfo[index].NetOutSpeed - outputSpeed[index]), 3));
                outputSpeed[index] = dataJSON.networkInfo[index].NetOutSpeed;

            }
        }
    }

    function ForDight(Dight, How) {
        if (Dight < 0) {
            return 0 + "B/s";
        } else if (Dight < 1024) {
            return Math.round(Dight * Math.pow(10, How)) / Math.pow(10, How) + "B/s";
        } else if (Dight < 1048576) {
            Dight = Dight / 1024;
            return Math.round(Dight * Math.pow(10, How)) / Math.pow(10, How) + "K/s";
        } else {
            Dight = Dight / 1048576;
            return Math.round(Dight * Math.pow(10, How)) / Math.pow(10, How) + "M/s";
        }
    }
</script>
@endif

@endsection
