Пример #1
0
function getmem()
{
    $os = new os_system();
    $html = $os->html_Memory_usage();
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #2
0
function perfs()
{
    include_once "ressources/class.os.system.tools.inc";
    $os = new os_system();
    $page = CurrentPageName();
    $sock = new sockets();
    $mem = $os->memory();
    $squid = new squidbee();
    $mem = $mem["ram"]["total"];
    $memory = $mem / 1000;
    $mem_cached = round($memory * 0.2);
    $cache_mem = $squid->global_conf_array["cache_mem"];
    $fqdncache_size = $squid->global_conf_array["fqdncache_size"];
    $ipcache_size = $squid->global_conf_array["ipcache_size"];
    $ipcache_low = $squid->global_conf_array["ipcache_low"];
    $ipcache_high = $squid->global_conf_array["ipcache_high"];
    if (preg_match("#([0-9]+)\\s+#", $cache_mem, $re)) {
        $cache_mem = $re[1];
    }
    $swappiness = $sock->getFrameWork("cmd.php?sysctl-value=yes&key=" . base64_encode("vm.swappiness"));
    //15
    $vfs_cache_pressure = $sock->getFrameWork("cmd.php?sysctl-value=yes&key=" . base64_encode("vm.vfs_cache_pressure"));
    //50
    $overcommit_memory = $sock->getFrameWork("cmd.php?sysctl-value=yes&key=" . base64_encode("vm.overcommit_memory"));
    //2
    if (preg_match("#([0-9]+)#", $overcommit_memory, $re)) {
        $overcommit_memory = $re[1];
    }
    /*
     * echo 1 > /proc/sys/net/ipv4/ip_forward echo 1 > /proc/sys/net/ipv4/ip_nonlocal_bind echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter echo 1024 65535 > /proc/sys/net/ipv4/ip_local_port_range echo 102400 > /proc/sys/net/ipv4/tcp_max_syn_backlog echo 1000000 > /proc/sys/net/ipv4/ip_conntrack_max echo 1000000 > /proc/sys/fs/file-max echo 60 > /proc/sys/kernel/msgmni echo 32768 > /proc/sys/kernel/msgmax echo 65536 > /proc/sys/kernel/msgmnb :: Maximizing Kernel configuration 
     */
    $html = "\n\t<input type='hidden' id='cache_mem' value='{$mem_cached}'>\n\t<input type='hidden' id='swappiness' value='15'>\n\t<input type='hidden' id='vfs_cache_pressure' value='50'>\n\t<input type='hidden' id='overcommit_memory' value='2'>\n\t<input type='hidden' id='fqdncache_size' value='51200'>\n\t<input type='hidden' id='ipcache_size' value='51200'>\n\t\n\t<input type='hidden' id='ipcache_low' value='90'>\n\t<input type='hidden' id='ipcache_high' value='95'>\n\t\n\t\n\t<table cellspacing='0' cellpadding='0' border='0' class='tableView'>\n\n<thead class='thead'>\n\t<tr>\n\t\t<th>&nbsp;</th>\n\t\t<th>{current_value}</th>\n\t\t<th>&nbsp;</th>\n\t\t<th>{proposal}</th>\n\t</tr>\n\n\t\t<tr class=oddRow>\n\t\t<td align='right' class=legend nowrap>squid:{cache_mem}:</strong></td>\n\t\t<td valign='middle'><strong style='font-size:13px'>{$cache_mem}MB</td>\n\t\t<td width=1% valign='middle'><img src='img/fw_bold.gif'></td>\n\t\t<td valign='middle'><strong style='font-size:13px'>{$mem_cached}MB</strong></td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td align='right' class=legend nowrap>{fqdncache_size}:</strong></td>\n\t\t<td valign='middle'><strong style='font-size:13px'>{$fqdncache_size}</td>\n\t\t<td width=1% valign='middle'><img src='img/fw_bold.gif'></td>\n\t\t<td valign='middle'><strong style='font-size:13px'>51200</strong></td>\n\t\t</tr>\t\t\n\t\t\n\t\t\n\t\t<tr class=oddRow>\n\t\t<td align='right' class=legend nowrap>{ipcache_size}:</strong></td>\n\t\t<td valign='middle'><strong style='font-size:13px'>{$ipcache_size}</td>\n\t\t<td width=1% valign='middle'><img src='img/fw_bold.gif'></td>\n\t\t<td valign='middle'><strong style='font-size:13px'>51200</strong></td>\n\t\t</tr>\n\t\t\n\t\t<tr>\n\t\t<td align='right' class=legend nowrap>{ipcache_low}:</strong></td>\n\t\t<td valign='middle'><strong style='font-size:13px'>{$ipcache_low}</td>\n\t\t<td width=1% valign='middle'><img src='img/fw_bold.gif'></td>\n\t\t<td valign='middle'><strong style='font-size:13px'>90</strong></td>\n\t\t</tr>\n\n\t\t<tr class=oddRow>\n\t\t<td align='right' class=legend nowrap>{ipcache_high}:</strong></td>\n\t\t<td valign='middle'><strong style='font-size:13px'>{$ipcache_high}</td>\n\t\t<td width=1% valign='middle'><img src='img/fw_bold.gif'></td>\n\t\t<td valign='middle'><strong style='font-size:13px'>95</strong></td>\n\t\t</tr>\t\t\n\n\t\t\n\t\t<tr>\n\t\t<td align='right' class=legend nowrap>Kernel:vm.swappiness:</strong></td>\n\t\t<td valign='middle'><strong style='font-size:13px'>{$swappiness}</td>\n\t\t<td width=1% valign='middle'><img src='img/fw_bold.gif'></td>\n\t\t<td valign='middle'><strong style='font-size:13px'>15</strong></td>\n\t\t</tr>\t\t\t\t\n\t\t\n\t\t<tr class=oddRow>\n\t\t<td align='right' class=legend nowrap>Kernel:vm.vfs_cache_pressure:</strong></td>\n\t\t<td valign='middle'><strong style='font-size:13px'>{$vfs_cache_pressure}</td>\n\t\t<td width=1% valign='middle'><img src='img/fw_bold.gif'></td>\n\t\t<td valign='middle'><strong style='font-size:13px'>50</strong></td>\n\t\t</tr>\t\t\t\n\t\t\n\t\t\n\t\t<tr>\n\t\t<td align='right' class=legend nowrap>Kernel:vm.overcommit_memory:</strong></td>\n\t\t<td valign='middle'><strong style='font-size:13px'>{$overcommit_memory}</td>\n\t\t<td width=1% valign='middle'><img src='img/fw_bold.gif'></td>\n\t\t<td valign='middle'><strong style='font-size:13px'>2</strong></td>\n\t\t</tr>\n\t\t\t\t\t\n\t\t</table>\n\t\t<hr>\n\t\t<div style='text-align:right'>" . button("{apply}", "SaveSquidPerfs()") . "</div>\n\t\t\n\t\t\n\t\t<script>\n\tvar x_SaveSquidPerfs=function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\trefreshPerfs();\n\t}\t\n\t\n\tfunction SaveSquidPerfs(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('cache_mem',document.getElementById('cache_mem').value);\n\t\tXHR.appendData('swappiness',document.getElementById('swappiness').value);\n\t\tXHR.appendData('vfs_cache_pressure',document.getElementById('vfs_cache_pressure').value);\n\t\tXHR.appendData('overcommit_memory',document.getElementById('overcommit_memory').value);\n\t\t\n\t\tXHR.appendData('fqdncache_size',document.getElementById('fqdncache_size').value);\n\t\tXHR.appendData('ipcache_size',document.getElementById('ipcache_size').value);\n\t\tXHR.appendData('ipcache_low',document.getElementById('ipcache_low').value);\n\t\tXHR.appendData('ipcache_high',document.getElementById('ipcache_high').value);\n\t\t\n\t\tdocument.getElementById('squidperfs').innerHTML='<center style=\"width:100%\"><img src=img/wait_verybig.gif></center>'; \n\t\tXHR.sendAndLoad('{$page}', 'GET',x_SaveSquidPerfs);\t\n\t}\t\t\n\t\t\n\t\t\n\t\t</script>";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #3
0
function usblist()
{
    $sock = new sockets();
    $tpl = new templates();
    $sock->getFrameWork("cmd.php?usb-scan-write=yes");
    if (!file_exists('ressources/usb.scan.inc')) {
        return $tpl->_ENGINE_parse_body("<H1>{error_no_socks}</H1>");
    }
    include "ressources/usb.scan.inc";
    $os = new os_system();
    $count = 0;
    $table = "<table style='width:99%'><tr>";
    while (list($num, $usb_data_array) = each($_GLOBAL["usb_list"])) {
        $uiid = $num;
        $datas = $os->usb_parse_array($usb_data_array, false);
        if ($datas == null) {
            continue;
        }
        $count = $count + 1;
        if ($count > 2) {
            $table = $table . "<tr></tr>";
            $count = 0;
        }
        $table = $table . "<td>";
        $table = $table . $datas;
        $table = $table . "</td>";
    }
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($table);
}
Пример #4
0
function getmem()
{
    include_once "ressources/class.os.system.tools.inc";
    $os = new os_system();
    $html = $os->html_Memory_usage();
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #5
0
function mem_status()
{
    $t = $_GET["t"];
    $tpl = new templates();
    include_once "ressources/class.os.system.tools.inc";
    $os = new os_system();
    $html = RoundedLightGrey($os->html_Memory_usage()) . "<br>";
    echo $tpl->_ENGINE_parse_body($html);
    echo "<script>LoadAjax('squid-stats-{$t}','android.squid.stats.status.php');</script>";
}
Пример #6
0
function external_storage_usb_list()
{
    $sock = new sockets();
    $sock->getFrameWork("cmd.php?usb-scan-write=yes");
    $tpl = new templates();
    if (!file_exists('ressources/usb.scan.inc')) {
        return $tpl->_ENGINE_parse_body("<H3 style=color:#d32d2d'>{error_no_socks}</H3>");
    }
    include "ressources/usb.scan.inc";
    include_once "ressources/class.os.system.tools.inc";
    $html = "<table style='width:100%'><tr>";
    $count = 0;
    $os = new os_system();
    while (list($uid, $array) = each($_GLOBAL["usb_list"])) {
        if (preg_match('#swap#', $array["TYPE"])) {
            continue;
        }
        if (trim($array["mounted"]) == '/') {
            continue;
        }
        $start = null;
        $end = null;
        if ($count == 2) {
            $start = "<tr>";
            $end = "</tr>";
            $count = 0;
        }
        $VENDOR = $array["ID_VENDOR"];
        if (strtoupper($VENDOR) == "TANDBERG") {
            $img = "tandberg-64.png";
        } else {
            $img = "64-external-drive.png";
        }
        if ($mounted == "/") {
            return "disk-64.png";
        }
        if ($TYPE == "swap") {
            return "disk-64.png";
        }
        $html = $html . $start;
        $html = $html . "<td valign='top'>";
        $html = $html . RoundedLightWhite("\n\t\t\t\t<table style='width:280px;margin:5px;background-image:url(img/{$img});background-repeat:no-repeat'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top'><div style='width:36px'>&nbsp;</div></td>\n\t\t\t\t\t<td valign='top'>" . $os->usb_parse_array($array) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2 align='right'><input type='button' OnClick=\"javascript:BrowseUsbSelect('{$uid}');\" value='{select} {this_device}&nbsp;&raquo;'></td>\n\t\t\t\t</tr>\n\t\t\t</table>");
        $html = $html . "</td>";
        $html = $html . $stop;
        $count = $count + 1;
    }
    $html = $html . "</tr>\n\t</table>";
    return $tpl->_ENGINE_parse_body($html, "dar.index.php");
}
Пример #7
0
function perfs()
{
    include_once "ressources/class.os.system.tools.inc";
    $os = new os_system();
    $page = CurrentPageName();
    $sock = new sockets();
    $mem = $os->memory();
    $squid = new squidbee();
    $mem = $mem["ram"]["total"];
    $memory = $mem / 1000;
    $mem_cached = round($memory * 0.2);
    $cache_mem = $squid->global_conf_array["cache_mem"];
    $fqdncache_size = $squid->global_conf_array["fqdncache_size"];
    $ipcache_size = $squid->global_conf_array["ipcache_size"];
    $ipcache_low = $squid->global_conf_array["ipcache_low"];
    $ipcache_high = $squid->global_conf_array["ipcache_high"];
    if (preg_match("#([0-9]+)\\s+#", $cache_mem, $re)) {
        $cache_mem = $re[1];
    }
    $swappiness = $sock->getFrameWork("cmd.php?sysctl-value=yes&key=" . base64_encode("vm.swappiness"));
    //2
    //$vfs_cache_pressure=$sock->getFrameWork("cmd.php?sysctl-value=yes&key=".base64_encode("vm.vfs_cache_pressure")); //50
    $overcommit_memory = $sock->getFrameWork("cmd.php?sysctl-value=yes&key=" . base64_encode("vm.overcommit_memory"));
    //1
    $tcp_max_syn_backlog = $sock->getFrameWork("cmd.php?sysctl-value=yes&key=" . base64_encode("net.ipv4.tcp_max_syn_backlog"));
    //4096
    if (preg_match("#([0-9]+)#", $overcommit_memory, $re)) {
        $overcommit_memory = $re[1];
    }
    /*
     * echo 1 > /proc/sys/net/ipv4/ip_forward echo 1 > /proc/sys/net/ipv4/ip_nonlocal_bind echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter echo 1024 65535 > /proc/sys/net/ipv4/ip_local_port_range echo 102400 > /proc/sys/net/ipv4/tcp_max_syn_backlog echo 1000000 > /proc/sys/net/ipv4/ip_conntrack_max echo 1000000 > /proc/sys/fs/file-max echo 60 > /proc/sys/kernel/msgmni echo 32768 > /proc/sys/kernel/msgmax echo 65536 > /proc/sys/kernel/msgmnb :: Maximizing Kernel configuration 
     */
    $removecachepressure = "\t\t<tr >\n\t\t\t<td align='right' class=legend nowrap style='font-size:16px'>Kernel:vm.vfs_cache_pressure:</strong></td>\n\t\t\t<td valign='middle' align='right' style='font-size:18px;padding-right:5px'>{$vfs_cache_pressure}</td>\n\t\t\t<td valign='middle'>" . Field_text("vfs_cache_pressure", 50, "font-size:18px;width:40px") . "</strong></td>\n\t\t</tr>";
    $html = "\n\t<input type='hidden' id='cache_mem' value='{$mem_cached}'>\n\t\n\t<input type='hidden' id='vfs_cache_pressure' value='50'>\n\t\n\t<table style='width:99%' class=form>\n\n\n\t<tr>\n\t\t<th>&nbsp;</th>\n\t\t<th>{current_value}</th>\n\t\t<th>{proposal}</th>\n\t</tr>\n\n\t\t<tr >\n\t\t\t<td align='right' class=legend nowrap style='font-size:16px'>squid:{cache_mem}:</strong></td>\n\t\t\t<td valign='middle' align='right' style='font-size:18px;padding-right:5px'>{$cache_mem}MB</td>\n\t\t\t<td valign='left' style='font-size:18px'>" . Field_text("cache_mem", $mem_cached, "font-size:18px;width:70px") . "&nbsp;MB</strong></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right' class=legend nowrap style='font-size:16px'>{fqdncache_size}:</strong></td>\n\t\t\t<td valign='middle' align='right' style='font-size:18px;padding-right:5px'>{$fqdncache_size}</td>\n\t\t\t<td valign='middle' style='font-size:18px'>" . Field_text("fqdncache_size", 51200, "font-size:18px;width:70px") . "&nbsp;{items}</strong></td>\n\t\t</tr>\t\t\n\t\t\n\t\t\n\t\t<tr >\n\t\t\t<td align='right' class=legend nowrap style='font-size:16px'>{ipcache_size}:</strong></td>\n\t\t\t<td valign='middle'  align='right' style='font-size:18px;padding-right:5px'>{$ipcache_size}</td>\n\t\t\t<td valign='middle' style='font-size:18px'>" . Field_text("ipcache_size", 51200, "font-size:18px;width:70px") . "&nbsp;{items}</td>\n\t\t</tr>\n\t\t\n\t\t<tr>\n\t\t\t<td align='right' class=legend nowrap style='font-size:16px'>{ipcache_low}:</strong></td>\n\t\t\t<td valign='middle'  align='right' style='font-size:18px;padding-right:5px'>{$ipcache_low}&nbsp;%</td>\n\t\t\t<td valign='middle' style='font-size:18px'>" . Field_text("ipcache_low", 90, "font-size:18px;width:60px") . "&nbsp;%</strong></td>\n\t\t</tr>\n\n\t\t<tr >\n\t\t\t<td align='right' class=legend nowrap style='font-size:16px'>{ipcache_high}:</strong></td>\n\t\t\t<td valign='middle' align='right' style='font-size:18px;padding-right:5px'>{$ipcache_high}&nbsp;%</td>\n\t\t\t<td valign='middle' style='font-size:18px'>" . Field_text("ipcache_high", 95, "font-size:18px;width:40px") . "&nbsp;%</strong></td>\n\t\t</tr>\t\t\n\n\t\t\n\t\t<tr>\n\t\t<td align='right' class=legend nowrap style='font-size:16px'>Kernel:vm.swappiness:</strong></td>\n\t\t<td valign='middle' align='right' style='font-size:18px;padding-right:5px'>{$swappiness}&nbsp;%</td>\n\t\t<td valign='middle' style='font-size:18px'>" . Field_text("swappiness", 5, "font-size:18px;width:40px") . "&nbsp;%</td>\n\t\t</tr>\t\t\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t<tr>\n\t\t\t<td align='right' class=legend nowrap style='font-size:16px'>Kernel:vm.overcommit_memory:</strong></td>\n\t\t\t<td valign='middle' align='right' style='font-size:18px;padding-right:5px'>{$overcommit_memory}</td>\n\t\t\t<td valign='middle'>" . Field_text("overcommit_memory", 1, "font-size:18px;width:40px") . "</strong></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right' class=legend nowrap style='font-size:16px'>Kernel:net.ipv4.tcp_max_syn_backlog:</strong></td>\n\t\t\t<td valign='middle' align='right' style='font-size:18px;padding-right:5px'>{$tcp_max_syn_backlog}</td>\t\t\n\t\t\t<td valign='middle'>" . Field_text("tcp_max_syn_backlog", 4096, "font-size:18px;width:60px") . "</strong></td>\n\n\t\t</tr>\t\t\n\t\t\n\t\t\t\t\t\n\t\t</table>\n\t\t<hr>\n\t\t<div style='text-align:right'>" . button("{apply}", "SaveSquidPerfs()", 16) . "</div>\n\t\t\n\t\t\n\t\t<script>\n\tvar x_SaveSquidPerfs=function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\trefreshPerfs();\n\t\tLoadAjax('squid-services','squid.main.quicklinks.php?squid-services=yes');\n\t}\t\n\t\n\tfunction SaveSquidPerfs(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('cache_mem',document.getElementById('cache_mem').value);\n\t\tXHR.appendData('swappiness',document.getElementById('swappiness').value);\n\t\t//XHR.appendData('vfs_cache_pressure',document.getElementById('vfs_cache_pressure').value);\n\t\t//XHR.appendData('overcommit_memory',document.getElementById('overcommit_memory').value);\n\t\tXHR.appendData('tcp_max_syn_backlog',document.getElementById('tcp_max_syn_backlog').value);\n\t\t\n\t\tXHR.appendData('fqdncache_size',document.getElementById('fqdncache_size').value);\n\t\tXHR.appendData('ipcache_size',document.getElementById('ipcache_size').value);\n\t\tXHR.appendData('ipcache_low',document.getElementById('ipcache_low').value);\n\t\tXHR.appendData('ipcache_high',document.getElementById('ipcache_high').value);\n\t\t\n\t\tAnimateDiv('squidperfs'); \n\t\tXHR.sendAndLoad('{$page}', 'GET',x_SaveSquidPerfs);\t\n\t}\t\t\n\t\t\n\t\t\n\t\t</script>";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #8
0
function partitions_scan($array)
{
    if (!is_array($array)) {
        return null;
    }
    include_once "ressources/class.os.system.tools.inc";
    $os = new os_system();
    $users = new usersMenus();
    $sock = new sockets();
    $disk_type_array = $os->disk_type_array();
    if (!is_file('ressources/usb.scan.inc')) {
        $sock->getFrameWork("cmd.php?usb-scan-write=yes");
    }
    include 'ressources/usb.scan.inc';
    while (list($num, $line) = each($array)) {
        $dev_path = $num;
        $TYPE = $disk_type_array[$line["TYPE"]];
        $MOUNTED = $line["MOUNTED"];
        $ID_FS_TYPE = $line["ID_FS_TYPE"];
        $TOTSIZE = $line["SIZE"];
        $free_size = explode(";", $line["free_size"]);
        $bigsize = $free_size[0];
        $used = $free_size[1];
        $free = $free_size[2];
        $pourcent = $free_size[3];
        $ID_FS_LABEL = $line["ID_FS_LABEL"];
        $PART_ARRAY = array();
        $text = "{$used}/{$bigsize}&nbsp;{$pourcent}% {used}";
        if (trim($pourcent) == null) {
            $pourcent = "0%";
            $text = null;
        }
        $first_div_size = $bigsize;
        $PART_ARRAY["{$dev_path}"]["TEXT_SIZE"] = $text;
        $PART_ARRAY["{$dev_path}"]["POURC"] = $pourcent;
        if ($line["TYPE"] != 5 and $line["TYPE"] != 82) {
            $PART_ARRAY["{$dev_path}"]["CHANGE_LABEL"] = true;
            $PART_ARRAY["{$dev_path}"]["CHANGE_LABEL_JS"] = "ChangeLabel('{$dev_path}')";
            $PART_ARRAY["{$dev_path}"]["SIZE"] = $TOTSIZE;
            if ($users->LVM_INSTALLED) {
                $PART_ARRAY["{$dev_path}"]["PVCREATE"] = true;
                $PART_ARRAY["{$dev_path}"]["PVCREATE_JS"] = "pvcreate_dev('{$dev_path}')";
                $partitions_options = "<table style='width:100%'><tr>";
                $init = "\n\t\t\t<tr>\n\t\t\t<td width=1%><img src='img/fw_bold.gif'></td>\n\t\t\t<td " . CellRollOver("pvcreate_dev('{$dev_path}')") . ">{pvcreate_dev}</td>\n\t\t\t</tr>";
                if (is_array($lvm_dev[$dev_path])) {
                    $init = null;
                    if ($lvm_dev["{$dev_path}"]["GROUP"] == null) {
                        $create_group = "\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td width=1%><img src='img/fw_bold.gif'></td>\n\t\t\t\t\t<td " . CellRollOver("vgcreate_dev('{$dev_path}')") . ">{vgcreate_dev}</td>\n\t\t\t\t\t</tr>";
                    } else {
                        $create_group = "\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2><hr><span style='font-size:14px'>{APP_LVM}</td></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr><td colspan=2>&nbsp;</td></tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td width=1%><img src='img/mailbox_hd.png'></td>\n\t\t\t\t\t<td " . CellRollOver("vg_refresh_list('{$lvm_dev["{$dev_path}"]["GROUP"]}')") . " style='font-size:13px'>{vgmanage}:{$lvm_dev["{$dev_path}"]["GROUP"]}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan=2><div id='LIST_{$lvm_dev["{$dev_path}"]["GROUP"]}'>" . lv_groups_list($lvm_dev["{$dev_path}"]["GROUP"]) . "</div></td>\n\t\t\t\t\t</tr>";
                    }
                }
                $partitions_options = $partitions_options . $init . $create_group;
                $partitions_options = $partitions_options . "</table>";
            }
            $pourcent_pix = $pourcent * 3;
            $html = $html . "\n\t<table style='width:99%' class=form>\n\t\t<td valign='top'>\n\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t<strong style='font-size:16px'>{$ID_FS_LABEL} {$MOUNTED}</strong><br>\n\t\t\t\t\t\t<span style='font-size:15px;font-weight:bold'>{$TYPE} - {$line["TYPE"]} ({$TOTSIZE})&nbsp;&laquo;&nbsp;{$dev_path}&nbsp;&raquo;</span>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<div style='width:300px;border:1px solid #CCCCCC;height:30px;background-color:#00E100'>\n\t\t\t\t\t\t\t\t<div style='float:right;color:white;padding:5px;font-size:13px;font-weight:bold'>{$text}</div>\n\t\t\t\t\t\t\t\t<div style='width:{$pourcent_pix};background-color:#D20B2A;height:30px'>&nbsp;</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t{$partitions_options}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t\t<td valign='top'>\n\t\t\t\t<table style='width:99%' class=form>\n\t\t\t\t\t{$option_label}\n\t\t\t\t\t{$option_macro_create}\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n\t\n\t";
        }
        return $html;
    }
}
Пример #9
0
function server_status()
{
    $PHP5_CURRENT_MEMORY = null;
    if (!$GLOBALS["VERBOSE"]) {
        if (!isset($_GET["without-cache"])) {
            unset($_GET["_"]);
            $md5CacheF = md5("server_status{$_SESSION["uid"]}{$tpl->language}" . serialize($_GET));
            $cachefile = "/usr/share/artica-postfix/ressources/interface-cache/{$md5CacheF}";
            if (file_time_sec_Web($cachefile) < 10) {
                return @file_get_contents($cachefile);
            }
        }
    }
    $BOGOMIPS = 0;
    if (is_file("/usr/share/artica-postfix/ressources/interface-cache/processor_type")) {
        $processor_type = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/interface-cache/processor_type"));
        $BOGOMIPS = intval($processor_type["BOGOMIPS"]);
    }
    $icon = "server-128-ok.png";
    $os = new os_system();
    $sock = new sockets();
    $users = new usersMenus();
    $Warn = false;
    $HyperWarn = true;
    $tpl = new templates();
    $EnableMsftncsi = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableMsftncsi"));
    $EnableIntelCeleron = intval($sock->GET_INFO("EnableIntelCeleron"));
    $ArticaAutoUpateOfficial = $sock->GET_INFO("ArticaAutoUpateOfficial");
    $ArticaAutoUpateNightly = intval($sock->GET_INFO("ArticaAutoUpateNightly"));
    $ArticaUpdateIntervalAllways = intval($sock->GET_INFO("ArticaUpdateIntervalAllways"));
    if (!is_numeric($ArticaAutoUpateOfficial)) {
        $ArticaAutoUpateOfficial = 1;
    }
    $RootPasswordChanged = intval($sock->GET_INFO("RootPasswordChanged"));
    $influxdb_version = @file_get_contents("{$GLOBALS["BASEDIR"]}/influxdb_version");
    $influxdbversionBin = $influxdb_version;
    $RegisterCloudBadEmail = intval($sock->GET_INFO("RegisterCloudBadEmail"));
    $InfluxUseRemote = intval($sock->GET_INFO("InfluxUseRemote"));
    $InfluxUseRemoteInfo = intval($sock->GET_INFO("InfluxUseRemoteInfo"));
    $SessionPathInMemory = intval($sock->GET_INFO("SessionPathInMemory"));
    $EnableBandwithCalculation = intval($sock->GET_INFO("EnableBandwithCalculation"));
    $DashBoardDNSPerfsStats = $sock->GET_INFO("DashBoardDNSPerfsStats");
    $BigDatav3Read = intval($sock->GET_INFO("BigDatav3Read"));
    $EnableArticaMetaClient = intval($sock->GET_INFO("EnableArticaMetaClient"));
    $SquidPerformance = intval($sock->GET_INFO("SquidPerformance"));
    $ArticaTechNetInfluxRepo = unserialize(base64_decode($sock->GET_INFO("ArticaTechNetInfluxRepo")));
    $LicenseInfos = unserialize(base64_decode($sock->GET_INFO("LicenseInfos")));
    $EnableArticaMetaServer = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableArticaMetaServer"));
    if ($EnableArticaMetaServer == 1) {
        $EnableArticaMetaClient = 0;
    }
    if ($EnableArticaMetaClient == 1) {
        $ArticaMetaHost = $sock->GET_INFO("ArticaMetaHost");
        if ($ArticaMetaHost == null) {
            $err[] = proxy_status_warning("{incorrect_meta_server_address}", "{click_to_edit}", "GotoArticaMeta()");
        }
    }
    if ($SessionPathInMemory > 0) {
        exec("/bin/df -h /var/lib/php5 2>&1", $results);
        while (list($num, $ligne) = each($results)) {
            if (!preg_match("#tmpfs\\s+(.+?)\\s+(.+?)\\s+(.+?)\\s+(.+?)%\\s+#", $ligne, $re)) {
                continue;
            }
            $PHP5_CURRENT_MEMORY = $re[4];
            $PHP5_CURRENT_MEMORY_SIZE = $re[1];
        }
    }
    if (!is_file("/usr/share/artica-postfix/ressources/interface-cache/CPU_NUMBER")) {
        $sock = new sockets();
        $CPU_NUMBER = intval($sock->getFrameWork("services.php?CPU-NUMBER=yes"));
    } else {
        $CPU_NUMBER = intval(@file_get_contents("/usr/share/artica-postfix/ressources/interface-cache/CPU_NUMBER"));
    }
    if ($CPU_NUMBER < 2) {
        if ($EnableIntelCeleron == 0) {
            $warn[] = status_important_event("{performance_issue_cpu_number_text}", "{click_to_fix}", "GotoOptimizeSystem()");
        }
    }
    if ($EnableMsftncsi == 1) {
        $msftncsiStatus = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/msftncsiStatus"));
        if ($msftncsiStatus == 3) {
            $warn[] = status_important_event("{network_awareness} !!", "", "GotoWatchdog()");
        }
    }
    $results = array();
    exec("/usr/bin/pgrep -l -f \"philesight --db\" 2>&1", $results);
    while (list($num, $ligne) = each($results)) {
        $ligne = trim($ligne);
        if ($ligne == null) {
            continue;
        }
        if (preg_match("#pgrep#", $ligne)) {
            continue;
        }
        if (!preg_match("#^([0-9]+)\\s+#", $ligne)) {
            $warn[] = status_important_event("{APP_PHILESIGHT_INDEXING}", null, "blur()");
            break;
        }
    }
    $curs = "OnMouseOver=\"this.style.cursor='pointer';\"\n\tOnMouseOut=\"this.style.cursor='auto'\"";
    $os->html_Memory_usage();
    $EnableKerbAuth = intval($sock->GET_INFO("EnableKerbAuth"));
    $MAIN = $os->meta_array;
    $PHP5_CURRENT_MEMORY_COLOR = "black";
    $LOAD_COLOR = "black";
    $ORG_LOAD = $MAIN["LOAD"]["ORG_LOAD"];
    $CPU_NUMBER = $MAIN["LOAD"]["CPU_NUMBER"];
    $MAXOVER = $MAIN["LOAD"]["MAXOVER"];
    $MEM_USED_POURC = $MAIN["MEM"]["MEM_USED_POURC"];
    $MEM_USED_COLOR = "black";
    $SWAP_POURC = $MAIN["SWAP_POURC"];
    $DISKY = array();
    $MAXOVER2 = $CPU_NUMBER - 1;
    if ($MAXOVER2 == 0) {
        $MAXOVER2 = 1.5;
    }
    $EnableIntelCeleronText = null;
    $CURVER = @file_get_contents("VERSION");
    $CURVER_KEY = str_replace(".", "", $CURVER);
    if ($EnableIntelCeleron == 1) {
        $EnableIntelCeleronText = "{intel_celeron_support}";
        $MAXOVER2 = 2;
    }
    $INFO_WORKING_TASK = INFO_WORKING_TASK();
    if (is_array($INFO_WORKING_TASK)) {
        $INFOS = $INFO_WORKING_TASK;
    }
    if (!$users->STATS_APPLIANCE) {
        if ($InfluxUseRemote == 0) {
            if ($EnableIntelCeleron == 0) {
                if ($InfluxUseRemoteInfo == 0) {
                    if ($SquidPerformance < 2) {
                        $INFOS[] = status_info_event("{suggest_remote_statistics_appliance}", "{suggest_remote_statistics_appliance}<br>{click_here}", "Loadjs('influx.remote.suggest.php')");
                    }
                }
            }
        }
    }
    if ($ORG_LOAD > $MAXOVER2) {
        $LOAD_COLOR = "#F59C44";
        $Warn = true;
        $icon = "server-128-warn.png";
        $microerror_text = "{overloaded} {$ORG_LOAD} &raquo; {$MAXOVER2}";
    }
    $SWAPERR = false;
    if ($ORG_LOAD > $MAXOVER) {
        $HyperWarn = true;
        $LOAD_COLOR = "#D32D2D";
        $icon = "server-128-critic.png";
        $microerror_text = "{overloaded} {$ORG_LOAD} &raquo; {$MAXOVER}";
    }
    if ($MEM_USED_POURC > 79) {
        $microerror_text = "{memory_warning}";
        if (!$HyperWarn) {
            $icon = "server-128-warn.png";
        }
        $MEM_USED_COLOR = "#F59C44";
        $jsOn = "GotoSystemMemory()";
        if (!$users->AsArticaAdministrator) {
            $jsOn = "blur()";
        }
        $err[] = "<tr><td style='font-size:18px;color:#d32d2d;vertical-align:middle'>\n\t\t<img src='img/warn-red-32.png' style='float:left;margin-right:10px'>\n\t\t<span style='text-decoration:underline' {$curs} OnClick=\"javascript:{$jsOn}\">{overloaded_memory}</span>\n\t\t</td></tr>";
        $SWAPERR = true;
    }
    if ($MEM_USED_POURC > 90) {
        $microerror_text = "{memory_alert}";
        $icon = "server-128-critic.png";
        $MEM_USED_COLOR = "#D32D2D";
        if (!$SWAPERR) {
            $jsOn = "GotoSystemMemory()";
            if (!$users->AsArticaAdministrator) {
                $jsOn = "blur()";
            }
            $icon = "disks-128-warn.png";
            $err[] = "<tr><td style='font-size:18px;color:#d32d2d;vertical-align:middle'>\n\t\t\t<img src='img/warn-red-32.png' style='float:left;margin-right:10px'>\n\t\t\t<span style='text-decoration:underline' {$curs} OnClick=\"javascript:{$jsOn}\">{overloaded_memory}</span>\n\t\t\t</td></tr>";
            $SWAPERR = true;
        }
    }
    if ($SWAP_POURC > 20) {
        if (!$HyperWarn) {
            $microerror_text = "{swap_warning}";
            $icon = "server-128-warn.png";
        }
        $SWAP_COLOR = "#F59C44";
    }
    if ($PHP5_CURRENT_MEMORY > 80) {
        if (!$HyperWarn) {
            $microerror_text = "{swap_warning}";
            $icon = "server-128-warn.png";
        }
        $PHP5_CURRENT_MEMORY_COLOR = "#F59C44";
    }
    if ($SWAP_POURC > 30) {
        if (!$HyperWarn) {
            $microerror_text = "{swap_warning}";
            $icon = "server-128-warn.png";
        }
        $SWAP_COLOR = "#D32D2D";
    }
    if ($SWAP_POURC > 50) {
        $microerror_text = "{swap_alert}";
        $icon = "server-128-critic.png";
        $SWAP_COLOR = "#D32D2D";
        $jsOn = "GotoSystemMemory()";
        if (!$users->AsArticaAdministrator) {
            $jsOn = "blur()";
        }
        $err[] = proxy_status_warning("{high_swap_value}", "{high_swap_value}", $jsOn);
    }
    if ($PHP5_CURRENT_MEMORY > 95) {
        if (!$HyperWarn) {
            $microerror_text = "{session_memory_warning}";
            $icon = "server-128-warn.png";
        }
        $PHP5_CURRENT_MEMORY_COLOR = "#D32D2D";
    }
    if ($EnableIntelCeleron == 0) {
        $sock->getFrameWork("postgres.php?is-installed=yes");
        $PostgresInstalled = intval($sock->GET_INFO("PostgresInstalled"));
        if ($PostgresInstalled == 0) {
            $jsOn = "Loadjs('influxdb.install.progress.php');";
            if (!$users->AsArticaAdministrator) {
                $jsOn = "blur()";
            }
            $err[] = proxy_status_warning("{influx_not_installed}", "{click_to_install}", $jsOn);
        } else {
            $influxdb_tests = influxdb_tests();
            if ($influxdb_tests != null) {
                $err[] = $influxdb_tests;
            }
        }
    }
    if (isset($LicenseInfos["FINAL_TIME"])) {
        if (is_numeric($LicenseInfos["FINAL_TIME"])) {
            $FINAL_TIME = intval($LicenseInfos["FINAL_TIME"]);
            $ExpiresSoon = intval(time_between_day_Web($FINAL_TIME));
            $jsOn = "GoToArticaLicense()";
            $distanceOfTimeInWords = distanceOfTimeInWords(time(), $FINAL_TIME);
            if (!$users->AsSystemAdministrator) {
                $jsOn = null;
            }
            $corporate_licence_will_expire_explain = $tpl->_ENGINE_parse_body("{corporate_licence_will_expire_explain}");
            $corporate_licence_will_expire_explain = str_replace("%d", $ExpiresSoon, $corporate_licence_will_expire_explain);
            if (time() > $FINAL_TIME) {
                $err[] = proxy_status_warning("{license2}:&nbsp;{license_expired} !!", "{license_expired_explain}", $jsOn);
            }
            if ($FINAL_TIME > time()) {
                if ($ExpiresSoon < 10) {
                    $err[] = proxy_status_warning("{corporate_licence_will_expire} ({$ExpiresSoon} {days})", "{$corporate_licence_will_expire_explain}", $jsOn);
                }
                if ($ExpiresSoon < 31) {
                    $ExpiresSoon = $ExpiresSoon + 1;
                    $warn[] = status_important_event("{license2}:&nbsp;{trial_period} - {$ExpiresSoon} {days} -", "{expiredate}:" . $tpl->time_to_date($FINAL_TIME) . " ({$distanceOfTimeInWords})", $jsOn);
                }
            }
        }
    }
    if (!$users->CGROUPS_INSTALLED) {
        $jsOn = "Loadjs('cgroups.install.progress.php');";
        if (!$users->AsArticaAdministrator) {
            $jsOn = "blur()";
        }
        $warn[] = status_important_event("{cgroups_not_installed}", "{click_to_install}", $jsOn);
    }
    if ($RegisterCloudBadEmail == 1) {
        $warn[] = status_important_event("{incorrect_email_address}", "{incorrect_email_address_cloud}", "GoToArticaLicense()");
    }
    if (!extension_loaded('pgsql')) {
        $warn[] = status_important_event("{missing_postgres_library}", "{missing_postgres_library_explain}", "Loadjs('admin.pgsql.php')");
    } else {
        if (!function_exists("pg_connect")) {
            $warn[] = status_important_event("{missing_postgres_library}", "{missing_postgres_library_explain}", "Loadjs('admin.pgsql.php')");
        }
    }
    if ($BOGOMIPS > 0) {
        if ($users->CGROUPS_INSTALLED) {
            if ($BOGOMIPS < 3500) {
                if ($EnableIntelCeleron == 0) {
                    $jsOn = "Loadjs('system.optimize.celeron.wizard.php');";
                    $err[] = status_important_event("{low_performance}", "{low_performance_link_explain}", $jsOn);
                }
            }
        }
    }
    $q = new mysql();
    $perfs_queue = $q->COUNT_ROWS("perfs_queue", "artica_events");
    if ($perfs_queue > 0) {
        $dashboard_perfs_queue = $tpl->_ENGINE_parse_body("{dashboard_perfs_queue}");
        $dashboard_perfs_queue = str_replace("%s", $perfs_queue, $dashboard_perfs_queue);
        $warn[] = status_important_event($dashboard_perfs_queue, "{$dashboard_perfs_queue}", "GotoDashBoardPerfQueue()");
    }
    $HostType = null;
    if ($users->VMWARE_HOST) {
        $HostType = "VMWare Edition";
        $HostTypejs = "GotoVMWareClient();";
        if (trim($sock->getFrameWork("services.php?vmtools_installed=yes")) != "TRUE") {
            $jsOn = "Loadjs('vmware.install.progress.php');";
            if (!$users->AsArticaAdministrator) {
                $jsOn = "blur()";
            }
            $warn[] = status_important_event("{APP_VMWARE_TOOLS_NOT_INSTALLED}", "{click_to_install}", $jsOn);
        }
    }
    if (is_array($MAIN["DISKS"])) {
        while (list($disk, $array) = each($MAIN["DISKS"])) {
            $POURC = $array["POURC"];
            $LABEL = $array["LABEL"];
            if ($LABEL == null) {
                $LABEL = $disk;
            }
            if ($POURC < 80) {
                continue;
            }
            $DISK_COLOR = "#F59C44";
            $icon = "server-128-warn.png";
            $microerror_text = "{partition_warning}";
            $diskZ = "\t\n\t\t\t<tr>\n\t\t\t<td style='font-size:20px;color:{$DISK_COLOR}'>{$LABEL} {$POURC}% {used}</td>\n\t\t\t</tr>";
            if ($POURC > 95) {
                $DISK_COLOR = "#D32D2D";
                $icon = "server-128-critic.png";
                $diskZ = "\t<tr>\n\t\t\t<td style='font-size:20px;color:{$DISK_COLOR}'>{$LABEL} {$POURC}% {used}</td>\n\t\t\t</tr>";
            }
            $DISKY[] = $diskZ;
        }
    }
    if ($RootPasswordChanged == 0) {
        $jsOn = "Loadjs('system.root.pwd.php')";
        if (!$users->AsSystemAdministrator) {
            $jsOn = null;
        }
        $err[] = status_important_event("{root_password_not_changed}", "{root_password_not_changed_text}", $jsOn);
    }
    if (count($err) > 0) {
        $errT[] = "<tr><td style='font-size:32px;color:#d32d2d;vertical-align:middle'>" . count($err) . " {issues}</td></tr>\n\t\t<tr><td colspan=2>&nbsp;</td></tr>\n\t\t";
    }
    $GotoSpeedTests = "GotoSpeedTests()";
    $GotoBandwidthdStats = "GotoBandwidthdStats()";
    $GoToSystem = "GoToSystem()";
    $GotToArticaUpdate = "GotToArticaUpdate()";
    $GotoOptimizeSystem = "GotoOptimizeSystem()";
    $GotoDNSPerfs = "GotoDNSPerfs()";
    $GotoSystemMemory = "GotoSystemMemory()";
    $GotoStatsSystem = "GotoStatsSystem()";
    $GotoStatsSystem_underline = "underline";
    $HostTypejs_underline = "underline";
    if (!$users->AsSystemAdministrator) {
        $microerror_text = null;
        $HostTypejs_underline = "none";
        $GotoStatsSystem_underline = "none";
        $HostTypejs = "blur();";
        $GoToSystem = "blur()";
        $GotoStatsSystem = "blur()";
        $GotoSystemMemory = "blur()";
        $GotoDNSPerfs = "blur()";
        $GotoOptimizeSystem = "blur()";
        $GotToArticaUpdate = "blur()";
        $GotoBandwidthdStats = "blur()";
        $GotoSpeedTests = "blur()";
    }
    if ($EnableBandwithCalculation == 1) {
        $q = new mysql();
        $sql = "SELECT * FROM speedtests ORDER BY zDate DESC LIMIT 0,1";
        $speedtests = null;
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events"));
        $download = $ligne["download"];
        $upload = $ligne["upload"];
        $ISP = $ligne["ISP"];
        //Kbi/s upload 51.2 Kbi/s
        if ($download > 0) {
            $speedtests = "\n\t\t\t\t<tr>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t<td style='font-size:16px;'>\n\t\t\t\t<span style='color:black'><a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:{$GotoSpeedTests};\" style='text-decoration:{$GotoStatsSystem_underline}'>\n\t\t\t\t{bandwidth}: <i style='font-size:16px'>{$download}Kbit/sec {download2}</i></td>\n\t\t\t\t</tr><tr>\n\t\t\t\t<td style='font-size:16px;'>\n\t\t\t\t<span style='color:black'><a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:{$GotoSpeedTests};\" style='text-decoration:{$GotoStatsSystem_underline}'>\n\t\t\t\t{bandwidth}: <i style='font-size:16px'>{$upload}Kbit/sec {upload}</a> ({$ISP})</span></i></td>\n\t\t\t\t</tr>";
        }
    }
    if ($sock->Bandwidthd_enabled() == 1) {
        $q = new mysql_squid_builder();
        $bandwidthd_today = $q->COUNT_ROWS("bandwidthd_today");
        if ($bandwidthd_today > 0) {
            $speedtests = $speedtests . "\n\t\t\t<tr>\n\t\t\t<td style='font-size:18px;'>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t<td valign='middle' style='width:25px'><img src='img/graph-24.png'></td>\n\t\t\t<td valign='middle'>\n\t\t\t<span style='color:black'><a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:{$GotoBandwidthdStats};\" style='text-decoration:{$GotoStatsSystem_underline}'>\n\t\t\t<span style='font-size:18px;font-weight:bold'>{$bandwidthd_today}</span> <span style='font-size:18px;'>{nodes}</span></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</td>\n\t\t\t</tr>";
        }
    }
    if ($users->AsSystemAdministrator) {
        if ($EnableArticaMetaClient == 0) {
            if ($ArticaAutoUpateOfficial == 1) {
                $ArticaUpdateRepos = unserialize($sock->GET_INFO("ArticaUpdateRepos"));
                $key_nightly = update_find_latest_nightly($ArticaUpdateRepos);
                $key_offical = update_find_latest($ArticaUpdateRepos);
                $OFFICIALS = $ArticaUpdateRepos["OFF"];
                $Lastest = $OFFICIALS[$key_offical]["VERSION"];
                $MAIN_URI = $OFFICIALS[$key_offical]["URL"];
                $MAIN_MD5 = $OFFICIALS[$key_offical]["MD5"];
                $MAIN_FILENAME = $OFFICIALS[$key_offical]["FILENAME"];
                if ($key_offical > $CURVER_KEY) {
                    $err[] = "<tr><td style='font-size:18px;color:#46a346;vertical-align:middle' nowrap>\n\t\t\t\t<img src='img/32-install-soft.png' style='float:left;margin-right:10px'>\n\t\t\t\t" . texttooltip("{new_version}: {$Lastest}", "{NEW_RELEASE_TEXT}", "{$GotToArticaUpdate}") . "\n\t\t\t\t</td></tr>";
                }
            }
        }
    }
    if ($EnableIntelCeleron == 1) {
        $EnableIntelCeleron_explain = "<tr><td style='font-size:16px;color:#000000;vertical-align:middle' nowrap>\n\t\t\t\t<i>" . texttooltip("{CELERON_METHOD}", "{CELERON_METHOD_EXPLAIN}", $GotoOptimizeSystem) . "</i>\n\t\t\t\t</td></tr>";
    }
    $EnableDNSPerfs = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableDNSPerfs"));
    if ($EnableDNSPerfs == 1) {
        if ($EnableIntelCeleron == 0) {
            $DNS_COLOR = "black;";
            if ($DashBoardDNSPerfsStats != null) {
                $DashBoardDNSPerfsStats = round($DashBoardDNSPerfsStats, 2);
                if ($DashBoardDNSPerfsStats < 30) {
                    $DNS_COLOR = "#D32D2D";
                }
                $DashBoardDNSPerfsStats_text = "\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td style='font-size:20px;color:{$DNS_COLOR}'>" . texttooltip("{dns_performance}", "{dnsperf_explain}", "{$GotoDNSPerfs}") . ": {$DashBoardDNSPerfsStats}%</td>\n\t\t\t\t\t</tr>";
            }
        }
    }
    if ($microerror_text != null) {
        $microerror_text = "<center style='margin-top:10px;font-weight:bold;font-size:14px'>{$microerror_text}</center>";
    }
    if ($HostType != null) {
        $HostType = "<center style='font-size:14px;margin-top:10px;'>\n\t<a href=\"javascript:blur();\" OnClick=\"javascript:{$HostTypejs}\" style='text-decoration:{$HostTypejs_underline}'>\n\t\t{$HostType}</a></center>";
    }
    $html[] = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' style='width:128px'  {$curs} OnClick=\"javascript:{$GoToSystem}\">\n\t\t<img src='img/{$icon}'>{$HostType}{$microerror_text}\n\t</td>\n\t<td>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='font-size:30px'  {$curs} OnClick=\"javascript:{$GoToSystem}\">{system}</td>\n\t</tr>\t\n\t<tr>\n\t<td style='font-size:30px;color:{$LOAD_COLOR};text-decoration:{$GotoStatsSystem_underline}' {$curs} OnClick=\"javascript:{$GotoStatsSystem};\">{$ORG_LOAD} {load2}</td>\n\t</tr>\n\t{$EnableIntelCeleron_explain}\n\t<tr>\n\t\t<td style='font-size:20px;'>\n\t\t<span style='color:{$MEM_USED_COLOR}'><a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:{$GotoSystemMemory};\" style='text-decoration:{$GotoStatsSystem_underline}'>\t\t\n\t\t{$MEM_USED_POURC}% {memory}</a></span>&nbsp;|&nbsp;\n\t\t<span style='color:{$SWAP_COLOR}'>{$SWAP_POURC}% SWAP</span></td>\n\t</tr>\n\t";
    if ($users->AsSystemAdministrator) {
        if ($PHP5_CURRENT_MEMORY != null) {
            $html[] = "<tr>\n\t\t\t<td style='font-size:18px;'>\n\t\t\t<span style='color:{$PHP5_CURRENT_MEMORY_COLOR}'><a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:{$GotoSystemMemory};\" style='text-decoration:{$GotoStatsSystem_underline}'>\n\t\t\t{session_memory}: {$PHP5_CURRENT_MEMORY}%/{$PHP5_CURRENT_MEMORY_SIZE}</a></span></td>\n\t\t\t</tr>";
        }
    }
    if ($users->AsSystemAdministrator) {
        if (is_file("/usr/share/artica-postfix/ressources/logs/web/monit.status.all")) {
            $dataMonit = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/monit.status.all"));
            $dataMonitCount = count($dataMonit);
            $html[] = "<tr>\n\t\t\t<td style='font-size:18px;'>\n\t\t\t<span style='color:black'><a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('monit.php');\" style='text-decoration:underline'>\n\t\t\t{monitored_processes}: {$dataMonitCount}</a></span></td>\n\t\t\t</tr>";
        }
    }
    if (!$users->AsSystemAdministrator) {
        $INFOS = array();
        $errT = array();
        $err = array();
        $warn = array();
    }
    $html[] = $DashBoardDNSPerfsStats_text;
    if ($speedtests != null) {
        $html[] = $speedtests;
    }
    if (count($INFOS) > 0) {
        $html[] = @implode("", $INFOS);
        $html[] = "<tr><td colspan=2>&nbsp;</td></tr>";
    }
    if (count($DISKY) > 0) {
        $html[] = @implode("", $DISKY);
    }
    $page = CurrentPageName();
    $seqfw = "LoadAjaxRound('sequence-firewall','{$page}?sequence-firewall=yes');";
    if (isset($_GET["nofw"])) {
        $seqfw = null;
    }
    $html[] = "" . @implode("", $errT) . "\n\t" . @implode("", $err) . @implode("", $warn) . "\n\t\t\t\n\t</table>\n\t</td>\n\t</tr>\n\t</table>\n\t<script>\n\t\n\tfunction LoadseQuenceProxy(){\n\t\tLoadAjaxSilent('sequence-proxy','{$page}?sequence-proxy=yes&nofw=yes&sequence=yes');\n\t\n\t}\n\t\n\n\tfunction LoadSequenceServer(){\n\t\t\tif( !document.getElementById('sequence-server')){return;}\n\t\t\t\n\t\t\tvar DASHBOARD_SEQUENCE_SERVER=parseInt(document.getElementById('DASHBOARD_SEQUENCE_SERVER').value);\n\t\t\tif(DASHBOARD_SEQUENCE_SERVER<10){\n\t\t\t\tDASHBOARD_SEQUENCE_SERVER=DASHBOARD_SEQUENCE_SERVER+1;\n\t\t\t\tdocument.getElementById('DASHBOARD_SEQUENCE_SERVER').value=DASHBOARD_SEQUENCE_SERVER;\n\t\t\t\tsetTimeout('LoadSequenceServer()',1000);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tdocument.getElementById('DASHBOARD_SEQUENCE_SERVER').value=0;\n\t\t\tLoadAjaxSilent('sequence-server','{$page}?sequence-server=yes&nofw=yes&sequence=yes');\n\t\t\tsetTimeout('LoadseQuenceProxy()',20000);\n\t\t}\n\tsetTimeout('LoadSequenceServer()',5000);\n\t</script>\t\t\n\t";
    $html = $tpl->_ENGINE_parse_body(@implode("", $html));
    @file_put_contents($cachefile, $html);
    return $html;
}
Пример #10
0
function MYSQL_AUDIT()
{
    $q = new mysql();
    include_once "ressources/class.os.system.tools.inc";
    $os = new os_system();
    $mem = $os->memory();
    $phy = round($mem["ram"]["total"] / 1000);
    $swap = round($mem["swap"]["total"] / 1000);
    $html = "<H1>{mysql_audit}</H1>\n\t<table style='width:100%' class=table_form>\n\t\t<tr>\n\t\t\t<td class=legend>{server}:</td>\n\t\t\t<td><strong>{$q->mysql_server}:{$q->mysql_port}</td>\n\t\t</tR>\n\t\t<tr>\n\t\t<td class=legend>{server_memory}:</td>\n\t\t<td> <strong>" . Field_text('server_memory', $phy, 'width:60px;font-size:14px;padding:3px') . "Mb</tD>\n\t\t</tr>\n\t\t<td class=legend>{server_swap}:</td>\n\t\t<td> <strong>" . Field_text('server_swap', $swap, 'width:60px;font-size:14px;padding:3px') . "Mb</tD>\n\t\t</tr>\t\n\t\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . button("{go}", "CheckMysqlAudit()") . "\n\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t<div style='width:100%;height:300px;overflow:auto' id='mysqlaudit'></div>";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html, 'mysql.index.php');
}
Пример #11
0
function Virtualizer_status(){
	include_once("ressources/class.os.system.tools.inc");
	$tpl=new templates();
	$os=new os_system();
	echo $tpl->_ENGINE_parse_body($os->MinimalStatus());
	
}
Пример #12
0
function high_menus()
{
    return;
    $sock = new sockets();
    $FixedLanguage = $sock->GET_INFO("FixedLanguage");
    if (!isset($GLOBALS["CLASS_USERS_MENUS"])) {
        $users = new usersMenus();
        $GLOBALS["CLASS_USERS_MENUS"] = $users;
    } else {
        $users = $GLOBALS["CLASS_USERS_MENUS"];
    }
    $tpl = new templates();
    if (is_file("ressources/templates/{$_COOKIE["artica-template"]}/HEAD_MENUS")) {
        $html = @file_get_contents("ressources/templates/{$_COOKIE["artica-template"]}/HEAD_MENUS");
        $html = str_replace("%articaver%", $users->ARTICA_VERSION, $html);
        echo $tpl->_ENGINE_parse_body($html);
        return;
    }
    include_once dirname(__FILE__) . "/ressources/class.html.tools.inc";
    $htmlT = new htmltools_inc();
    $lang = $htmlT->LanguageArray();
    $users = new usersMenus();
    if (!is_numeric($_SESSION["SWITCH_HIGH_MENUS"])) {
        $_SESSION["SWITCH_HIGH_MENUS"] = 1;
    }
    if ($users->AsAnAdministratorGeneric) {
        if ($_SESSION["SWITCH_HIGH_MENUS"] == 1) {
            $html = "\t\n\t\t\t<table style='width:80%;padding:0px;margin:0px;border:0px;margin-top:2px'>\n\t\t\t<tr>\n\t\t\t";
            if ($_SESSION["uid"] == -100) {
                $html = $html . "<td><a href='#' OnClick=\"javascript:Loadjs('artica.settings.php?js=yes&func-AccountsInterface=yes');\" style='color:#CCCCCC;font-size:11px;text-decoration:underline'>Manager</a></td>\n\t\t\t<td style='color:white;font-size:11px;'>&nbsp;|&nbsp;</td>";
            }
            $html = $html . "\n\t\t\t\t<td><a href='#' OnClick=\"javascript:logoff();\" style='color:#CCCCCC;font-size:11px;text-decoration:underline'>{logoff}</a></td>\n\t\t\t\t<td style='color:white;font-size:11px;'>&nbsp;|&nbsp;</td>\n\t\t\t<td><a href='#' OnClick=\"javascript:Loadjs('chg.language.php');\" style='color:#CCCCCC;font-size:11px;text-decoration:underline'>{language}:&nbsp;{$tpl->language}</a></td>\n\t\t\t<td style='color:white;font-size:11px;'>&nbsp;|&nbsp;</td>\n\t\t\t<td><a href='#' OnClick=\"javascript:Loadjs('artica.update.php?js=yes')\" style='color:#CCCCCC;font-size:11px;text-decoration:underline'>{version}:&nbsp;{$users->ARTICA_VERSION}</a></td>\n\t\t\t<td style='color:white;font-size:11px;'>&nbsp;|&nbsp;</td>\n\t\t\t<td><a href='#' OnClick=\"javascript:AjaxTopMenuTiny('div-high-menus','Inotify.php?switch-high=yes');\" \n\t\t\tstyle='color:#CCCCCC;font-size:11px;'>&raquo;&raquo;</a></td>\t\t\t\t\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t";
            $_SESSION["SWITCH_HIGH_MENUS"] = 0;
            echo $tpl->_ENGINE_parse_body($html);
        } else {
            include_once dirname(__FILE__) . "/ressources/class.os.system.inc";
            include_once dirname(__FILE__) . "/ressources/class.os.system.tools.inc";
            $os = new os_system();
            $cpunum = intval($users->CPU_NUMBER);
            $array_load = sys_getloadavg();
            $org_load = $array_load[2];
            $load = intval($org_load);
            $hash_mem = $os->realMemory();
            $mem_used_p = $hash_mem["ram"]["percent"];
            $mem_used_kb = FormatBytes($hash_mem["ram"]["used"]);
            $total = FormatBytes($hash_mem["ram"]["total"]);
            $swapar = $os->swap();
            $max_vert_fonce = $cpunum;
            $max_vert_tfonce = $cpunum + 1;
            $max_orange = $cpunum * 0.75;
            $max_over = $cpunum * 2;
            $purc1 = $load / $cpunum;
            $pourc = round($purc1 * 100, 2);
            $color = "#5DD13D";
            if ($load >= $max_orange) {
                $color = "#F59C44";
            }
            if ($load > $max_vert_fonce) {
                $color = "#C5792D";
            }
            if ($load > $max_vert_tfonce) {
                $color = "#83501F";
            }
            if ($load >= $max_over) {
                $color = "#640000";
                $text = "{overloaded}";
            }
            $html = "\t\n\t\t\t<table style='width:80%;padding:0px;margin:0px;border:0px;margin-top:2px'>\n\t\t\t<tbody>\n\t\t\t<tr>";
            if ($_SESSION["uid"] == -100) {
                $html = $html . "<td><a href='#' OnClick=\"javascript:Loadjs('artica.settings.php?js=yes&func-AccountsInterface=yes');\" style='color:#CCCCCC;font-size:11px;text-decoration:underline'>Manager</a></td>\n\t\t\t<td style='color:white;font-size:11px;'>&nbsp;|&nbsp;</td>";
            }
            $html = $html . "<td nowrap><a href='#' OnClick=\"javascript:logoff();\" style='color:#CCCCCC;font-size:11px;text-decoration:underline'>{logoff}</a></td>\n\t\t\t<td style='color:white;font-size:11px;'>&nbsp;|&nbsp;</td>\t\t\n\t\t\t<td nowrap><a href='#' OnClick=\"javascript:Loadjs('chg.language.php');\" \n\t\t\tstyle='color:#CCCCCC;font-size:11px;'>{load}: {$org_load}</a></td>\t\n\t\t\t<td style='color:white;font-size:11px;' nowrap>&nbsp;|&nbsp;</td>\n\t\t\t<td nowrap><a href='#' OnClick=\"javascript:Loadjs('chg.language.php');\" \n\t\t\tstyle='color:#CCCCCC;font-size:11px;' nowrap>mem: {$mem_used_p}%</a></td>\n\t\t\t<td style='color:white;font-size:11px;' nowrap>&nbsp;|&nbsp;</td>\n<td nowrap><a href='#' OnClick=\"javascript:Loadjs('chg.language.php');\" \n\t\t\tstyle='color:#CCCCCC;font-size:11px;' nowrap>swap: {$swapar[0]}%</a></td>\t\n\t\t\t<td style='color:white;font-size:11px;'>&nbsp;|&nbsp;</td>\n\t\t\t<td nowrap><a href='#' OnClick=\"javascript:AjaxTopMenuTiny('div-high-menus','Inotify.php?switch-high=yes');\" \n\t\t\tstyle='color:#CCCCCC;font-size:11px;'>&raquo;&raquo;</a></td>\t\t\t\t\t\t\n\t\t\t</tR>\n\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t";
            $_SESSION["SWITCH_HIGH_MENUS"] = 1;
            echo $tpl->_ENGINE_parse_body($html);
        }
    }
}
Пример #13
0
function render_page($content=null){

$hour=date('h');
$key_cache="CACHEINFOS_STATUSSEVERREDNDER$hour";
if(isset($_SESSION[$key_cache])){return $_SESSION[$key_cache];}
unset($_SESSION["DISTRI"]);

include_once('ressources/class.os.system.inc');
include_once("ressources/class.os.system.tools.inc");
if(!isset($_SESSION["DISTRI"])){
	$sys=new systeminfos();
	writelogs('Loading datas system for session',__FUNCTION__,__FILE__);
	$distri=$sys->ditribution_name;
	$kernel=$sys->kernel_version;
	$LIBC=$sys->libc_version;
	$temp=$sys->GetCpuTemp();
	$users=new usersMenus();
	$os=new os_system();
	$arraycpu=$os->cpu_info();
	$cpuspeed=round(($arraycpu["cpuspeed"]/1000*100)/100,2); 
	$host=$users->hostname;
	$publicip=@file_get_contents("ressources/logs/web/myIP.conf");

	$distri="<table style='width:100%;color:white;font-size:11px'>
				<tr>
					<td valign='top' style='font-size:12px'>
						<strong>{server}</strong>:&nbsp;$host<br><br>{public_ip}:&nbsp;<strong>$publicip</strong><br><strong> {$arraycpu["cpus"]} cpu(s):{$cpuspeed}GHz</strong>
					</td>
					<td valign='top' style='font-size:12px'>
						<strong>Artica&nbsp;$users->ARTICA_VERSION&nbsp;$distri&nbsp;kernel $kernel<br>libc $LIBC&nbsp;&nbsp;&Temp $temp&nbsp;C</strong>
					</td>
				</tr>
			</table>";
	
	$_SESSION["DISTRI"]=$distri;
}else{
	$distri=$_SESSION["DISTRI"];
}

$distri_logo="img/serv-mail-linux.png";
if(is_file("img/$users->LinuxDistriCode.png")){$distri_logo="img/$users->LinuxDistriCode.png";}
if(is_file("img/$users->LinuxDistriCode.gif")){$distri_logo="img/$users->LinuxDistriCode.gif";}

$artica=new artica_general();
	
	
	
	$html="
	<table style='width:100%;background-color:#005446'>
		<tr>
			<td style='background-color:#005447;margin:0px;padding:0px;border:0px'>
				<table style='width:100%;margin:0px;padding:0px;border:0px'>
				<tr>
					<td width=1%>
						<img src='$distri_logo'>
					</td>
					<td valign='top'>
							<table style='width:100%'>
								<tr>
									<td valign='top'><span style='color:white;font-size:18px;font-weight:bold'>{manage_your_server}</td>
								</tr>
								<tr>
								<td valign='top' style='padding-top:3px;border-top:1px dotted white;font-size:11px'>
									$distri
								</td>
								</tr>
							</table>
					</td>
				</tr>
				</table>
			 </td>
			</tr>
		<tr style='margin:0px;padding:0px;border:0px'>
			<td valign='top' style='background-color:#005446;margin:0px;padding:0px;border:0px'>
					$content
			</td>
		</tr>
	</table>
		<table style='width:100%;background-color:white'>
			<tr>
				<td width=1%>" . Field_checkbox('ConfigureYourserverStart',1,$artica->ArticaFirstWizard,"OnClick=\"javascript:ConfigureYourserver_Cancel();\"")."</td>
				<td align='left'>{disable_startup}</td>
			</tr>
		</table>	
	";
	$_SESSION[$key_cache]=$html;
	return $html;
	
	
}
Пример #14
0
function section_computer_header()
{
    if (GET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__)) {
        return null;
    }
    $hour = date('h');
    $key_cache = "CACHEINFOS_STATUSSEVERREDNDER{$hour}";
    $page = CurrentPageName();
    //if(isset($_SESSION[$key_cache])){return $_SESSION[$key_cache];}
    unset($_SESSION["DISTRI"]);
    include_once 'ressources/class.os.system.inc';
    include_once "ressources/class.os.system.tools.inc";
    $sock = new sockets();
    $datas = unserialize($sock->getFrameWork("services.php?dmicode=yes"));
    $img = "img/server-256.png";
    $foundChassis = false;
    if (is_array($datas)) {
        $proc_type = $datas["PROC_TYPE"];
        $MANUFACTURER = $datas["MANUFACTURER"];
        $PRODUCT = $datas["PRODUCT"];
        $CHASSIS = $datas["CHASSIS"];
        $md5Chassis = md5("{$datas["MANUFACTURER"]}{$datas["CHASSIS"]}{$datas["PRODUCT"]}");
        if (is_file("img/vendors/{$md5Chassis}.jpg")) {
            $img = "img/vendors/{$md5Chassis}.jpg";
            $foundChassis = true;
        }
        if (is_file("img/vendors/{$md5Chassis}.jpeg")) {
            $img = "img/vendors/{$md5Chassis}.jpeg";
            $foundChassis = true;
        }
        if (is_file("img/vendors/{$md5Chassis}.png")) {
            $img = "img/vendors/{$md5Chassis}.png";
            $foundChassis = true;
        }
    }
    if (!$foundChassis) {
        $chassis_serial = "<tr>\n\t\t\t\t\t<td valign='top' style='font-size:12px' class=legend>{serial}:</td>\n\t\t\t\t\t<td valign='top' style='font-size:12px'><strong>{$md5Chassis}</td>\n\t\t\t\t</tr>";
    }
    if (!isset($_SESSION["DISTRI"])) {
        $sys = new systeminfos();
        writelogs('Loading datas system for session', __FUNCTION__, __FILE__);
        $distri = $sys->ditribution_name;
        $kernel = $sys->kernel_version;
        $LIBC = $sys->libc_version;
        $temp = $sys->GetCpuTemp();
        $users = new usersMenus();
        $os = new os_system();
        $arraycpu = $os->cpu_info();
        $cpuspeed = round($arraycpu["cpuspeed"] / 1000 * 100 / 100, 2);
        $host = $users->hostname;
        $publicip = @file_get_contents("ressources/logs/web/myIP.conf");
        $distri_logo = "img/serv-mail-linux.png";
        if (is_file("img/{$users->LinuxDistriCode}.png")) {
            $distri_logo = "img/{$users->LinuxDistriCode}.png";
        }
        if (is_file("img/{$users->LinuxDistriCode}.gif")) {
            $distri_logo = "img/{$users->LinuxDistriCode}.gif";
        }
        if (preg_match("#Broken pipevmware#i", $MANUFACTURER)) {
            $MANUFACTURER = "VMWare";
        }
        if (preg_match("#Broken pipevmware#i", $PRODUCT)) {
            $PRODUCT = "VMWare";
        }
        if (preg_match("#Broken pipevmware#i", $CHASSIS)) {
            $CHASSIS = "VMWare";
        }
        if ($MANUFACTURER != null) {
            $tr[] = $MANUFACTURER;
        }
        if ($PRODUCT != null) {
            $tr[] = $PRODUCT;
        }
        if ($CHASSIS != null) {
            $tr[] = $CHASSIS;
        }
        if (count($tr) > 0) {
            $LINEMANU = @implode(", ", $tr);
        }
        if ($publicip == null) {
            $publicip = "x.x.x.x";
        }
        $distri = "\n\t<center>\n\t\n\t\n\t<table style='width:99%;color:black;' class=form>\n\t\t<tr>\n\t\t\t<td colspan=2 align=center><img src='{$img}'></td>\n\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' style='font-size:12px' class=legend nowrap>{server}:</td>\n\t\t\t\t\t<td valign='top' style='font-size:12px'><strong id='squidcklinks-host-infos'></strong>\n\t\t\t\t\t\t<div><i style='font-weight:bold;font-size:11px'>{$LINEMANU}</i></div></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' style='font-size:12px' class=legend nowrap>{public_ip}:</td>\n\t\t\t\t\t<td valign='top' style='font-size:12px'><a href=\"javascript:RefreshMyIP()\" style='font-size:12px;text-decoration:underline;font-weight:bold' id='RefreshMyIP-span'>{$publicip}</a></td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' style='font-size:12px' class=legend>{processors}:</td>\n\t\t\t\t\t<td valign='top' style='font-size:12px'><strong>{$arraycpu["cpus"]} cpu(s):{$cpuspeed}GHz<br>{$proc_type}</strong></td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' style='font-size:12px' class=legend>Artica:</td>\n\t\t\t\t\t<td valign='top' style='font-size:12px'><strong>{$users->ARTICA_VERSION}</strong></td>\n\t\t\t\t</tr>\t\t\t\t\t\t\t\n\t\t\t\t\t<td valign='top' style='font-size:12px'><img src='{$distri_logo}'></td>\n\t\t\t\t\t<td valign='top' style='font-size:12px'><strong>{$distri}<br>kernel {$kernel}\n\t\t\t\t\t<br>libc {$LIBC}<br>Temp {$temp}&nbsp;C</strong>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t{$chassis_serial}\n\t\t\t</table>\n</center>\n<script>\n\tUnlockPage();\n\tLoadAjaxTiny('squidcklinks-host-infos','{$page}?squidcklinks-host-infos=yes');\n\tfunction RefreshMyIP(){\n\t\tLoadAjaxTiny('RefreshMyIP-span','{$page}?RefreshMyIp=yes');\n\t}\n\t\n</script>\n\t\n\n\n";
        $tpl = new templates();
        $distri = $tpl->_ENGINE_parse_body($distri);
        $_SESSION["DISTRI"] = $distri;
    } else {
        $distri = $_SESSION["DISTRI"];
    }
    $html = "{$distri}";
    $_SESSION[$key_cache] = $html;
    SET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__, $html);
    echo $html;
}
Пример #15
0
if ($argv[1] == '--free') {
    FreeSync();
}
if ($argv[1] == '--freemem') {
    FreeMem();
}
if ($argv[1] == '--watchdog') {
    Watch();
}
include_once dirname(__FILE__) . '/framework/class.unix.inc';
if (!Build_pid_func(__FILE__, "MAIN")) {
    writelogs(basename(__FILE__) . ":Already executed.. aborting the process", basename(__FILE__), __FILE__, __LINE__);
    die;
}
include_once dirname(__FILE__) . "/ressources/class.os.system.tools.inc";
$os = new os_system();
$mem = $os->memory();
$swap_percent = $mem["swap"]["percent"];
$swap_used = $mem["swap"]["used"];
$ram_free = $mem["ram"]["free"];
$ram_total = $mem["ram"]["total"];
$operation_disponible = $ram_free - $swap_used;
$max = str_replace("&nbsp;", " ", FormatBytes(round($ram_total / 2)));
$swap_used = $mem["swap"]["used"];
$swap_used_mo = str_replace("&nbsp;", " ", FormatBytes($swap_used));
$ram_free_mo = FormatBytes($ram_free);
$log = "swap used: {$swap_percent}% ({$swap_used_mo}) , Max {$max} ; free memory={$ram_free_mo}, cache fore back={$operation_disponible}";
echo $log . "\n";
print_r($mem);
function events($text)
{
Пример #16
0
function format_popup()
{
    include_once "ressources/class.os.system.tools.inc";
    $array = ArrayUsbBYDev($_GET["format-index-popup"]);
    $od = new os_system();
    $table = $od->usb_parse_array($array);
    $format_table = array("ext2" => "ext2 (linux)", "ext3" => "ext3 (linux)", "vfat" => "fat32 (linux & Windows)");
    $field = Field_array_Hash($format_table, 'format_type', 'ext2');
    $form = "\n\t<table class=form>\n\t<tr>\n\t\t<td class=legend>{file_system}:</td>\n\t\t<td>{$field}</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'><input type='button' OnClick=\"javascript:LauchUsbFormat();\" value='{formatdevice}&nbsp;&raquo;'></td>\n\t</tr>\n\t</table>\n\t\n\t";
    $html = "<H1>{formatdevice} {$_GET["format-index-popup"]}</H1>\n\t<div id='formatdiv'>\n\t<p class=caption>{format_device_explain}</p>\n\t<form name='ffmformat'>\n\t<input type='hidden' value='{$_GET["format-index-popup"]}' id='dev' name='dev'>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td valign='top'>{$table}</td>\n\t\t<td valign='top'>{$form}</td>\n\t</tr>\n\t</table>\n\t</div>\n\t\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
function FLUX_HOUR($astimeout = false)
{
    $TimeFile = "/etc/artica-postfix/pids/exec.squid.interface-size.php.FLUX_HOUR.time";
    if ($GLOBALS["VERBOSE"]) {
        $astimeout = false;
    }
    if ($GLOBALS["FORCE"]) {
        $astimeout = false;
    }
    if ($astimeout) {
        $unix = new unix();
        if ($unix->file_time_min($TimeFile) < 5) {
            events("Aborting, require 5mn minimal");
            return;
        }
    }
    @unlink($TimeFile);
    @file_put_contents($TimeFile, time());
    $os = new os_system();
    $UPTIME = $os->uptime_int();
    build_progress("{uptime} {$UPTIME}", 15);
    @file_put_contents("{$GLOBALS["BASEDIR"]}/UPTIME", $UPTIME);
    CACHES_AVG();
    $now = strtotime("-24 hour");
    $MAIN = array();
    $xdata = array();
    $ydata = array();
    $MAIN = array();
    $xdata = array();
    $ydata = array();
    $influx = new influx();
    $sock = new sockets();
    echo "# # # # # # # # # # # # # # # # # # # # #\n";
    echo "# # # # # # # # FLUX_HOUR # # # # # # # #\n";
    echo "# # # # # # # # # # # # # # # # # # # # #\n";
    $q = new mysql_squid_builder();
    $q2 = new postgres_sql();
    if (!$q->TABLE_EXISTS("dashboard_size_day")) {
        if ($q2->TABLE_EXISTS("access_log")) {
            FLUX_HOUR_POSTGRES();
            return;
        }
        return;
    }
    if ($q->TABLE_EXISTS("dashboard_size_day")) {
        build_progress("{refresh_dashboard_values} FLUX HOUR", 16);
        $sql = "SELECT SUM(SIZE) as SIZE,TIME FROM dashboard_size_day GROUP BY TIME ORDER BY TIME ASC";
        echo "FLUX_HOUR:: MySQL ****************** {$sql} **********************\n";
        $results = $q->QUERY_SQL($sql);
        events("{$sql} -> " . mysql_num_rows($results) . " items");
        if (!$q->ok) {
            events($q->mysql_error);
        }
        while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
            $size = intval($ligne["SIZE"]) / 1024;
            $size = $size / 1024;
            $time = strtotime($ligne["TIME"]);
            $min = date("l H:i:00", $time);
            echo "FLUX_HOUR: {$min} = {$size}\n";
            $xdata[] = $min;
            $ydata[] = $size;
        }
        build_progress("{refresh_dashboard_values} FLUX HOUR " . count($xdata) . " items", 16);
        $MAIN["xdata"] = $xdata;
        $MAIN["ydata"] = $ydata;
        echo "# # # FLUX_HOUR:: " . count($xdata) . " ITEMS # # #\n";
        @file_put_contents("{$GLOBALS["BASEDIR"]}/FLUX_HOUR", serialize($MAIN));
        if (count($xdata) < 2) {
            @unlink("{$GLOBALS["BASEDIR"]}/FLUX_HOUR");
            FLUX_HOUR_POSTGRES();
        }
    }
    // -----------------------------------------------------------------------------------------------------
    if ($q->TABLE_EXISTS("dashboard_countwebsite_day")) {
        $sql = "SELECT FAMILYSITE, SUM(SIZE) as SIZE FROM dashboard_countwebsite_day GROUP BY FAMILYSITE ORDER BY SIZE DESC LIMIT 1";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        @unlink("{$GLOBALS["BASEDIR"]}/TOP_WEBSITE");
        if ($ligne["SIZE"] > 0) {
            @file_put_contents("{$GLOBALS["BASEDIR"]}/TOP_WEBSITE", serialize(array($ligne["SIZE"], $ligne["FAMILYSITE"])));
        }
    }
    // -----------------------------------------------------------------------------------------------------
    if ($q->TABLE_EXISTS("dashboard_user_day")) {
        $sql = "SELECT USER, SUM(SIZE) as SIZE FROM dashboard_user_day GROUP BY USER ORDER BY SIZE DESC LIMIT 1";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        events("TOP USER: {$ligne["SIZE"]} : {$ligne["USER"]}");
        @unlink("{$GLOBALS["BASEDIR"]}/TOP_USER");
        if ($ligne["SIZE"] > 0) {
            echo "TOP USER: saving {$GLOBALS["BASEDIR"]}/TOP_USER\n";
            @file_put_contents("{$GLOBALS["BASEDIR"]}/TOP_USER", serialize(array($ligne["SIZE"], $ligne["USER"])));
        }
    }
    // -----------------------------------------------------------------------------------------------------
    if ($q->TABLE_EXISTS("dashboard_blocked_day")) {
        build_progress("{refresh_dashboard_values} TOP_BLOCKED", 16);
        @unlink("{$GLOBALS["BASEDIR"]}/TOP_BLOCKED");
        $sql = "SELECT WEBSITE, SUM(RQS) as RQS FROM dashboard_blocked_day GROUP BY WEBSITE ORDER BY RQS DESC LIMIT 1";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        events("TOP_BLOCKED: {$ligne["RQS"]} : {$ligne["WEBSITE"]}");
        @unlink("{$GLOBALS["BASEDIR"]}/TOP_BLOCKED");
        if ($ligne["RQS"] > 0) {
            @file_put_contents("{$GLOBALS["BASEDIR"]}/TOP_BLOCKED", serialize(array($ligne["RQS"], $ligne["WEBSITE"])));
        }
    }
    // -----------------------------------------------------------------------------------------------------
    $now = InfluxQueryFromUTC(strtotime("-24 hour"));
    $MAIN = array();
    $xdata = array();
    $ydata = array();
    $influx = new influx();
    $sock = new sockets();
    $ipClass = new IP();
    $q = new mysql_squid_builder();
    @unlink("{$GLOBALS["BASEDIR"]}/MEMBERS_GRAPH");
    $q = new mysql_squid_builder();
    if ($q->TABLE_EXISTS("dashboard_countuser_day")) {
        build_progress("{refresh_dashboard_values}", 50);
        $sql = "SELECT COUNT(USER) AS TCOUNT,TIME FROM dashboard_user_day GROUP BY TIME ORDER BY TIME ASC";
        echo "MEMBERS_GRAPH:: ****************** {$sql} **********************\n";
        $results = $q->QUERY_SQL($sql);
        $CountDedashboard_countuser_day = mysql_num_rows($results);
        events("{$sql} -> {$CountDedashboard_countuser_day} items");
        if (!$q->ok) {
            events($q->mysql_error);
        }
        while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
            $xdata[] = $ligne["TIME"];
            $ydata[] = $ligne["TCOUNT"];
        }
        $MAIN["xdata"] = $xdata;
        $MAIN["ydata"] = $ydata;
        if (count($ydata) > 1) {
            @file_put_contents("{$GLOBALS["BASEDIR"]}/MEMBERS_GRAPH", serialize($MAIN));
        }
    }
    build_progress("{done} FLUX MEMBERS_GRAPH", 100);
    // -----------------------------------------------------------------------------------------------------
}
Пример #18
0
function section_computer_header(){
if(GET_CACHED(__FILE__,__FUNCTION__,__FUNCTION__)){return null;}
$hour=date('h');
$key_cache="CACHEINFOS_STATUSSEVERREDNDER$hour";
$page=CurrentPageName();
//if(isset($_SESSION[$key_cache])){return $_SESSION[$key_cache];}
unset($_SESSION["DISTRI"]);

include_once('ressources/class.os.system.inc');
include_once("ressources/class.os.system.tools.inc");
$sock=new sockets();
$datas=unserialize($sock->getFrameWork("services.php?dmicode=yes"));
$img="img/server-256.png";
$foundChassis=false;
if(is_array($datas)){
	$proc_type=$datas["PROC_TYPE"];
	$MANUFACTURER =$datas["MANUFACTURER"];
	$PRODUCT=$datas["PRODUCT"];
	$CHASSIS=$datas["CHASSIS"];
	$md5Chassis=md5("{$datas["MANUFACTURER"]}{$datas["CHASSIS"]}{$datas["PRODUCT"]}");
	if(is_file("img/vendors/$md5Chassis.jpg")){$img="img/vendors/$md5Chassis.jpg";$foundChassis=true;}
	if(is_file("img/vendors/$md5Chassis.jpeg")){$img="img/vendors/$md5Chassis.jpeg";$foundChassis=true;}
	if(is_file("img/vendors/$md5Chassis.png")){$img="img/vendors/$md5Chassis.png";$foundChassis=true;}
	
}

if(!$foundChassis){
	$chassis_serial="<tr>
					<td valign='top' style='font-size:12px' class=legend>{serial}:</td>
					<td valign='top' style='font-size:12px'><strong>$md5Chassis</td>
				</tr>";
}

if(!isset($_SESSION["DISTRI"])){
	$sys=new systeminfos();
	writelogs('Loading datas system for session',__FUNCTION__,__FILE__);
	$distri=$sys->ditribution_name;
	$kernel=$sys->kernel_version;
	$LIBC=$sys->libc_version;
	$temp=$sys->GetCpuTemp();
	$users=new usersMenus();
	$os=new os_system();
	$arraycpu=$os->cpu_info();
	$cpuspeed=round(($arraycpu["cpuspeed"]/1000*100)/100,2); 
	$host=$users->hostname;
	$publicip=@file_get_contents("ressources/logs/web/myIP.conf");
$distri_logo="img/serv-mail-linux.png";
if(is_file("img/$users->LinuxDistriCode.png")){$distri_logo="img/$users->LinuxDistriCode.png";}
if(is_file("img/$users->LinuxDistriCode.gif")){$distri_logo="img/$users->LinuxDistriCode.gif";}

if(preg_match("#Broken pipevmware#i", $MANUFACTURER)){$MANUFACTURER="VMWare";}
if(preg_match("#Broken pipevmware#i", $PRODUCT)){$PRODUCT="VMWare";}
if(preg_match("#Broken pipevmware#i", $CHASSIS)){$CHASSIS="VMWare";}



	$distri="
	<center>
	
	
	<table style='width:99%;color:black;' class=form>
		<tr>
			<td colspan=2 align=center><img src='$img'></td>
		</tr>
				<tr>
					<td valign='top' style='font-size:12px' class=legend>{server}:</td>
					<td valign='top' style='font-size:12px'><strong id='squidcklinks-host-infos'></strong><strong>$MANUFACTURER, $PRODUCT, $CHASSIS</td>
				</tr>
				<tr>
					<td valign='top' style='font-size:12px' class=legend>{public_ip}:</td>
					<td valign='top' style='font-size:12px'><strong>$publicip</strong></td>
				</tr>				
				<tr>
					<td valign='top' style='font-size:12px' class=legend>{processors}:</td>
					<td valign='top' style='font-size:12px'><strong>{$arraycpu["cpus"]} cpu(s):{$cpuspeed}GHz<br>$proc_type</strong></td>
				</tr>				
				<tr>
					<td valign='top' style='font-size:12px' class=legend>Artica:</td>
					<td valign='top' style='font-size:12px'><strong>$users->ARTICA_VERSION</strong></td>
				</tr>							
					<td valign='top' style='font-size:12px'><img src='$distri_logo'></td>
					<td valign='top' style='font-size:12px'><strong>$distri<br>kernel $kernel
					<br>libc $LIBC<br>Temp $temp&nbsp;C</strong>
					</td>
				</tr>
				$chassis_serial
			</table>
</center>
<script>
	LoadAjaxTiny('squidcklinks-host-infos','$page?squidcklinks-host-infos=yes');
</script>
	


";
	$tpl=new templates();
	$distri=$tpl->_ENGINE_parse_body($distri);
	$_SESSION["DISTRI"]=$distri;}else{$distri=$_SESSION["DISTRI"];}
	$html="$distri";
	$_SESSION[$key_cache]=$html;
	SET_CACHED(__FILE__,__FUNCTION__,__FUNCTION__,$html);
	echo $html;
}
Пример #19
0
function status_computer()
{
    include_once "ressources/class.os.system.tools.inc";
    status_mysql();
    $os = new os_system();
    $html = RoundedLightGrey($os->html_Memory_usage()) . "<br>";
    echo $html;
}
Пример #20
0
function main_select_disk()
{
    $disk = "/dev/{$_GET["disk"]}";
    $regex_pattern = "#\\/dev\\/{$_GET["disk"]}#";
    $sock = new sockets();
    $tpl = new templates();
    $sock->getFrameWork("cmd.php?usb-scan-write=yes");
    if (!file_exists('ressources/usb.scan.inc')) {
        return $tpl->_ENGINE_parse_body("<H1>{error_no_socks}</H1>");
    }
    include_once "ressources/usb.scan.inc";
    include_once "ressources/class.os.system.tools.inc";
    //64-usb-disk-add.png
    //found the right usb device
    while (list($num, $val) = each($_GLOBAL["usb_list"])) {
        if (preg_match($regex_pattern, $val["PATH"])) {
            $uiid = $num;
            $main_array = $val;
            break;
        }
    }
    $os = new os_system();
    $infos = $os->usb_parse_array($main_array);
    $img = RoundedLightWhite("<center>" . imgtootltip("64-usb-disk-add.png", '{add}', "disk_add('{$uiid}')") . "</center>");
    $text = "{add_has_backup}";
    $html = "\n\t<input type='hidden' id='disk_add_caption' value='{disk_add_caption}'>\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' width=1%>{$img}<br><center><strong>{$text}</strong></center></td>\n\t<td valign='top' width=99%>{$infos}</td>\n\t</tr>\n\t</table>\n\t\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #21
0
function loadmem()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "/pids/" . __FUNCTION__ . ".pid";
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        writelogs("Already process {$pid} exists", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    @file_put_contents($pidfile, getmypid());
    include_once "ressources/class.os.system.tools.inc";
    $unix = new unix();
    $timefile = "/etc/artica-postfix/croned.1/" . basename(__FILE__) . __FUNCTION__;
    if (file_time_min($timefile) < 15) {
        return null;
    }
    @unlink($timefile);
    @file_put_contents($timefile, time());
    $sys = new os_system();
    $mem = $sys->realMemory();
    $pourc = $mem["ram"]["percent"];
    $ram_used = $mem["ram"]["used"];
    $ram_total = $mem["ram"]["total"];
    $datas = loadavg_table();
    if ($GLOBALS["VERBOSE"]) {
        echo strlen($datas) . " bytes body text\n";
    }
    $unix->send_email_events("System Memory {$pourc}% used exceed rule", $datas, "system");
    checkProcess1();
}
Пример #22
0
function section_computer_header()
{
    $hour = date('h');
    $key_cache = "CACHEINFOS_STATUSSEVERREDNDER{$hour}";
    //if(isset($_SESSION[$key_cache])){return $_SESSION[$key_cache];}
    unset($_SESSION["DISTRI"]);
    include_once 'ressources/class.os.system.inc';
    include_once "ressources/class.os.system.tools.inc";
    $sock = new sockets();
    $datas = unserialize($sock->getFrameWork("services.php?dmicode=yes"));
    $img = "img/server-256.png";
    $foundChassis = false;
    if (is_array($datas)) {
        $proc_type = $datas["PROC_TYPE"];
        $MANUFACTURER = $datas["MANUFACTURER"];
        $PRODUCT = $datas["PRODUCT"];
        $CHASSIS = $datas["CHASSIS"];
        $md5Chassis = md5("{$datas["MANUFACTURER"]}{$datas["CHASSIS"]}{$datas["PRODUCT"]}");
        if (is_file("img/vendors/{$md5Chassis}.jpg")) {
            $img = "img/vendors/{$md5Chassis}.jpg";
            $foundChassis = true;
        }
        if (is_file("img/vendors/{$md5Chassis}.jpeg")) {
            $img = "img/vendors/{$md5Chassis}.jpeg";
            $foundChassis = true;
        }
        if (is_file("img/vendors/{$md5Chassis}.png")) {
            $img = "img/vendors/{$md5Chassis}.png";
            $foundChassis = true;
        }
    }
    if (!$foundChassis) {
        $chassis_serial = "<tr>\n\t\t\t\t\t<td valign='top' style='font-size:12px' class=legend>{serial}:</td>\n\t\t\t\t\t<td valign='top' style='font-size:12px'><strong>{$md5Chassis}</td>\n\t\t\t\t</tr>";
    }
    if (!isset($_SESSION["DISTRI"])) {
        $sys = new systeminfos();
        writelogs('Loading datas system for session', __FUNCTION__, __FILE__);
        $distri = $sys->ditribution_name;
        $kernel = $sys->kernel_version;
        $LIBC = $sys->libc_version;
        $temp = $sys->GetCpuTemp();
        $users = new usersMenus();
        $os = new os_system();
        $arraycpu = $os->cpu_info();
        $cpuspeed = round($arraycpu["cpuspeed"] / 1000 * 100 / 100, 2);
        $host = $users->hostname;
        $publicip = @file_get_contents("ressources/logs/web/myIP.conf");
        $distri_logo = "img/serv-mail-linux.png";
        if (is_file("img/{$users->LinuxDistriCode}.png")) {
            $distri_logo = "img/{$users->LinuxDistriCode}.png";
        }
        if (is_file("img/{$users->LinuxDistriCode}.gif")) {
            $distri_logo = "img/{$users->LinuxDistriCode}.gif";
        }
        $distri = "\n\t<center>\n\t\n\t\n\t<table style='width:100%;color:black;' class=form>\n\t\t<tr>\n\t\t\t<td colspan=2 align=center><img src='{$img}'></td>\n\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' style='font-size:12px' class=legend>{server}:</td>\n\t\t\t\t\t<td valign='top' style='font-size:12px'><strong>{$host}</strong><br><strong>{$MANUFACTURER} {$PRODUCT} {$CHASSIS}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' style='font-size:12px' class=legend>{public_ip}:</td>\n\t\t\t\t\t<td valign='top' style='font-size:12px'><strong>{$publicip}</strong></td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' style='font-size:12px' class=legend>{processors}:</td>\n\t\t\t\t\t<td valign='top' style='font-size:12px'><strong>{$arraycpu["cpus"]} cpu(s):{$cpuspeed}GHz<br>{$proc_type}</strong></td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' style='font-size:12px' class=legend>Artica:</td>\n\t\t\t\t\t<td valign='top' style='font-size:12px'><strong>{$users->ARTICA_VERSION}</strong></td>\n\t\t\t\t</tr>\t\t\t\t\t\t\t\n\t\t\t\t\t<td valign='top' style='font-size:12px'><img src='{$distri_logo}'></td>\n\t\t\t\t\t<td valign='top' style='font-size:12px'><strong>{$distri}<br>kernel {$kernel}\n\t\t\t\t\t<br>libc {$LIBC}<br>Temp {$temp}&nbsp;C</strong>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t{$chassis_serial}\n\t\t\t</table>\n</center>";
        $_SESSION["DISTRI"] = $distri;
    } else {
        $distri = $_SESSION["DISTRI"];
    }
    $html = "{$distri}";
    $_SESSION[$key_cache] = $html;
    return $html;
}
Пример #23
0
function main_status()
{
    include_once "ressources/class.os.system.tools.inc";
    $os = new os_system();
    $arraycpu = $os->cpu_info();
    $cpuspeed = round($arraycpu["cpuspeed"] / 1000 * 100) / 100;
    $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td width=1% valign='top'><img src='img/64-computer.png'></td>\n\t<td valign='top'>\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td width=1% nowrap align='right' valign='top'>cpu:</td>\n\t\t\t<td width=99%><strong>{$arraycpu["model"]}</strong></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td width=1% nowrap align='right' valign='top'>Cache:</td>\n\t\t\t<td width=99%><strong>{$arraycpu["cache"]}</strong></td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td width=1% nowrap align='right'>{cpu_number}:</td>\n\t\t\t<td width=99%>{$arraycpu["cpus"]}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td width=1% nowrap align='right'>{status}:</td>\n\t\t\t<td width=99%>{$cpuspeed}GHz</td>\n\t\t</tr>\t\t\t\t\t\n\t</table>\n\t</td>\n\t</tr>\n\t</table>\n\t";
    $mem = $os->html_Memory_usage();
    $mem = RoundedLightGreen($mem);
    $html = RoundedLightGreen($html) . "<br>{$mem}";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #24
0
function getmem(){
		include_once("ressources/class.os.system.tools.inc");
		$os=new os_system();
		$GLOBALS["MEMORY_INSTALLED"]=$os->memory();
		$os=null;
		print_r($GLOBALS["MEMORY_INSTALLED"]);
	
}
Пример #25
0
function SendStatus()
{
    emergency(true);
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $sock = new sockets();
    $EnableSargGenerator = $sock->GET_INFO("EnableSargGenerator");
    if (TestsCron($pidfile)) {
        $ArticaMetaPingEnable = $sock->GET_INFO("ArticaMetaPingEnable");
        events("SendPing={$ArticaMetaPingEnable}", __FUNCTION__, __FILE__, __LINE__);
        if ($ArticaMetaPingEnable == 1) {
            SendPing();
        }
        return true;
    }
    $ArticaMetaEnabled = $sock->GET_INFO("ArticaMetaEnabled");
    if ($ArticaMetaEnabled != 1) {
        return;
    }
    $t1 = time();
    if (!is_file("/usr/share/artica-postfix/ressources/logs/global.status.ini")) {
        events("Unable to stat /usr/share/artica-postfix/ressources/logs/global.status.ini", __FUNCTION__, __FILE__, __LINE__);
        return null;
    }
    $unix = new unix();
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $ptime = $unix->PROCESS_TTL($pid);
        if ($ptime > $GLOBALS["MAXTTL"]) {
            events("killing process {$pid} ttl:{$ptime} minutes", __FUNCTION__, __FILE__, __LINE__);
            unix_system_kill_force($pid);
        } else {
            events("Already executed, process {$pid}", __FUNCTION__, __FILE__, __LINE__);
            die;
        }
    }
    events("Running pid " . getmypid(), __FUNCTION__, __FILE__, __LINE__);
    @file_put_contents($pidfile, getmypid());
    CheckNetwork();
    $http = new httpget();
    $meta = new artica_meta();
    $filecache = "/etc/artica-postfix/artica-meta-files.cache";
    events("My uuid=\"{$meta->uuid}\"", __FUNCTION__, __FILE__, __LINE__);
    $memCache = "/usr/share/artica-postfix/ressources/logs/status.memory.hash";
    $cpu_graphs = "/opt/artica/share/www/system/rrd/01cpu-1day.png";
    $server_status = "/usr/share/artica-postfix/ressources/logs/status.right.1.html";
    $squid_realtime = "/etc/artica-postfix/squid-realtime.cache";
    $datasToSend = base64_encode(serialize($meta->GLOBAL_ARRAY));
    $ini = new Bs_IniHandler();
    $ini->loadFile("/usr/share/artica-postfix/ressources/logs/global.status.ini");
    $ArrayFileCache = unserialize(@file_get_contents($filecache));
    if (is_file($memCache)) {
        $MEM_CACHE = base64_encode(@file_get_contents($memCache));
    } else {
        include_once "ressources/class.os.system.tools.inc";
        $os = new os_system();
        $os->html_Memory_usage();
        $MEM_CACHE = base64_encode(serialize($os->meta_array));
    }
    if (is_file($cpu_graphs)) {
        if ($ArrayFileCache["STATS_DAY"] != filemtime($cpu_graphs)) {
            $http->uploads["STATS_DAY"] = $cpu_graphs;
            $ArrayFileCache["STATS_DAY"] = filemtime($cpu_graphs);
            @file_put_contents($filecache, serialize($ArrayFileCache));
        }
    }
    if (is_file($server_status)) {
        if ($ArrayFileCache["SERVER_STATUS"] != filemtime($server_status)) {
            $http->uploads["SERVER_STATUS"] = $server_status;
            $ArrayFileCache["SERVER_STATUS"] = filemtime($server_status);
            @file_put_contents($filecache, serialize($ArrayFileCache));
        }
    }
    if (is_file($squid_realtime)) {
        if ($ArrayFileCache["SQUID_REALTIME"] != filemtime($squid_realtime)) {
            $http->uploads["SQUID_REALTIME"] = $squid_realtime;
            $ArrayFileCache["SQUID_REALTIME"] = filemtime($squid_realtime);
            @file_put_contents($filecache, serialize($ArrayFileCache));
        }
    }
    if ($EnableSargGenerator == 1) {
        $push_sarg = false;
        $sock = new sockets();
        $SargOutputDir = $sock->GET_INFO("SargOutputDir");
        if ($SargOutputDir == null) {
            $SargOutputDir = "/var/www/html/squid-reports";
        }
        if (is_file("{$SargOutputDir}/index.html")) {
            if (!is_file("/etc/artica-postfix/sarg.tgz")) {
                shell_exec("cd {$SargOutputDir} && tar -cjf /etc/artica-postfix/sarg.tgz ./*");
                $push_sarg = true;
            } else {
                if ($ArrayFileCache["SQUID_SARG"] != filemtime("{$SargOutputDir}/index.html")) {
                    @unlink("/etc/artica-postfix/sarg.tgz");
                    shell_exec("cd {$SargOutputDir} && tar -cjf /etc/artica-postfix/sarg.tgz ./*");
                    $push_sarg = true;
                }
            }
            if ($push_sarg) {
                $http->uploads["SQUID_SARG"] = "/etc/artica-postfix/sarg.tgz";
            }
        }
    }
    $users = new usersMenus();
    $status = base64_encode(serialize($ini->_params));
    $pasmoinsaux = pasmoinsaux();
    if ($users->VMWARE_HOST) {
        $VMWARE_HOST = 1;
    } else {
        $VMWARE_HOST = 0;
    }
    shell_exec(LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.dmidecode.php");
    $dmidecode = base64_encode(@file_get_contents("/etc/artica-postfix/dmidecode.cache"));
    //SQUID
    if ($users->SQUID_INSTALLED) {
        $sock = new sockets();
        $SQUIDEnable = $sock->GET_INFO("SQUIDEnable");
        if (!is_numeric($SQUIDEnable)) {
            $SQUIDEnable = 1;
        }
        if ($SQUIDEnable == 1) {
            $SQUID_CACHES = base64_encode(serialize($unix->squid_get_cache_infos()));
        }
        if (is_array($SQUID_CACHES)) {
            $squid = new squidbee();
            $cacheconf = $squid->cache_list;
            $cacheconf[$squid->CACHE_PATH]["cache_type"] = $squid->CACHE_TYPE;
            $cacheconf[$squid->CACHE_PATH]["cache_size"] = $squid->CACHE_SIZE;
            $cacheconf[$squid->CACHE_PATH]["cache_dir_level1"] = 16;
            $cacheconf[$squid->CACHE_PATH]["cache_dir_level2"] = 256;
            events("Caches: " . count($cacheconf), __FILE__, __LINE__);
            $SQUID_CACHES_CONFIG = base64_encode(serialize($cacheconf));
        }
    }
    if ($users->SAMBA_INSTALLED) {
        _CheckSambaConfig();
    }
    if ($users->ZARAFA_INSTALLED) {
        if (is_file("/etc/artica-postfix/settings/Daemons/ZarafaLicenseInfos")) {
            $ZARAFA_LICENSE = @file_get_contents("/etc/artica-postfix/settings/Daemons/ZarafaLicenseInfos");
        } else {
            $ZARAFA_LICENSE = "Free edition";
        }
    }
    if (is_file("/etc/artica-postfix/zarafa-export.db")) {
        $ZARAFA_DB = @file_get_contents("/etc/artica-postfix/zarafa-export.db");
    }
    $body = $http->send("{$meta->ArticaMetaHostname}/lic.status.server.php", "post", array("DATAS" => $datasToSend, "STATUS" => $status, "MEMORIES" => $MEM_CACHE, "VERSION" => $users->ARTICA_VERSION, "DISTRI" => $users->LinuxDistriCode, "UPTIME" => getUptime(), "DISTRINAME" => $users->LinuxDistriFullName, "MAIN_PRODUCTS" => base64_encode(serialize(array("ZARAFA" => $users->ZARAFA_INSTALLED, "POSTFIX" => $users->POSTFIX_INSTALLED, "SQUID" => $users->SQUID_INSTALLED, "SAMBA" => $users->SAMBA_INSTALLED, "CYRUS" => $users->cyrus_imapd_installed, "OPENVPN" => $users->OPENVPN_INSTALLED))), "PROCESSES" => base64_encode($pasmoinsaux), "TOP_PROCESSES" => top10cpumem(), "NETS" => Networks(), "VMWARE_HOST" => $VMWARE_HOST, "SETTINGS_INC" => base64_encode(serialize(settings_inc())), "LOCAL_VERSIONS" => LocalVersions(), "VBOXGUESTS" => VirtualBoxList(), "APTCHECK" => APTCHECK(), "DMIDECODE" => $dmidecode, "SQUID_CACHES" => $SQUID_CACHES, "SQUID_CACHES_CONFIG" => $SQUID_CACHES_CONFIG, "OPENPORTS" => OpenPorts($meta->serial, $meta->uuid), "OPENVPN_CLIENTS_STATUS" => @file_get_contents("/usr/share/artica-postfix/ressources/logs/openvpn-clients.status"), "ZARAFA_DB" => $ZARAFA_DB, "ZARAFA_LICENSE" => $ZARAFA_LICENSE));
    $EXEC_NICE = EXEC_NICE();
    if (is_file("/usr/bin/nohup")) {
        $nohup = "/usr/bin/nohup ";
    }
    if (preg_match("#NOTIFY_DISCONNECT#is", $body)) {
        events("NOTIFY_DISCONNECT detected -> unregister_server()", __FUNCTION__, __FILE__, __LINE__);
        unregister_server();
        return;
    }
    if (preg_match("#NOTIFY_EXPORT_USERS#is", $body)) {
        events("NOTIFY_EXPORT_USERS -> {$nohup}{$EXEC_NICE}exec.artica.meta.users.php --export-all", __FUNCTION__, __FILE__, __LINE__);
        shell_exec($nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all >/dev/null 2>&1 &");
    }
    if (preg_match("#NOTIFY_EXPORT_DOMAINS#is", $body)) {
        events("NOTIFY_EXPORT_DOMAINS -> {$nohup}{$EXEC_NICE}exec.artica.meta.users.php --export-all-domains", __FUNCTION__, __FILE__, __LINE__);
        shell_exec($nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-domains >/dev/null 2>&1 &");
    }
    if (preg_match("#NOTIFY_EXPORT_OU#is", $body)) {
        events("NOTIFY_EXPORT_OU -> {$nohup}{$EXEC_NICE}exec.artica.meta.users.php --export-all-ou", __FUNCTION__, __FILE__, __LINE__);
        shell_exec($nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-ou >/dev/null 2>&1 &");
    }
    if (preg_match("#NOTIFY_EXPORT_GROUPS#is", $body)) {
        events("NOTIFY_EXPORT_GROUPS -> {$nohup}{$EXEC_NICE}exec.artica.meta.users.php --export-all-groups", __FUNCTION__, __FILE__, __LINE__);
        shell_exec($nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-groups >/dev/null 2>&1 &");
    }
    if (preg_match("#NOTIFY_EXPORT_SETTINGS#is", $body)) {
        $cmd = $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-settings >/dev/null 2>&1 &";
        events("NOTIFY_EXPORT_SETTINGS -> {$cmd}", __FUNCTION__, __FILE__, __LINE__);
        shell_exec($cmd);
    }
    if (preg_match("#NOTIFY_EXPORT_COMPUTERS#is", $body)) {
        $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-computers >/dev/null 2>&1 &";
        events("NOTIFY_EXPORT_SETTINGS -> {$cmd}", __FUNCTION__, __FILE__, __LINE__);
        shell_exec($cmd);
    }
    if (preg_match("#NOTIFY_EXPORT_DNS_ENTRIES#is", $body)) {
        $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-dns >/dev/null 2>&1 &";
        events("NOTIFY_EXPORT_DNS_ENTRIES -> {$cmd}", __FUNCTION__, __FILE__, __LINE__);
        shell_exec($cmd);
    }
    if (preg_match("#NOTIFY_EXPORT_GROUPWARES#is", $body)) {
        $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-groupwares >/dev/null 2>&1 &";
        events("NOTIFY_EXPORT_GROUPWARES -> {$cmd}", __FUNCTION__, __FILE__, __LINE__);
        shell_exec($cmd);
    }
    if (preg_match("#NOTIFY_EXPORT_FETCHMAIL_RULES#is", $body)) {
        $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-fetchmail-rules >/dev/null 2>&1 &";
        events("NOTIFY_EXPORT_FETCHMAIL_RULES -> {$cmd}", __FUNCTION__, __FILE__, __LINE__);
        shell_exec($cmd);
    }
    if (preg_match("#<TASKS>(.+?)</TASKS>#is", $body, $re)) {
        events("Save tasks to /etc/artica-postfix/artica-meta.tasks", __FUNCTION__, __FILE__, __LINE__);
        @file_put_contents("/etc/artica-postfix/artica-meta.tasks", $re[1]);
        $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.tasks.php >/dev/null 2>&1 &";
        events("TASKS ->{$cmd}", __FUNCTION__, __FILE__, __LINE__);
        shell_exec($cmd);
    } else {
        events("No tasks ordered for me...", __FUNCTION__, __FILE__, __LINE__);
        @unlink("/etc/artica-postfix/artica-meta.tasks");
    }
    if (preg_match("#<HOST_CONF>(.+?)</HOST_CONF>#is", $body, $re)) {
        ParseMyConf($re[1]);
    } else {
        events("No configuration for me...", __FUNCTION__, __FILE__, __LINE__);
    }
    shell_exec($nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --socks >/dev/null 2>&1 &");
    if (users_queue()) {
        $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --user-queue >/dev/null 2>&1 &";
        events("users settings queue is not empty -> {$cmd}", __FUNCTION__, __FILE__, __LINE__);
        shell_exec($cmd);
    }
    if (computer_queue()) {
        $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --computer-queue >/dev/null 2>&1 &";
        events("computer settings queue is not empty -> {$cmd}", __FUNCTION__, __FILE__, __LINE__);
        shell_exec($cmd);
    }
    if ($users->OPENVPN_INSTALLED) {
        $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-openvpn-logs >/dev/null 2>&1 &";
        events("OpenVpn is installed -> {$cmd}", __FUNCTION__, __FILE__, __LINE__);
        shell_exec($cmd);
    }
    $time_iptables = file_time_min("/etc/artica-postfix/artica.meta.iptables.time");
    if ($time_iptables > 180) {
        $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --iptables >/dev/null 2>&1 &";
        events("iptables -> {$cmd}", __FUNCTION__, __FILE__, __LINE__);
        shell_exec($cmd);
        $cmd = $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-settings >/dev/null 2>&1 &";
        events("{$cmd}", __FUNCTION__, __FILE__, __LINE__);
        @unlink("/etc/artica-postfix/artica.meta.iptables.time");
        @file_put_contents("/etc/artica-postfix/artica.meta.iptables.time", "#");
    }
    $t2 = time();
    $time_duration = distanceOfTimeInWords($t1, $t2);
    events("Send status to {$meta->ArticaMetaHostname} DONE ({$time_duration})", __FUNCTION__, __FILE__, __LINE__);
}
Пример #26
0
function status_computer()
{
    if (!$GLOBALS["AS_ROOT"]) {
        if (!$GLOBALS["VERBOSE"]) {
            if (is_file("/usr/share/artica-postfix/ressources/logs/web/admin.index.memory.html")) {
                $data = @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/admin.index.memory.html");
                if (strlen($data) > 45) {
                    $tpl = new templates();
                    echo $tpl->_ENGINE_parse_body($data);
                    return;
                }
            }
        }
    }
    $page = CurrentPageName();
    $sock = new sockets();
    $newfrontend = false;
    if (isset($_GET["newfrontend"])) {
        $newfrontend = true;
    }
    if (!$GLOBALS["VERBOSE"]) {
        if (!$GLOBALS["AS_ROOT"]) {
            if (GET_CACHED(__FILE__, __FUNCTION__, "time", false, 3)) {
                return;
            }
            if (internal_load() > 1.2) {
                if (GET_CACHED(__FILE__, __FUNCTION__)) {
                    return;
                }
            }
        }
    }
    if ($newfrontend) {
        $ajaxadd = "&newfrontend=yes";
    }
    include_once dirname(__FILE__) . "/ressources/class.os.system.tools.inc";
    $html = "<div id='admin-index-status-mysql'></div>\n\t<script>LoadAjaxTiny('admin-index-status-mysql','{$page}?admin-index-status-mysql=yes');</script>";
    $os = new os_system();
    if ($GLOBALS["VERBOSE"]) {
        echo "os->html_Memory_usage()<br>\n";
    }
    $html = $html . RoundedLightGrey($os->html_Memory_usage()) . "<br>\n\t<script>\n\tif(document.getElementById('left_status')){\n\t\tvar content=document.getElementById('left_status').innerHTML;\n\t\tif(content.length<5){\n\t\t\tLoadAjax('left_status','{$page}?status=left{$ajaxadd}',true);\n\t\t}\n\t}\n\t</script>\n\t\n\t\n\t";
    if ($GLOBALS["AS_ROOT"]) {
        include_once dirname(__FILE__) . '/framework/class.unix.inc';
        include_once dirname(__FILE__) . '/framework/frame.class.inc';
        @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/admin.index.memory.html", $html);
        return;
    }
    SET_CACHED(__FILE__, __FUNCTION__, $html);
    SET_CACHED(__FILE__, __FUNCTION__, "time", $html);
    echo $html;
}
Пример #27
0
function memory()
{
    include_once "ressources/class.os.system.tools.inc";
    $page = CurrentPageName();
    $os = new os_system();
    return $os->html_Memory_usage() . "<script>\n\t\tLoadAjax('system-events','artica.events.php?tri=yes&context=system&process=&without-tri=yes');\n\t\t\n\tfunction articaShowEvent(ID){\n\t\t YahooWin6('750','artica.events.php?ShowID='+ID,'EV::'+ID);\n\t}\n\t</script>\n\t";
}
    die;
}
if (!$_GET["FORCE"]) {
    $sock = new sockets();
    $PoolCoverPageSchedule = intval($sock->GET_INFO('PoolCoverPageSchedule'));
    if ($PoolCoverPageSchedule < 1) {
        $PoolCoverPageSchedule = 10;
    }
    $timef = file_get_time_min("/etc/artica-postfix/croned.2/" . md5(__FILE__));
    if ($timef < $PoolCoverPageSchedule) {
        die;
    }
}
@unlink("/etc/artica-postfix/croned.2/" . md5(__FILE__));
@file_put_contents("/etc/artica-postfix/croned.2/" . md5(__FILE__), date('Y-m-d H:i:s'));
$os = new os_system();
$_GET["CURRENT_MEMORY"] = RoundedLightGrey($os->html_Memory_usage()) . "<br>";
@file_put_contents('/usr/share/artica-postfix/ressources/logs/status.memory.html', $_GET["CURRENT_MEMORY"]);
@chmod('/usr/share/artica-postfix/ressources/logs/status.memory.html', 0755);
BuildingExecStatus("Build deamons status...", 10);
daemons_status();
events("daemons_status(); OK");
BuildingExecStatus("Current time...", 20);
get_current_time();
events(__LINE__ . ") get_current_time(); OK");
events("status_right -> START;");
BuildingExecStatus("Right pan...", 30);
status_right();
events("status_right(); OK");
BuildingExecStatus("Right Postfix pan...", 40);
$status = new status();
Пример #29
0
function home_c(){
	$t=$_GET["t"];
	$os=new os_system();
	$mem=$os->html_Memory_usage();
	$page=CurrentPageName();
	$tpl=new templates();	
	$html="
	<table style='width:98%' class=form id='system-task-manager'>
	<tr>
		<td>$mem</td>
	</tr>
	</table>
	<div style='width:100%;text-align:right'>". imgtootltip("refresh-32.png","{refresh}","RefreshTab('main_taskmanager_tabs')")."</div>
	<script>
	
		function Startc$t(){
			setTimeout('xStart$t()',11000);
		}
		
		function xStartc$t(){
			LoadAjax('$t-c','$page?home-c=yes&t=$t');
		
		}
	</script>
	";
	echo $tpl->_ENGINE_parse_body($html);
	
	
}
Пример #30
0
function loadmem(){
	include_once("ressources/class.os.system.tools.inc");
	$unix=new unix();
	$timefile="/etc/artica-postfix/croned.1/".basename(__FILE__).__FUNCTION__;
	if(file_time_min($timefile)<15){return null;}
	@unlink($timefile);
	@file_put_contents($timefile,"#");	
	$sys=new os_system();
	$mem=$sys->realMemory();
	
	$pourc=$mem["ram"]["percent"];
	$ram_used=$mem["ram"]["used"];
	$ram_total=$mem["ram"]["total"];	
	
	$datas=loadavg_table();
	if($GLOBALS["VERBOSE"]){echo strlen($datas)." bytes body text\n";}	
	$unix->send_email_events("System Memory $pourc% used exceed rule",$datas,"system");
	checkProcess1();
}