Example #1
0
        if (is_array($cpu)) {
            if ($options["CpuLoadFormat"] == "percent") {
                $cpulast = $cpu ? 100 - $cpu['idle'] : 0;
                $cpu_string[0] = "CPU :: " . color_cpu(round($cpulast, "0")) . "%";
            } else {
                $stats = @exec('uptime');
                if (!$stats) {
                    $stats = @shell_exec('uptime');
                }
                preg_match('/averages?: ([0-9\\.]+),[\\s]+([0-9\\.]+),[\\s]+([0-9\\.]+)/', $stats, $regs);
                $cpulast = $regs[1];
                $cpu_string[0] = "CPU :: " . color_cpu($cpulast);
            }
            $alert_sloadhigh = $options["limit_cpuload"] && $cpulast >= $options["ServerLoadAllowed"];
            $is_CPUerror = 0;
            $cpu_string[1] = '&#187;&nbsp;' . ($options["ServerLoadAllowed"] > 0 ? '(' . ($alert_sloadhigh ? '<blink>' : '') . color_cpu($cpulast) . ($alert_sloadhigh ? '</blink>' : '') . ' of <b>' . $options["ServerLoadAllowed"] . '</b>)' : '<span style="cursor:help;" title="' . $L->say['nolimit_cpu'] . '">~</span>');
        } else {
            $cpu_string[0] = $cpu;
        }
    }
    //--end linux cpuUsageNFO
}
//--end linux os
#if (is_callable("disk_free_space"))
$space_callable = 0;
if (function_exists('disk_free_space') && function_exists('disk_total_space')) {
    function ZahlenFormatieren($Wert)
    {
        if ($Wert > 1099511627776) {
            $Wert = number_format($Wert / 1099511627776, 2, ".", ",") . " TB";
        } elseif ($Wert > 1073741824) {
Example #2
0
<?php

if (!defined('RAPIDLEECH')) {
    require_once "../404.php";
    exit;
}
// General MAIN cpu load check
if ($server["is_windows"]) {
    $wmi = new COM("Winmgmts://");
    $cpus = $wmi->execquery("SELECT * FROM Win32_Processor");
    $cpulast = 0;
    $nocpus = 0;
    $loadcpu = '';
    foreach ($cpus as $cpu) {
        $cpulast += $cpu->loadpercentage;
        $loadcpu .= color_cpu($cpulast) . "%";
        $nocpus++;
    }
    $cpulast = $cpulast / $nocpus;
    if ($cpulast >= $options["ServerLoadAllowed"]) {
        $alert_sloadhigh = true;
    }
} elseif ($server["is_linux"]) {
    function sload_getStat($_statPath)
    {
        if (trim($_statPath) == '') {
            $_statPath = '/proc/stat';
        }
        ob_start();
        if ($options["passthru_allowed"]) {
            @passthru('cat ' . $_statPath);