示例#1
0
function html_hddtemp()
{
    global $XPath;
    global $text;
    global $sensor_program;
    $textdir = direction();
    $scale_factor = 2;
    $_text = "";
    $maxvalue = "+60";
    if ($XPath->match("/phpsysinfo/HDDTemp")) {
        for ($i = 1, $max = sizeof($XPath->getDataParts("/phpsysinfo/HDDTemp")); $i < $max; $i++) {
            if ($XPath->getData("/phpsysinfo/HDDTemp/Item[" . $i . "]/Value") != 0) {
                $_text .= "  <tr>\n";
                $_text .= "    <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/HDDTemp/Item[" . $i . "]/Model") . "</font></td>\n";
                $_text .= "    <td align=\"" . $textdir['left'] . "\" valign=\"top\" nowrap><font size=\"-1\">";
                $_text .= create_bargraph($XPath->getData("/phpsysinfo/HDDTemp/Item[" . $i . "]/Value"), $maxvalue, $scale_factor);
                $_text .= temperature($XPath->getData("/phpsysinfo/HDDTemp/Item[" . $i . "]/Value")) . "</font></td>\n";
                $_text .= "    <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . temperature($maxvalue) . "</font></td></tr>\n";
            }
        }
    }
    if (strlen($_text) > 0 && empty($sensor_program)) {
        $_text = "  <tr>\n" . "    <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['s_label'] . "</b></font></td>\n" . "    <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['s_value'] . "</b></font></td>\n" . "    <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['s_limit'] . "</b></font></td>\n" . "  </tr>" . $_text;
    }
    return $_text;
}
function html_filesystems()
{
    global $XPath;
    global $text;
    $scale_factor = 2;
    $_text = '<table width="100%" align="center">' . '<tr><td align="left" valign="top"><font size="-1"><b>' . $text['mount'] . '</b></font></td>' . '<td align="left" valign="top"><font size="-1"><b>' . $text['type'] . '</b></font></td>' . '<td align="left" valign="top"><font size="-1"><b>' . $text['partition'] . '</b></font></td>' . '<td align="left" valign="top"><font size="-1"><b>' . $text['percent'] . '</b></font></td>' . '<td align="right" valign="top"><font size="-1"><b>' . $text['free'] . '</b></font></td>' . '<td align="right" valign="top"><font size="-1"><b>' . $text['used'] . '</b></font></td>' . '<td align="right" valign="top"><font size="-1"><b>' . $text['size'] . '</b></font></td></tr>';
    for ($i = 1; $i < sizeof($XPath->getDataParts('/phpsysinfo/FileSystem')); $i++) {
        if ($XPath->match("/phpsysinfo/FileSystem/Mount[{$i}]/MountPoint")) {
            $sum['size'] += $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Size");
            $sum['used'] += $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Used");
            $sum['free'] += $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Free");
            $_text .= "\t<tr>\n";
            $_text .= "\t\t<td align=\"left\" valign=\"top\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/MountPoint") . "</font></td>\n";
            $_text .= "\t\t<td align=\"left\" valign=\"top\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Type") . "</font></td>\n";
            $_text .= "\t\t<td align=\"left\" valign=\"top\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Device") . "</font></td>\n";
            $_text .= "\t\t<td align=\"left\" valign=\"top\"><font size=\"-1\">";
            $_text .= create_bargraph($XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Percent"), $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Percent"), $scale_factor, $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Type"));
            $_text .= "&nbsp;" . $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Percent") . "</font></td>\n";
            $_text .= "\t\t<td align=\"right\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Free")) . "</font></td>\n";
            $_text .= "\t\t<td align=\"right\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Used")) . "</font></td>\n";
            $_text .= "\t\t<td align=\"right\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Size")) . "</font></td>\n";
            $_text .= "\t</tr>\n";
        }
    }
    $_text .= '<tr><td colspan="3" align="right" valign="top"><font size="-1"><i>' . $text['totals'] . ' :&nbsp;&nbsp;</i></font></td>';
    $_text .= "\t\t<td align=\"left\" valign=\"top\"><font size=\"-1\">";
    $sum_percent = round($sum['used'] * 100 / $sum['size']);
    $_text .= create_bargraph($sum_percent, $sum_percent, $scale_factor);
    $_text .= "&nbsp;" . $sum_percent . "%" . "</font></td>\n";
    $_text .= '<td align="right" valign="top"><font size="-1">' . format_bytesize($sum['free']) . '</font></td>' . '<td align="right" valign="top"><font size="-1">' . format_bytesize($sum['used']) . '</font></td>' . '<td align="right" valign="top"><font size="-1">' . format_bytesize($sum['size']) . '</font></td></tr>' . '</table>';
    return $_text;
}
示例#3
0
function html_memory()
{
    global $XPath;
    global $text;
    $scale_factor = 2;
    $ram .= create_bargraph($XPath->getData('/phpsysinfo/Memory/Percent'), $XPath->getData('/phpsysinfo/Memory/Percent'), $scale_factor);
    $ram .= '&nbsp;&nbsp;' . $XPath->getData('/phpsysinfo/Memory/Percent') . '% ';
    $swap .= create_bargraph($XPath->getData('/phpsysinfo/Swap/Percent'), $XPath->getData('/phpsysinfo/Swap/Percent'), $scale_factor);
    $swap .= '&nbsp;&nbsp;' . $XPath->getData('/phpsysinfo/Swap/Percent') . '% ';
    $_text = '<table border="0" width="90%" align="center">' . '<tr><td align="left" valign="top"><font size="-1"><b>' . $text['type'] . '</b></font></td>' . '<td align="left" valign="top"><font size="-1"><b>' . $text['percent'] . '</b></font></td>' . '<td align="right" valign="top"><font size="-1"><b>' . $text['free'] . '</b></font></td>' . '<td align="right" valign="top"><font size="-1"><b>' . $text['used'] . '</b></font></td>' . '<td align="right" valign="top"><font size="-1"><b>' . $text['size'] . '</b></font></td></tr>' . '<tr><td align="left" valign="top"><font size="-1">' . $text['phymem'] . '</font></td>' . '<td align="left" valign="top"><font size="-1">' . $ram . '</font></td>' . '<td align="right" valign="top"><font size="-1">' . format_bytesize($XPath->getData('/phpsysinfo/Memory/Free')) . '</font></td>' . '<td align="right" valign="top"><font size="-1">' . format_bytesize($XPath->getData('/phpsysinfo/Memory/Used')) . '</font></td>' . '<td align="right" valign="top"><font size="-1">' . format_bytesize($XPath->getData('/phpsysinfo/Memory/Total')) . '</font></td>' . '<tr><td align="left" valign="top"><font size="-1">' . $text['swap'] . '</font></td>' . '<td align="left" valign="top"><font size="-1">' . $swap . '</font></td>' . '<td align="right" valign="top"><font size="-1">' . format_bytesize($XPath->getData('/phpsysinfo/Swap/Free')) . '</font></td>' . '<td align="right" valign="top"><font size="-1">' . format_bytesize($XPath->getData('/phpsysinfo/Swap/Used')) . '</font></td>' . '<td align="right" valign="top"><font size="-1">' . format_bytesize($XPath->getData('/phpsysinfo/Swap/Total')) . '</font></td>' . '</table>';
    return $_text;
}
示例#4
0
function html_vitals()
{
    global $webpath;
    global $XPath;
    global $text;
    $textdir = direction();
    $scale_factor = 2;
    $strLoadbar = "";
    $uptime = "";
    if ($XPath->match("/phpsysinfo/Vitals/CPULoad")) {
        $strLoadbar = "<br>" . create_bargraph($XPath->getData("/phpsysinfo/Vitals/CPULoad"), 100, $scale_factor) . "&nbsp;" . $XPath->getData("/phpsysinfo/Vitals/CPULoad") . "%";
    }
    $_text = "<table border=\"0\" width=\"100%\" align=\"center\">\n" . "  <tr>\n" . "    <td valign=\"top\"><font size=\"-1\">" . $text['hostname'] . "</font></td>\n" . "    <td><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/Hostname") . "</font></td>\n" . "  </tr>\n" . "  <tr>\n" . "    <td valign=\"top\"><font size=\"-1\">" . $text['ip'] . "</font></td>\n" . "    <td><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/IPAddr") . "</font></td>\n" . "  </tr>\n" . "  <tr>\n" . "    <td valign=\"top\"><font size=\"-1\">" . $text['kversion'] . "</font></td>\n" . "    <td><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/Kernel") . "</font></td>\n" . "  </tr>\n" . "  <tr>\n" . "    <td valign=\"top\"><font size=\"-1\">" . $text['dversion'] . "</font></td>\n" . "    <td><img width=\"16\" height=\"16\" alt=\"\" src=\"" . $webpath . "images/" . $XPath->getData("/phpsysinfo/Vitals/Distroicon") . "\">&nbsp;<font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/Distro") . "</font></td>\n" . "  </tr>\n" . "  <tr>\n" . "    <td valign=\"top\"><font size=\"-1\">" . $text['uptime'] . "</font></td>\n" . "    <td><font size=\"-1\">" . uptime($XPath->getData("/phpsysinfo/Vitals/Uptime")) . "</font></td>\n" . "  </tr>\n" . "  <tr>\n" . "    <td valign=\"top\"><font size=\"-1\">" . $text['users'] . "</font></td>\n" . "    <td><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/Users") . "</font></td>\n" . "  </tr>\n" . "  <tr>\n" . "    <td valign=\"top\"><font size=\"-1\">" . $text['loadavg'] . "</font></td>\n" . "    <td><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/LoadAvg") . $strLoadbar . "</font></td>\n" . "  </tr>\n" . "</table>\n";
    return $_text;
}
示例#5
0
function html_vitals()
{
    global $webpath;
    global $XPath;
    global $text;
    $textdir = direction();
    $scale_factor = 2;
    $loadbar = "";
    $uptime = "";
    if ($XPath->match("/phpsysinfo/Vitals/CPULoad")) {
        $loadbar = "<br/>" . create_bargraph($XPath->getData("/phpsysinfo/Vitals/CPULoad"), 100, $scale_factor) . "&nbsp;" . $XPath->getData("/phpsysinfo/Vitals/CPULoad") . "%";
    }
    $_text = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\" width=\"100%\" " . "  <tr>\n" . "    <td width=20% align=right class=\"cellLabel small\" valign=\"top\"><font size=\"-1\">" . $text['hostname'] . "</font></td>\n" . "    <td width=80% class=\"cellText small\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/Hostname") . "</font></td>\n" . "  </tr>\n" . "  <tr>\n" . "    <td align=right class=\"cellLabel small\" valign=\"top\"><font size=\"-1\">" . $text['ip'] . "</font></td>\n" . "    <td class=\"cellText small\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/IPAddr") . "</font></td>\n" . "  </tr>\n" . "  <tr>\n" . "    <td align=right  class=\"cellLabel small\" valign=\"top\"><font size=\"-1\">" . $text['kversion'] . "</font></td>\n" . "    <td class=\"cellText small\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/Kernel") . "</font></td>\n" . "  </tr>\n" . "  <tr>\n" . "    <td align=right class=\"cellLabel small\" valign=\"top\"><font size=\"-1\">" . $text['dversion'] . "</font></td>\n" . "    <td class=\"cellText small\"><img width=\"16\" height=\"16\" alt=\"\" src=\"modules/System/images/" . $XPath->getData("/phpsysinfo/Vitals/Distroicon") . "\">&nbsp;<font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/Distro") . "</font></td>\n" . "  </tr>\n" . "  <tr>\n" . "    <td align=right  class=\"cellLabel small\" valign=\"top\"><font size=\"-1\">" . $text['uptime'] . "</font></td>\n" . "    <td class=\"cellText small\"><font size=\"-1\">" . uptime($XPath->getData('/phpsysinfo/Vitals/Uptime')) . "</font></td>\n" . "  </tr>\n" . "  <tr>\n" . "    <td align=right class=\"cellLabel small\" valign=\"top\"><font size=\"-1\">" . $text['users'] . "</font></td>\n" . "    <td class=\"cellText small\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/Users") . "</font></td>\n" . "  </tr>\n" . "  <tr>\n" . "    <td align=right class=\"cellLabel small\" valign=\"top\"><font size=\"-1\">" . $text['loadavg'] . "</font></td>\n" . "    <td class=\"cellText small\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/LoadAvg") . $loadbar . "</font></td>\n" . "  </tr>\n" . "</table>\n";
    return $_text;
}
示例#6
0
function html_mbtemp()
{
    global $text;
    global $XPath;
    $textdir = direction();
    $scale_factor = 2;
    $_text = "  <tr>\n" . "    <td><font size=\"-1\"><b>" . $text['s_label'] . "</b></font></td>\n" . "    <td><font size=\"-1\"><b>" . $text['s_value'] . "</b></font></td>\n" . "    <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['s_limit'] . "</b></font></td>\n" . "  </tr>\n";
    for ($i = 1, $max = sizeof($XPath->getDataParts("/phpsysinfo/MBinfo/Temperature")); $i < $max; $i++) {
        $_text .= "  <tr>\n" . "    <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Label") . "</font></td>\n" . "    <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">";
        if ($XPath->getData("/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Value") == 0) {
            $_text .= "Unknown - Not connected?";
        } else {
            $_text .= create_bargraph($XPath->getData("/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Value"), $XPath->getData("/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Limit"), $scale_factor);
        }
        $_text .= temperature($XPath->getData("/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Value")) . "</font></td>\n" . "    <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . temperature($XPath->getData("/phpsysinfo/MBinfo/Temperature/Item[" . $i . "]/Limit")) . "</font></td>\n" . "  </tr>\n";
    }
    return $_text;
}
示例#7
0
function html_memory()
{
    global $XPath;
    global $text;
    $textdir = direction();
    $scale_factor = 2;
    $ram = create_bargraph($XPath->getData("/phpsysinfo/Memory/Used"), $XPath->getData("/phpsysinfo/Memory/Total"), $scale_factor);
    $ram .= "&nbsp;&nbsp;" . $XPath->getData("/phpsysinfo/Memory/Percent") . "% ";
    $swap = create_bargraph($XPath->getData("/phpsysinfo/Swap/Used"), $XPath->getData("/phpsysinfo/Swap/Total"), $scale_factor);
    $swap .= "&nbsp;&nbsp;" . $XPath->getData("/phpsysinfo/Swap/Percent") . "% ";
    if ($XPath->match("/phpsysinfo/Memory/AppPercent")) {
        $app = create_bargraph($XPath->getData("/phpsysinfo/Memory/App"), $XPath->getData("/phpsysinfo/Memory/Total"), $scale_factor);
        $app .= "&nbsp;&nbsp;" . $XPath->getData("/phpsysinfo/Memory/AppPercent") . "% ";
    }
    if ($XPath->match("/phpsysinfo/Memory/BuffersPercent")) {
        $buffers = create_bargraph($XPath->getData("/phpsysinfo/Memory/Buffers"), $XPath->getData("/phpsysinfo/Memory/Total"), $scale_factor);
        $buffers .= "&nbsp;&nbsp;" . $XPath->getData("/phpsysinfo/Memory/BuffersPercent") . "% ";
    }
    if ($XPath->match("/phpsysinfo/Memory/CachedPercent")) {
        $cached = create_bargraph($XPath->getData("/phpsysinfo/Memory/Cached"), $XPath->getData("/phpsysinfo/Memory/Total"), $scale_factor);
        $cached .= "&nbsp;&nbsp;" . $XPath->getData("/phpsysinfo/Memory/CachedPercent") . "% ";
    }
    $_text = "<table cellspacing=0 cellpadding=5 border=\"0\" width=\"100%\" align=\"center\">\n" . "  <tr>\n" . "    <td class=\"colHeader small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['type'] . "</b></font></td>\n" . "    <td class=\"colHeader small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['percent'] . "</b></font></td>\n" . "    <td class=\"colHeader small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['free'] . "</b></font></td>\n" . "    <td class=\"colHeader small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['used'] . "</b></font></td>\n" . "    <td class=\"colHeader small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['size'] . "</b></font></td>\n" . "  </tr>\n" . "  <tr>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $text['phymem'] . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $ram . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/Memory/Free")) . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/Memory/Used")) . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/Memory/Total")) . "</font></td>\n" . "  </tr>\n";
    if (isset($app)) {
        $_text .= "  <tr>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">- " . $text['app'] . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $app . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">&nbsp;</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/Memory/App")) . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">&nbsp;</font></td>\n" . "  </tr>\n";
    }
    if (isset($buffers)) {
        $_text .= "  <tr>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">- " . $text['buffers'] . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $buffers . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">&nbsp;</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/Memory/Buffers")) . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">&nbsp;</font></td>\n" . "  </tr>\n";
    }
    if (isset($cached)) {
        $_text .= "  <tr>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">- " . $text['cached'] . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $cached . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">&nbsp;</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/Memory/Cached")) . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">&nbsp;</font></td>\n" . "  </tr>\n";
    }
    $_text .= "  <tr>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $text['swap'] . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $swap . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/Swap/Free")) . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/Swap/Used")) . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/Swap/Total")) . "</font></td>\n" . "  </tr>\n";
    if (($max = sizeof($XPath->getDataParts("/phpsysinfo/Swapdevices"))) > 2) {
        for ($i = 1; $i < $max; $i++) {
            $swapdev = create_bargraph($XPath->getData("/phpsysinfo/Swapdevices/Mount[{$i}]/Used"), $XPath->getData("/phpsysinfo/Swapdevices/Mount[{$i}]/Size"), $scale_factor);
            $swapdev .= "&nbsp;&nbsp;" . $XPath->getData("/phpsysinfo/Swapdevices/Mount[{$i}]/Percent") . "% ";
            $_text .= "  <tr>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"> - " . $XPath->getData("/phpsysinfo/Swapdevices/Mount[{$i}]/Device/Name") . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $swapdev . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/Swapdevices/Mount[{$i}]/Free")) . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/Swapdevices/Mount[{$i}]/Used")) . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/Swapdevices/Mount[{$i}]/Size")) . "</font></td>\n" . "  </tr>\n";
        }
    }
    $_text .= "</table>";
    return $_text;
}
<?php

//
// phpSysInfo - A PHP System Information Script
// http://phpsysinfo.sourceforge.net/
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
// $Id: table_memory.php,v 1.1.1.1 2001/06/17 17:56:53 lkneschke Exp $
$scale_factor = 2;
$mem = sys_meminfo();
$ram .= create_bargraph($mem['ram']['percent'], $mem['ram']['percent'], $scale_factor);
$ram .= '&nbsp;&nbsp;' . $mem['ram']['percent'] . '% ';
$swap .= create_bargraph($mem['swap']['percent'], $mem['swap']['percent'], $scale_factor);
$swap .= '&nbsp;&nbsp;' . $mem['swap']['percent'] . '% ';
$_text = '<table width="100%" align="center">' . '<tr><td align="left"><b><font size="-1">' . $text['type'] . '</font></b></td>' . '<td align="left"><b><font size="-1">' . $text['percent'] . '</font></b></td>' . '<td align="right"><b><font size="-1">' . $text['free'] . '</font></b></td>' . '<td align="right"><b><font size="-1">' . $text['used'] . '</font></b></td>' . '<td align="right"><b><font size="-1">' . $text['size'] . '</font></b></td></tr>' . '<tr><td align="left"><font size="-1">' . $text['phymem'] . '</font></td>' . '<td align="left"><font size="-1">' . $ram . '</font></td>' . '<td align="right"><font size="-1">' . format_bytesize($mem['ram']['t_free']) . '</font></td>' . '<td align="right"><font size="-1">' . format_bytesize($mem['ram']['t_used']) . '</font></td>' . '<td align="right"><font size="-1">' . format_bytesize($mem['ram']['total']) . '</font></td>' . '<tr><td align="left"><font size="-1">' . $text['swap'] . '</font></td>' . '<td align="left"><font size="-1">' . $swap . '</font></td>' . '<td align="right"><font size="-1">' . format_bytesize($mem['swap']['free']) . '</font></td>' . '<td align="right"><font size="-1">' . format_bytesize($mem['swap']['used']) . '</font></td>' . '<td align="right"><font size="-1">' . format_bytesize($mem['swap']['total']) . '</font></td>' . '</table>';
$tpl->set_var('memory', makebox($text['memusage'], $_text, '100%'));
示例#9
0
function html_filesystems()
{
    global $XPath;
    global $text;
    global $show_mount_point;
    $textdir = direction();
    $sum = array("size" => 0, "used" => 0, "free" => 0);
    $counted_devlist = array();
    $scale_factor = 2;
    $_text = "<table cellspacing=0 cellpadding=5 border=\"0\" width=\"100%\" align=\"center\">\n";
    $_text .= "  <tr>\n";
    if ($show_mount_point) {
        $_text .= "    <td class=\"colHeader small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['mount'] . "</b></font></td>\n";
    }
    $_text .= "    <td class=\"colHeader small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['type'] . "</b></font></td>\n" . "    <td class=\"colHeader small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['partition'] . "</b></font></td>\n" . "    <td class=\"colHeader small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['percent'] . "</b></font></td>\n" . "    <td class=\"colHeader small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['free'] . "</b></font></td>\n" . "    <td class=\"colHeader small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['used'] . "</b></font></td>\n" . "    <td class=\"colHeader small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['size'] . "</b></font></td>\n  </tr>\n";
    for ($i = 1, $max = sizeof($XPath->getDataParts('/phpsysinfo/FileSystem')); $i < $max; $i++) {
        if ($XPath->match("/phpsysinfo/FileSystem/Mount[{$i}]/MountPointID")) {
            if (!$XPath->match("/phpsysinfo/FileSystem/Mount[{$i}]/Options") || !stristr($XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Options"), "bind")) {
                if (!in_array($XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Device/Name"), $counted_devlist)) {
                    $sum['size'] += $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Size");
                    $sum['used'] += $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Used");
                    $sum['free'] += $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Free");
                    if (PHP_OS != "WINNT") {
                        $counted_devlist[] = $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Device/Name");
                    } else {
                        $counted_devlist[] = $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/MountPoint");
                    }
                }
            }
            $_text .= "  <tr>\n";
            if ($show_mount_point) {
                $_text .= "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/MountPoint") . "</font></td>\n";
            }
            $_text .= "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Type") . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Device/Name") . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . create_bargraph($XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Used"), $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Size"), $scale_factor, $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Type")) . "&nbsp;" . $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Percent") . "%";
            if ($XPath->match("/phpsysinfo/FileSystem/Mount[{$i}]/Inodes")) {
                $_text .= " (" . $XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Inodes") . "%)";
            }
            $_text .= "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Free")) . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Used")) . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . format_bytesize($XPath->getData("/phpsysinfo/FileSystem/Mount[{$i}]/Size")) . "</font></td>\n" . "  </tr>\n";
        }
    }
    $_text .= "  <tr>\n";
    if ($show_mount_point) {
        $_text .= "  <td class=\"listTableRow small\" colspan=\"3\" align=\"" . $textdir['right'] . "\" valign=\"top\"><b><font size=\"-1\"><i>" . $text['totals'] . " :&nbsp;&nbsp;</i></font></td>\n";
    } else {
        $_text .= "  <td class=\"listTableRow small\" colspan=\"2\" align=\"" . $textdir['right'] . "\" valign=\"top\"><b><font size=\"-1\"><i>" . $text['totals'] . " :&nbsp;&nbsp;</i></font></td>\n";
    }
    $_text .= "    <td class=\"listTableRow small\" align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\"><b>" . create_bargraph($sum['used'], $sum['size'], $scale_factor) . "&nbsp;" . round(100 / $sum['size'] * $sum['used']) . "%" . "</font></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><b><font size=\"-1\"><b>" . format_bytesize($sum['free']) . "</font></b></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><b><font size=\"-1\"><b>" . format_bytesize($sum['used']) . "</font></b></td>\n" . "    <td class=\"listTableRow small\" align=\"" . $textdir['right'] . "\" valign=\"top\"><b><font size=\"-1\"><b>" . format_bytesize($sum['size']) . "</font></b></td>\n  </tr>\n" . "</table>\n";
    return $_text;
}
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
// $Id: table_filesystems.php,v 1.1.1.1 2001/06/17 17:56:53 lkneschke Exp $
$scale_factor = 2;
$_text = '<table width="100%" align="center">' . '<tr><td align="left">' . $f_body_open . '<b>' . $text['mount'] . '</b>' . $f_body_close . '</td>' . '<td align="left">' . $f_body_open . '<b>' . $text['type'] . '</b>' . $f_body_close . '</td>' . '<td align="left">' . $f_body_open . '<b>' . $text['partition'] . '</b>' . $f_body_close . '</td>' . '<td align="left">' . $f_body_open . '<b>' . $text['percent'] . '</b>' . $f_body_close . '</td>' . '<td align="right">' . $f_body_open . '<b>' . $text['free'] . '</b>' . $f_body_close . '</td>' . '<td align="right">' . $f_body_open . '<b>' . $text['used'] . '</b>' . $f_body_close . '</td>' . '<td align="right">' . $f_body_open . '<b>' . $text['size'] . '</b>' . $f_body_close . '</td></tr>';
$fs = sys_fsinfo();
for ($i = 0; $i < sizeof($fs); $i++) {
    $sum['size'] += $fs[$i]['size'];
    $sum['used'] += $fs[$i]['used'];
    $sum['free'] += $fs[$i]['free'];
    $_text .= "\t<tr>\n";
    $_text .= "\t\t<td align=\"left\">{$f_body_open}" . $fs[$i]['mount'] . "{$f_body_close}</td>\n";
    $_text .= "\t\t<td align=\"left\">{$f_body_open}" . $fs[$i]['fstype'] . "{$f_body_close}</td>\n";
    $_text .= "\t\t<td align=\"left\">{$f_body_open}" . $fs[$i]['disk'] . "{$f_body_close}</td>\n";
    $_text .= "\t\t<td align=\"left\">{$f_body_open}";
    $_text .= create_bargraph($fs[$i]['percent'], $fs[$i]['percent'], $scale_factor);
    $_text .= "&nbsp;" . $fs[$i]['percent'] . "{$f_body_close}</td>\n";
    $_text .= "\t\t<td align=\"right\">{$f_body_open}" . format_bytesize($fs[$i]['free']) . "{$f_body_close}</td>\n";
    $_text .= "\t\t<td align=\"right\">{$f_body_open}" . format_bytesize($fs[$i]['used']) . "{$f_body_close}</td>\n";
    $_text .= "\t\t<td align=\"right\">{$f_body_open}" . format_bytesize($fs[$i]['size']) . "{$f_body_close}</td>\n";
    $_text .= "\t</tr>\n";
}
$_text .= '<tr><td colspan="3" align="right">' . $f_body_open . '<i>' . $text['totals'] . ' :&nbsp;&nbsp;</i>' . $f_body_close . '</td>';
$_text .= "\t\t<td align=\"left\">{$f_body_open}";
$sum_percent = round($sum['used'] * 100 / $sum['size']);
$_text .= create_bargraph($sum_percent, $sum_percent, $scale_factor);
$_text .= "&nbsp;" . $sum_percent . "%" . $f_body_close . "</td>\n";
$_text .= '<td align="right">' . $f_body_open . format_bytesize($sum['free']) . $f_body_close . '</td>' . '<td align="right">' . $f_body_open . format_bytesize($sum['used']) . $f_body_close . '</td>' . '<td align="right">' . $f_body_open . format_bytesize($sum['size']) . $f_body_close . '</td></tr>' . '</table>';
$tpl->set_var('filesystems', makebox($text['fs'], $_text, '100%'));
示例#11
0
function html_mbtemp()
{
    global $text;
    global $mbinfo;
    $textdir = direction();
    $data = array();
    $scale_factor = 2;
    $_text = "  <tr>\n" . "    <td><font size=\"-1\"><b>" . $text['s_label'] . "</b></font></td>\n" . "    <td><font size=\"-1\"><b>" . $text['s_value'] . "</b></font></td>\n" . "    <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\"><b>" . $text['s_limit'] . "</b></font></td>\n" . "  </tr>\n";
    $data = $mbinfo->temperature();
    for ($i = 0, $max = sizeof($data); $i < $max; $i++) {
        $_text .= "  <tr>\n" . "    <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">" . $data[$i]['label'] . "</font></td>\n" . "    <td align=\"" . $textdir['left'] . "\" valign=\"top\"><font size=\"-1\">";
        if ($data[$i]['value'] == 0) {
            $_text .= "Unknown - Not connected?";
        } else {
            $_text .= create_bargraph($data[$i]['value'], $data[$i]['limit'], $scale_factor);
        }
        $_text .= "&nbsp;" . round($data[$i]['value']) . "&nbsp;" . $text['degree_mark'] . "</font></td>\n" . "    <td align=\"" . $textdir['right'] . "\" valign=\"top\"><font size=\"-1\">" . $data[$i]['limit'] . "&nbsp;" . $text['degree_mark'] . "</font></td>\n" . "  </tr>\n";
    }
    return $_text;
}
示例#12
0
function html_mbtemp()
{
    global $text;
    global $mbinfo;
    $data = array();
    $scale_factor = 4;
    $_text = "\n<table width=\"100%\">\n";
    $_text .= '<tr><td><font size="-1"><b>' . $text['s_label'] . '</b></font></td><td><font size="-1"><b>' . $text['s_value'] . '</b></font></td><td align="right" valign="top"><font size="-1"><b>' . $text['s_limit'] . '</b></font></td><td align="right" valign="top"><font size="-1"><b>' . $text['hysteresis'] . '</b></font></td></tr>';
    $data = $mbinfo->temperature();
    for ($i = 0, $max = sizeof($data); $i < $max; $i++) {
        $_text .= "\t<tr>\n";
        $_text .= "\t\t<td align=\"left\" valign=\"top\"><font size=\"-1\">" . $data[$i]['label'] . "</font></td>\n";
        $_text .= "\t\t<td align=\"left\" valign=\"top\"><font size=\"-1\">";
        $_text .= create_bargraph($data[$i]['value'], $data[$i]['value'], $scale_factor);
        $_text .= "&nbsp;" . round($data[$i]['value']) . $text['degree_mark'] . "</font></td>\n";
        $_text .= "\t\t<td align=\"right\" valign=\"top\"><font size=\"-1\">" . $data[$i]['limit'] . " " . $text['degree_mark'] . "</font></td>\n";
        $_text .= "\t\t<td align=\"right\" valign=\"top\"><font size=\"-1\">" . round($data[$i]['percent'], 1) . " " . $text['degree_mark'] . "</font></td>\n";
    }
    $_text .= "\n</table>\n";
    return $_text;
}