• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP uptime函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中uptime函数的典型用法代码示例。如果您正苦于以下问题:PHP uptime函数的具体用法?PHP uptime怎么用?PHP uptime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了uptime函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: wml_vitals

function wml_vitals()
{
    global $XPath;
    global $text;
    $_text = "<card id=\"vitals\" title=\"" . $text['vitals'] . "\">\n" . "<p>" . $text['hostname'] . ":<br/>\n" . "-&nbsp;" . $XPath->getData("/phpsysinfo/Vitals/Hostname") . "</p>\n" . "<p>" . $text['ip'] . ":<br/>\n" . "-&nbsp;" . $XPath->getData("/phpsysinfo/Vitals/IPAddr") . "</p>\n" . "<p>" . $text['kversion'] . ":<br/>\n" . "-&nbsp;" . $XPath->getData("/phpsysinfo/Vitals/Kernel") . "</p>\n" . "<p>" . $text['uptime'] . ":<br/>\n" . "-&nbsp;" . uptime($XPath->getData("/phpsysinfo/Vitals/Uptime")) . "</p>\n" . "<p>" . $text['users'] . ":<br/>" . "-&nbsp;" . $XPath->getData("/phpsysinfo/Vitals/Users") . "</p>\n" . "<p>" . $text['loadavg'] . ":<br/>" . "-&nbsp;" . $XPath->getData("/phpsysinfo/Vitals/LoadAvg") . "</p>\n" . "</card>\n";
    return $_text;
}
开发者ID:BackupTheBerlios,项目名称:ascore,代码行数:7,代码来源:vitals.php


示例2: passthru

</font></div></td>
                    </tr>
                  <tr>
                    <TD><FONT face="Verdana, Arial, Helvetica, sans-serif" size=2>&nbsp;</FONT></TD>
                   </tr>
                </table></TD>
              </TR></TBODY></TABLE>
            <TABLE cellSpacing=0 width="100%" bgColor="#e97948" background="images/frame4.gif" border=0>
              <TBODY>
              <TR>
                <TD><div align="left"><FONT face="Verdana, Arial, Helvetica, sans-serif" color=#000000 size=2>Pbx Hostname: <?php 
echo passthru('hostname');
?>
</FONT></div></TD>
                <TD><div align="right"><FONT face="Verdana, Arial, Helvetica, sans-serif" color=#000000 size=2><?php 
echo "online: " . uptime();
?>
&nbsp;</FONT></div></TD>
              </TR></TBODY></TABLE>
            <TABLE cellSpacing=0 width="100%" bgColor=#FFFFFF background="images/frame4.gif" border=0>
              <TBODY></TBODY></TABLE>
          </TR></TBODY></TABLE></TR></TBODY></TABLE>

<?php 
switch ($extcmd) {
    default:
        break;
    case 'update':
        $sites = 'www.voiper.it';
        $sock = fsockopen($sites, 80, $errno, $errstr, 3);
        if (!$sock) {
开发者ID:shinichi85,项目名称:voiperopen,代码行数:31,代码来源:aggiornamenti.php


示例3: loadindex

    $level = $level > 10 ? "L10" : "L{$level}";
    return $level;
}
$data->assign("load1", loadindex($load_one));
$data->assign("load5", loadindex($load_five));
$data->assign("load15", loadindex($load_fifteen));
$data->assign("user", percentindex($cpu_user));
$data->assign("sys", percentindex($cpu_system));
$data->assign("idle", percentindex(100 - $cpu_idle));
# Software metrics
$os_name = $metrics['os_name']['VAL'];
$os_release = $metrics['os_release']['VAL'];
$machine_type = $metrics['machine_type']['VAL'];
$boottime = $metrics['boottime']['VAL'];
$booted = date("F j, Y, g:i a", $boottime);
$uptime = uptime($cluster['LOCALTIME'] - $metrics['boottime']['VAL']);
# Turning into MBs. A MB is 1024 bytes.
$swap_free = $metrics['swap_free']['VAL'] / 1024.0;
$swap_total = sprintf("%.1f", $metrics['swap_total']['VAL'] / 1024.0);
$swap_used = sprintf("%.1f", $swap_total - $swap_free);
$data->assign("OS", "{$os_name} {$os_release} ({$machine_type})");
$data->assign("booted", "{$booted}");
$data->assign("uptime", $up ? $uptime : "[down]");
$data->assign("swap", "Using {$swap_used} of {$swap_total} MB swap.");
# For the back link.
$cluster_url = rawurlencode($clustername);
$data->assign("physical_view", "./?p={$physical}&amp;c={$cluster_url}");
# For the full host view link.
$data->assign("full_host_view", "./?c={$cluster_url}&amp;h={$hostname}&amp;{$get_metric_string}");
# For the reload link.
$data->assign("self", "./?c={$cluster_url}&amp;h={$hostname}&amp;p={$physical}");
开发者ID:fjpqzm,项目名称:ganglia-web,代码行数:31,代码来源:show_node.php


示例4: CPRTeam_STAFF

        }
        if (count($row) == 0) {
            $db->exec("INSERT INTO CPRTeam_STAFF (uid, username) VALUES ('{$fromID}','{$userName}')");
        } else {
            $db->exec("UPDATE CPRTeam_STAFF SET username = '{$userName}' WHERE uid = '{$fromID}'");
        }
    }
    if (substr($message, 0, 1) == "/") {
        if (in_array($fromID, $users) || in_array($chatID, $groups)) {
            $cmd = str_replace(strtolower("@" . BOT_NAME), '', strtolower($message));
            switch ($cmd) {
                case "/help":
                    help();
                    break;
                case "/uptime":
                    uptime();
                    break;
                case "/tagall":
                    tagall();
                    break;
                case "/pull":
                    git_pull();
                    break;
                default:
                    break;
            }
        } else {
            sendMsg("你沒有權限喔~~~~~");
        }
    }
}
开发者ID:pantc12,项目名称:CPRTeam-TelegramBOT,代码行数:31,代码来源:index.php


示例5: start_cluster

function start_cluster($parser, $tagname, $attrs)
{
    global $metrics, $cluster, $self, $grid, $hosts_up, $hosts_down, $debug;
    static $hostname;
    if ($debug) {
        print "<br/>DEBUG: parser start cluster [{$tagname}]\n";
    }
    switch ($tagname) {
        case "GANGLIA_XML":
            preamble($attrs);
            break;
        case "GRID":
            $self = $attrs['NAME'];
            $grid = $attrs;
            break;
        case "CLUSTER":
            $cluster = $attrs;
            break;
        case "HOST":
            $hostname = $attrs['NAME'];
            if (host_alive($attrs, $cluster)) {
                isset($cluster['HOSTS_UP']) or $cluster['HOSTS_UP'] = 0;
                $cluster['HOSTS_UP']++;
                $hosts_up[$hostname] = $attrs;
            } else {
                isset($cluster['HOSTS_DOWN']) or $cluster['HOSTS_DOWN'] = 0;
                $cluster['HOSTS_DOWN']++;
                $hosts_down[$hostname] = $attrs;
            }
            # Pseudo metrics - add useful HOST attributes like gmond_started & last_reported to the metrics list:
            $metrics[$hostname]['gmond_started']['NAME'] = "GMOND_STARTED";
            $metrics[$hostname]['gmond_started']['VAL'] = $attrs['GMOND_STARTED'];
            $metrics[$hostname]['gmond_started']['TYPE'] = "timestamp";
            $metrics[$hostname]['last_reported']['NAME'] = "REPORTED";
            $metrics[$hostname]['last_reported']['VAL'] = uptime($cluster['LOCALTIME'] - $attrs['REPORTED']);
            $metrics[$hostname]['last_reported']['TYPE'] = "string";
            $metrics[$hostname]['last_reported_uptime_in_sec']['VAL'] = $cluster['LOCALTIME'] - $attrs['REPORTED'];
            $metrics[$hostname]['last_reported_timestamp']['NAME'] = "REPORTED TIMESTAMP";
            $metrics[$hostname]['last_reported_timestamp']['VAL'] = $attrs['REPORTED'];
            $metrics[$hostname]['last_reported_timestamp']['TYPE'] = "uint32";
            $metrics[$hostname]['ip_address']['NAME'] = "IP";
            $metrics[$hostname]['ip_address']['VAL'] = $attrs['IP'];
            $metrics[$hostname]['ip_address']['TYPE'] = "string";
            $metrics[$hostname]['location']['NAME'] = "LOCATION";
            $metrics[$hostname]['location']['VAL'] = $attrs['LOCATION'];
            $metrics[$hostname]['location']['TYPE'] = "string";
            break;
        case "METRIC":
            $metricname = rawurlencode($attrs['NAME']);
            $metrics[$hostname][$metricname] = $attrs;
            break;
        default:
            break;
    }
}
开发者ID:sasharatkovic,项目名称:cldemo,代码行数:55,代码来源:ganglia.php


示例6: url

    <table width='100%' border='1' cellspacing='0' cellpadding='1'>
		<tr><td align='center'>
		<table class='main' border='0' width='402'>
    <tr><td style='padding: 0px; background-image: url({$INSTALLER09['pic_base_url']}loadbarbg.gif); background-repeat: repeat-x'>";
    $perc = get_server_load();
    $percent = min(100, $perc);
    if ($percent <= 70) $pic = "loadbargreen.gif";
    elseif ($percent <= 90) $pic = "loadbaryellow.gif";
    else $pic = "loadbarred.gif";
    $width = $percent * 4;
    $HTMLOUT .="<img height='15' width='$width' src=\"{$INSTALLER09['pic_base_url']}{$pic}\" alt='$percent&#37;' /><br />{$lang['index_load_curr']}{$percent}{$lang['index_load_cpu']}<br /></td></tr></table></td></tr></table></div><br />";
    //==End
*/
//==Server Load linux
$HTMLOUT .= "\n    <div class='roundedCorners' style='text-align:left;width:80%;border:1px solid black;padding:5px;'>\n    <div style='background:transparent;height:25px;'><span style='font-weight:bold;font-size:12pt;'>{$lang['index_serverload']}</span></div>\n    <br />\n    <table width='100%' border='1' cellspacing='0' cellpadding='1'>\n\t\t\t<tr><td align='center'>\n\t\t    <table class='main' border='0' width='402'>\n    \t\t\t<tr><td style='padding: 0px; background-image: url({$INSTALLER09['pic_base_url']}loadbarbg.gif); background-repeat: repeat-x'>";
$percent = min(100, round(exec('ps ax | grep -c apache') / 256 * 100));
if ($percent <= 70) {
    $pic = "loadbargreen.gif";
} elseif ($percent <= 90) {
    $pic = "loadbaryellow.gif";
} else {
    $pic = "loadbarred.gif";
}
$width = $percent * 4;
$HTMLOUT .= "<img height='15' width='{$width}' src=\"{$INSTALLER09['pic_base_url']}{$pic}\" alt='{$percent}&#37;' /><br />{$lang['index_load_curr']}{$percent}{$lang['index_load_cpu']}<br />";
//==End graphic
$HTMLOUT .= "{$lang['index_load_uptime1']}" . uptime() . "";
$loadinfo = loadavg(true);
$HTMLOUT .= "<br />\n    {$lang['index_load_pastmin']}" . $loadinfo["last1"] . "<br />\n    {$lang['index_load_pastmin5']}" . $loadinfo["last5"] . "<br />\n    {$lang['index_load_pastmin15']}" . $loadinfo["last15"] . "<br />\n    {$lang['index_load_numtsk']}" . $loadinfo["tasks"] . "<br />\n    {$lang['index_load_numproc']}" . $loadinfo["processes"] . "<br />\n   {$lang['index_load_pid']}" . $loadinfo["lastpid"] . "<br />\n    </td></tr></table></td></tr></table></div><br />";
//==End
echo stdhead($lang['index_serverload']) . $HTMLOUT . stdfoot();
开发者ID:UniversalAdministrator,项目名称:U-232-V4,代码行数:31,代码来源:load.php


示例7: socket_create

$sock = socket_create(AF_INET, SOCK_STREAM, 0);
socket_bind($sock, 0, 12909) or die('Could not bind to address');
socket_listen($sock);

echo "Listening\n";

while(true) {
	$client = socket_accept($sock);
	$addr = "";
	socket_getpeername($client, $addr);
	echo "Socket opened: $addr\n";
	if(in_array($addr, $conf['white'])) {
		$resp = array();
		$resp['hostname'] = hostname();
		$resp['who'] = who();
		$resp['uplo'] = array_merge(array("uptime" => uptime()), loadavg());
		$resp['ram'] = memory();
		$resp['ips'] = ip_addresses();
		$reps['disk'] = diskusage();
		socket_write($client, json_encode($resp));
	} else {
		socket_write($client, json_encode(array("error" => "Unauthorized")));
	}
	socket_close($client);
}

socket_close($sock);

function hostname() {
	return trim(file_get_contents("/proc/sys/kernel/hostname"));
}
开发者ID:nikkiii,项目名称:php-scrd,代码行数:31,代码来源:scrd.php


示例8: while

    while (list($number, $row) = each($mount_points)) {
        if (($number + 1) % 2 == 0) {
            $tpl->assign(array('ITEM_CLASS' => 'content'));
        } else {
            $tpl->assign(array('ITEM_CLASS' => 'content2'));
        }
        $tpl->assign(array('MOUNT' => $row['mount'], 'TYPE' => $row['fstype'], 'PARTITION' => $row['disk'], 'PERCENT' => $row['percent'], 'FREE' => make_hr($row['free'] * 1014), 'USED' => make_hr($row['used'] * 1024), 'SIZE' => make_hr($row['size'] * 1024)));
        $tpl->parse('DISK_LIST_ITEM', '.disk_list_item');
    }
    $tpl->parse('DISK_LIST', 'disk_list');
}
/*
 *
 * static page messages.
 *
 */
gen_admin_menu($tpl);
gen_mount_point($tpl);
$kernel = kernel();
$uptime = uptime();
$load = loadavg();
$cpu = cpu_info();
$mem = memory();
$tpl->assign(array('TR_SYSTEM_INFO_TITLE' => tr('System info'), 'TR_SYSTEM_INFO' => tr('Vital system info'), 'TR_CPU_SYSTEM_INFO' => tr('CPU system Info'), 'TR_CPU_MODEL' => tr('CPU model'), 'TR_CPU_MHZ' => tr('CPU MHz'), 'TR_CPU_CACHE' => tr('CPU cache'), 'TR_CPU_BOGOMIPS' => tr('CPU bogomips'), 'CPU_MODEL' => $cpu['model'], 'CPU_MHZ' => $cpu['mhz'], 'CPU_CACHE' => $cpu['cache'], 'CPU_BOGOMIPS' => $cpu['bogomips'], 'TR_MEMRY_SYSTEM_INFO' => tr('Memory system info'), 'TR_RAM' => tr('RAM'), 'TR_TOTAL' => tr('Total'), 'TR_USED' => tr('Used'), 'TR_FREE' => tr('Free'), 'TR_SWAP' => tr('Swap'), 'TR_UPTIME' => tr('Up time'), 'UPTIME' => $uptime, 'TR_KERNEL' => tr('Kernel'), 'KERNEL' => $kernel, 'TR_LOAD' => tr('Load'), 'LOAD' => $load[0] . ' ' . $load[1] . '  ' . $load[0], 'RAM' => tr('RAM'), 'RAM_TOTAL' => format_bytesize($mem['ram']['total']), 'RAM_USED' => format_bytesize($mem['ram']['used']), 'RAM_FREE' => format_bytesize($mem['ram']['free']), 'SWAP_TOTAL' => format_bytesize($mem['swap']['total']), 'SWAP_USED' => format_bytesize($mem['swap']['used']), 'SWAP_FREE' => format_bytesize($mem['swap']['free']), 'TR_FILE_SYSTEM_INFO' => tr('Filesystem system Info'), 'TR_MOUNT' => tr('Mount'), 'TR_TYPE' => tr('Type'), 'TR_PARTITION' => tr('Partition'), 'TR_PERCENT' => tr('Percent'), 'TR_SIZE' => tr('Size')));
gen_page_message($tpl);
$tpl->parse('PAGE', 'page');
$tpl->prnt();
if (isset($cfg['DUMP_GUI_DEBUG'])) {
    dump_gui_debug();
}
unset_messages();
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:31,代码来源:sysinfo-Kernel-2.6.php


示例9: nodebox

function nodebox($hostname, $verbose, $title = "", $extrarow = "")
{
    global $cluster, $clustername, $metrics, $hosts_up, $GHOME;
    if (!$title) {
        $title = $hostname;
    }
    # Scalar helps choose a load color. The lower it is, the easier to get red.
    # The highest level occurs at a load of (loadscalar*10).
    $loadscalar = 0.2;
    # An array of [NAME|VAL|TYPE|UNITS|SOURCE].
    $m = $metrics[$hostname];
    $up = $hosts_up[$hostname] ? 1 : 0;
    # The metrics we need for this node.
    # Give memory in Gigabytes. 1GB = 2^20 bytes.
    $mem_total_gb = $m['mem_total']['VAL'] / 1048576;
    $load_one = $m['load_one']['VAL'];
    $cpu_speed = round($m['cpu_speed']['VAL'] / 1000, 2);
    $cpu_num = $m['cpu_num']['VAL'];
    #
    # The nested tables are to get the formatting. Insane.
    # We have three levels of verbosity. At L3 we show
    # everything; at L1 we only show name and load.
    #
    $rowclass = $up ? rowStyle() : "down";
    $host_url = rawurlencode($hostname);
    $cluster_url = rawurlencode($clustername);
    $row1 = "<tr><td class={$rowclass}>\n" . "<table width=\"100%\" cellpadding=1 cellspacing=0 border=0><tr>" . "<td><a href=\"{$GHOME}/?p={$verbose}&amp;c={$cluster_url}&amp;h={$host_url}\">" . "{$title}</a>&nbsp;<br>\n";
    $cpus = $cpu_num > 1 ? "({$cpu_num})" : "";
    if ($up) {
        $hardware = sprintf("<em>cpu: </em>%.2f<small>G</small> %s ", $cpu_speed, $cpus) . sprintf("<em>mem: </em>%.2f<small>G</small>", $mem_total_gb);
    } else {
        $hardware = "&nbsp;";
    }
    $row2 = "<tr><td colspan=2>";
    if ($verbose == 2) {
        $row2 .= $hardware;
    } else {
        if ($verbose > 2) {
            $hostattrs = $up ? $hosts_up : $hosts_down;
            $last_heartbeat = $hostattrs[$hostname]['TN'];
            $age = $last_heartbeat > 3600 ? uptime($last_heartbeat) : "{$last_heartbeat}s";
            $row2 .= "<font size=\"-2\">Last heartbeat {$age}</font>";
            $row3 = $hardware;
        }
    }
    #
    # Load box.
    #
    if (!$cpu_num) {
        $cpu_num = 1;
    }
    $loadindex = intval($load_one / ($loadscalar * $cpu_num)) + 1;
    # 10 is currently the highest allowed load index.
    $load_class = $loadindex > 10 ? "L10" : "L{$loadindex}";
    $row1 .= "</td><td align=right valign=top>" . "<table cellspacing=1 cellpadding=3 border=0><tr>" . "<td class={$load_class} align=right><small>{$load_one}</small>" . "</td></tr></table>" . "</td></tr>\n";
    # Construct cell.
    $cell = $row1;
    if ($extrarow) {
        $cell .= $extrarow;
    }
    if ($verbose > 1) {
        $cell .= $row2;
    }
    $cell .= "</td></tr></table>\n";
    # Tricky.
    if ($verbose > 2) {
        $cell .= $row3;
    }
    $cell .= "</td></tr>\n";
    return $cell;
}
开发者ID:app-genesis,项目名称:ganglia,代码行数:71,代码来源:functions.php


示例10: array_merge

}
$sorted_hosts = array_merge($down_hosts, $sorted_hosts);
# First pass to find the max value in all graphs for this
# metric. The $start,$end variables comes from get_context.php,
# included in index.php.
list($min, $max) = find_limits($sorted_hosts, $metricname);
# Second pass to output the graphs or metrics.
$i = 1;
foreach ($sorted_hosts as $host => $value) {
    $host_url = rawurlencode($host);
    $host_link = "\"?c={$cluster_url}&amp;h={$host_url}&amp;{$get_metric_string}\"";
    $textval = "";
    #echo "$host: $value, ";
    if (isset($hosts_down[$host]) and $hosts_down[$host]) {
        $last_heartbeat = $cluster['LOCALTIME'] - $hosts_down[$host]['REPORTED'];
        $age = $last_heartbeat > 3600 ? uptime($last_heartbeat) : "{$last_heartbeat}s";
        $class = "down";
        $textval = "down <br>&nbsp;<font size=\"-2\">Last heartbeat {$age} ago</font>";
    } else {
        if (isset($metrics[$host][$metricname])) {
            $val = $metrics[$host][$metricname];
        } else {
            $val = NULL;
        }
        $class = "metric";
        if ($val['TYPE'] == "timestamp" or isset($always_timestamp[$metricname]) and $always_timestamp[$metricname]) {
            $textval = date("r", $val['VAL']);
        } elseif ($val['TYPE'] == "string" or $val['SLOPE'] == "zero" or (isset($always_constant[$metricname]) and $always_constant[$metricname] or $max_graphs > 0 and $i > $max_graphs and $hostcols != 0)) {
            if (isset($reports[$metricname]) and $reports[$metricname]) {
                // No "current" values available for reports
                $textval = "N/A";
开发者ID:app-genesis,项目名称:ganglia,代码行数:31,代码来源:cluster_view.php


示例11: url

    <table width='100%' border='1' cellspacing='0' cellpadding='1'>
		<tr><td align='center'>
		<table class='main' border='0' width='402'>
    <tr><td style='padding: 0px; background-image: url({$INSTALLER09['pic_base_url']}loadbarbg.gif); background-repeat: repeat-x'>";
    $perc = get_server_load();
    $percent = min(100, $perc);
    if ($percent <= 70) $pic = "loadbargreen.gif";
    elseif ($percent <= 90) $pic = "loadbaryellow.gif";
    else $pic = "loadbarred.gif";
    $width = $percent * 4;
    $HTMLOUT .="<img height='15' width='$width' src=\"{$INSTALLER09['pic_base_url']}{$pic}\" alt='$percent&#37;' /><br />Currently {$percent}&#37; CPU usage.<br /></td></tr></table></td></tr></table></div><br />";
    //==End
*/
//==Server Load linux
$HTMLOUT .= "\r\n    <div class='roundedCorners' style='text-align:left;width:80%;border:1px solid black;padding:5px;'>\r\n    <div style='background:transparent;height:25px;'><span style='font-weight:bold;font-size:12pt;'>{$lang['index_serverload']}</span></div>\r\n    <br />\r\n    <table width='100%' border='1' cellspacing='0' cellpadding='1'>\r\n\t\t\t<tr><td align='center'>\r\n\t\t    <table class='main' border='0' width='402'>\r\n    \t\t\t<tr><td style='padding: 0px; background-image: url({$INSTALLER09['pic_base_url']}loadbarbg.gif); background-repeat: repeat-x'>";
$percent = min(100, round(exec('ps ax | grep -c apache') / 256 * 100));
if ($percent <= 70) {
    $pic = "loadbargreen.gif";
} elseif ($percent <= 90) {
    $pic = "loadbaryellow.gif";
} else {
    $pic = "loadbarred.gif";
}
$width = $percent * 4;
$HTMLOUT .= "<img height='15' width='{$width}' src=\"{$INSTALLER09['pic_base_url']}{$pic}\" alt='{$percent}&#37;' /><br />Currently {$percent}&#37; CPU usage.<br />";
//==End graphic
$HTMLOUT .= "Uptime: " . uptime() . "";
$loadinfo = loadavg(true);
$HTMLOUT .= "<br />\r\n    Load average for processes running for the past minute: " . $loadinfo["last1"] . "<br />\r\n    Load average for processes running for the past 5 minutes: " . $loadinfo["last5"] . "<br />\r\n    Load average for processes running for the past 15 minutes: " . $loadinfo["last15"] . "<br />\r\n    Number of tasks currently running: " . $loadinfo["tasks"] . "<br />\r\n    Number of processes currently running: " . $loadinfo["processes"] . "<br />\r\n    PID of last process executed: " . $loadinfo["lastpid"] . "<br />\r\n    </td></tr></table></td></tr></table></div><br />";
//==End
echo stdhead("Server Load") . $HTMLOUT . stdfoot();
开发者ID:CharlieHD,项目名称:U-232-V3,代码行数:31,代码来源:load.php


示例12: redirect

require_once "libs/functions.php";
// If not logged in, redirect to login page for logging in!
if (empty($userdata)) {
    redirect("login.php");
}
//Display the realm list, status of each realm, and the population and locale.
$output .= '<div class="content center_left">
				<div class="contentbox">
					<div class="contentbox_title">Realm status </div>
					<div class="contentbox_body">
					<center>Current Realm: ' . $userdata['realm'] . ' Status: ' . realmstatus($userdata['realm']) . ' Uptime: ' . uptime($userdata['realm']) . '</center><br /><br />
					<table class="tabular" width="100%">
					<tr><th>Realm name</th><th>Status</th><th>Location</th><th>Players</th><th>Uptime</th><th>Type</th></tr>';
$query = $sqlr->query("SELECT * FROM realmlist ORDER BY id ASC");
while ($realm = mysql_fetch_array($query)) {
    if ($realm['name'] == $userdata['realm']) {
        $output .= '<tr class="tabular_odd"><td>' . $realm['name'] . '</td><td>' . realmstatus($realm['name']) . '</td><td>' . realmlocation($realm['name']) . '</td><td>' . $realm['population'] . '</td><td>' . uptime($realm['name']) . '</td><td>' . realmtype($realm['name']) . '</td></tr>';
    } else {
        $output .= '<tr class="tabular_even"><td>' . $realm['name'] . '</td><td>' . realmstatus($realm['name']) . '</td><td>' . realmlocation($realm['name']) . '</td><td>' . $realm['population'] . '</td><td>' . uptime($realm['name']) . '</td><td>' . realmtype($realm['name']) . '</td></tr>';
    }
}
$output .= '	
					</table>
					</div>
				</div>
			</div>
			<div id="clear">
			</div>
		</div>';
require_once "footer.php";
echo $output;
开发者ID:jempson,项目名称:trinitymanager,代码行数:31,代码来源:realmlist.php


示例13: error_reporting

<?php

error_reporting(E_ALL);
echo 'pipe';
# This is the main file for pipe, the lightweight server admin panel
# This file loads the configuration resource,
# fetches the necessary information from log files and other server resources,
# and then renders a template with bootstrap.
require_once 'config.php';
require_once 'functions.php';
$view_data = array();
# UPTIME
$view_data['uptime'] = uptime();
# CPU-load
# Render
render($view_data);
开发者ID:AsgeirSH,项目名称:pipe,代码行数:16,代码来源:index.php


示例14: round

    $limit = ConvertDatasize::ToBytes($memory_limit);
    $pct = round($used_mem / $limit * 100, 1);
    $limit_s = round(ConvertDatasize::convert('byte', 'MiB', $limit), 1);
    echo ' (<b>' . $pct . '%</b>' . ' of <b>' . $limit_s . ' MiB</b>)<br/>';
} else {
    echo ' (no limit)<br/>';
}
echo '<br/>';
if (extension_loaded('apc')) {
    $info = apc_cache_info('', true);
    //d($info);
    echo 'APC: using <b>' . round(ConvertDatasize::convert('byte', 'MiB', $info['mem_size']), 2) . ' MiB</b><br/>';
    echo 'APC: <b>' . $info['num_hits'] . '</b> hits, <b>' . $info['num_misses'] . '</b> misses<br/>';
    echo 'APC: <b>' . $info['num_entries'] . '</b> entries (max <b>' . $info['num_slots'] . '</b>)<br/>';
    echo '<br/>';
}
$client = HttpUserAgent::getBrowser();
echo 'Client: <b>' . $_SERVER['REMOTE_ADDR'] . '</b>' . ' using ' . ' <span title="' . $_SERVER['HTTP_USER_AGENT'] . '" style="font-weight:bold">' . $client->name . ' ' . $client->version . ' (' . $client->os . ', ' . $client->arch . ')</span><br/>';
echo '<br/>';
echo 'Webserver: <b>' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '</b><br/>';
echo 'Software: <b>' . $_SERVER['SERVER_SOFTWARE'] . '</b> with <b><span title="PHP_VERSION_ID = ' . PHP_VERSION_ID . '">PHP ' . phpversion() . '</span></b><br/>';
echo 'Webserver time: <b>' . date('Y-m-d H:i:s T') . '</b><br/>';
echo 'System uptime: <b>' . elapsed_seconds(uptime()) . '</b><br/>';
echo '</div>';
// closing $prof_id
echo ' | <span id="span_rendertime">9.99</span>s render';
echo ahref_js('', "return hide_el('" . $wrapper_id . "');", 'closebtn');
echo '</div>';
// closing inner $container_id
echo '</div>';
// closing outer wrapper
开发者ID:martinlindhe,项目名称:core_dev,代码行数:31,代码来源:page.php


示例15: timer_stop

<?php

if (!defined('__TYPECHO_ROOT_DIR__')) {
    exit;
}
?>

</div>
<!-- .site-content --> 
<footer id="colophon" class="site-footer" role="contentinfo"> 
<div class="site-info"> 
Powered by <a href="http://typecho.org">Typecho)))</a>. <?php 
timer_stop(true);
?>
. <?php 
echo uptime();
?>
. 
</div>
<!-- .site-info --> 
</footer>
<!-- .site-footer --> 
</div>
<!-- .site --> 
<script type='text/javascript'>
/* <![CDATA[ */
var screenReaderText = {"expand":"<span class=\"screen-reader-text\">\u5c55\u5f00\u5b50\u83dc\u5355<\/span>","collapse":"<span class=\"screen-reader-text\">\u6298\u53e0\u5b50\u83dc\u5355<\/span>"};
/* ]]> */
</script>
<script type="text/javascript" src="<?php 
$this->options->themeUrl('public/twentyfifteen.js');
开发者ID:m4html,项目名称:typecho-theme-Twentyfifteen,代码行数:31,代码来源:footer.php


示例16: getHostOverViewData

function getHostOverViewData($hostname, $metrics, $cluster, $hosts_up, $hosts_down, $always_timestamp, $always_constant, $data)
{
    $data->assign("extra", template("host_extra.tpl"));
    $data->assign("host", $hostname);
    $data->assign("node_image", node_image($metrics));
    if ($hosts_up) {
        $data->assign("node_msg", "This host is up and running.");
    } else {
        $data->assign("node_msg", "This host is down.");
    }
    # No reason to go on if this node is down.
    if ($hosts_down) {
        return;
    }
    foreach ($metrics as $name => $v) {
        if ($v['TYPE'] == "string" or $v['TYPE'] == "timestamp" or isset($always_timestamp[$name]) and $always_timestamp[$name]) {
            $s_metrics[$name] = $v;
        } elseif ($v['SLOPE'] == "zero" or isset($always_constant[$name]) and $always_constant[$name]) {
            $c_metrics[$name] = $v;
        }
    }
    # in case this is not defined, set to LOCALTIME so uptime will be 0 in the display
    $boottime = null;
    if (isset($metrics['boottime']['VAL'])) {
        $boottime = $metrics['boottime']['VAL'];
    } else {
        $boottime = $cluster['LOCALTIME'];
    }
    # Add the uptime metric for this host. Cannot be done in ganglia.php,
    # since it requires a fully-parsed XML tree. The classic contructor problem.
    $s_metrics['uptime']['TYPE'] = "string";
    $s_metrics['uptime']['VAL'] = uptime($cluster['LOCALTIME'] - $boottime);
    $s_metrics['uptime']['TITLE'] = "Uptime";
    # Add the gmond started timestamps & last reported time (in uptime format) from
    # the HOST tag:
    $s_metrics['gmond_started']['TYPE'] = "timestamp";
    $s_metrics['gmond_started']['VAL'] = $hosts_up['GMOND_STARTED'];
    $s_metrics['gmond_started']['TITLE'] = "Gmond Started";
    $s_metrics['last_reported']['TYPE'] = "string";
    $s_metrics['last_reported']['VAL'] = uptime($cluster['LOCALTIME'] - $hosts_up['REPORTED']);
    $s_metrics['last_reported']['TITLE'] = "Last Reported";
    $s_metrics['ip_address']['TITLE'] = "IP Address";
    $s_metrics['ip_address']['VAL'] = $hosts_up['IP'];
    $s_metrics['ip_address']['TYPE'] = "string";
    $s_metrics['location']['TITLE'] = "Location";
    $s_metrics['location']['VAL'] = $hosts_up['LOCATION'];
    $s_metrics['location']['TYPE'] = "string";
    # String metrics
    if (is_array($s_metrics)) {
        $s_metrics_data = array();
        ksort($s_metrics);
        foreach ($s_metrics as $name => $v) {
            # RFM - If units aren't defined for metric, make it be the empty string
            !array_key_exists('UNITS', $v) and $v['UNITS'] = "";
            if (isset($v['TITLE'])) {
                $s_metrics_data[$name]["name"] = $v['TITLE'];
            } else {
                $s_metrics_data[$name]["name"] = $name;
            }
            if ($v['TYPE'] == "timestamp" or isset($always_timestamp[$name]) and $always_timestamp[$name]) {
                $s_metrics_data[$name]["value"] = date("r", $v['VAL']);
            } else {
                $s_metrics_data[$name]["value"] = $v['VAL'] . " " . $v['UNITS'];
            }
        }
    }
    $data->assign("s_metrics_data", $s_metrics_data);
    # Constant metrics.
    $c_metrics_data = null;
    if (isset($c_metrics) and is_array($c_metrics)) {
        $c_metrics_data = array();
        ksort($c_metrics);
        foreach ($c_metrics as $name => $v) {
            if (isset($v['TITLE'])) {
                $c_metrics_data[$name]["name"] = $v['TITLE'];
            } else {
                $c_metrics_data[$name]["name"] = $name;
            }
            $c_metrics_data[$name]["value"] = "{$v['VAL']} {$v['UNITS']}";
        }
    }
    $data->assign("c_metrics_data", $c_metrics_data);
}
开发者ID:reznor,项目名称:ganglia-web,代码行数:83,代码来源:functions.php


示例17: uptime

            }
        }
    }
}
# Add the uptime metric for this host. Cannot be done in ganglia.php,
# since it requires a fully-parsed XML tree. The classic contructor problem.
$s_metrics['uptime']['TYPE'] = "string";
$s_metrics['uptime']['VAL'] = uptime($cluster['LOCALTIME'] - $metrics['boottime']['VAL']);
$s_metrics['uptime']['TITLE'] = "Uptime";
# Add the gmond started timestamps & last reported time (in uptime format) from
# the HOST tag:
$s_metrics['gmond_started']['TYPE'] = "timestamp";
$s_metrics['gmond_started']['VAL'] = $hosts_up['GMOND_STARTED'];
$s_metrics['gmond_started']['TITLE'] = "Gmond Started";
$s_metrics['last_reported']['TYPE'] = "string";
$s_metrics['last_reported']['VAL'] = uptime($cluster['LOCALTIME'] - $hosts_up['REPORTED']);
$s_metrics['last_reported']['TITLE'] = "Last Reported";
# Show string metrics
if (is_array($s_metrics)) {
    ksort($s_metrics);
    foreach ($s_metrics as $name => $v) {
        # RFM - If units aren't defined for metric, make it be the empty string
        !array_key_exists('UNITS', $v) and $v['UNITS'] = "";
        $tpl->newBlock("string_metric_info");
        if (isset($v['TITLE'])) {
            $tpl->assign("name", $v['TITLE']);
        } else {
            $tpl->assign("name", $name);
        }
        if ($v['TYPE'] == "timestamp" or isset($always_timestamp[$name]) and $always_timestamp[$name]) {
            $tpl->assign("value", date("r", $v['VAL']));
开发者ID:neutronz,项目名称:37s_cookbooks,代码行数:31,代码来源:host_view.php


示例18: get_host_metric_graphs

function get_host_metric_graphs($showhosts, $hosts_up, $hosts_down, $user, $conf, $metrics, $metricname, $sort, $clustername, $get_metric_string, $cluster, $always_timestamp, $reports_metricname, $clustergraphsize, $range, $start, $end, $cs, $ce, $vlabel, $data)
{
    $sorted_hosts = array();
    $down_hosts = array();
    if ($showhosts == 0) {
        return;
    }
    foreach ($hosts_up as $host => $val) {
        // If host_regex is defined
        if (isset($user['host_regex']) && !preg_match("/" . $user['host_regex'] . "/", $host)) {
            continue;
        }
        $load = get_load($host, $metrics);
        $host_load[$host] = $load;
        if ($metricname == "load_one") {
            $sorted_hosts[$host] = $load;
        } else {
            if (isset($metrics[$host][$metricname])) {
                $sorted_hosts[$host] = $metrics[$host][$metricname]['VAL'];
            } else {
                $sorted_hosts[$host] = "";
            }
        }
    }
    // foreach hosts_up
    foreach ($hosts_down as $host => $val) {
        $down_hosts[$host] = -1.0;
    }
    $data->assign("node_legend", 1);
    if (!is_array($hosts_up)) {
        return;
    }
    switch ($sort) {
        case "descending":
            arsort($sorted_hosts);
            break;
        case "by name":
            uksort($sorted_hosts, "strnatcmp");
            break;
        default:
        case "ascending":
            asort($sorted_hosts);
            break;
    }
    $sorted_hosts = array_merge($down_hosts, $sorted_hosts);
    if (isset($user['max_graphs'])) {
        $max_graphs = $user['max_graphs'];
    } else {
        $max_graphs = $conf['max_graphs'];
    }
    // First pass to find the max value in all graphs for this
    // metric. The $start,$end variables comes from get_context.php,
    // included in index.php.
    // Do this only if person has not selected a maximum set of graphs to display
    if ($max_graphs == 0 && $showhosts == 1) {
        $cs = $user['cs'];
        if ($cs and (is_numeric($cs) or strtotime($cs))) {
            $start = $cs;
        }
        $ce = $user['ce'];
        if ($ce and (is_numeric($ce) or strtotime($ce))) {
            $end = $ce;
        }
        list($min, $max) = find_limits($clustername, $sorted_hosts, $metricname, $start, $end, $metrics, $conf, $rrd_options);
    }
    // Second pass to output the graphs or metrics.
    $i = 1;
    // Initialize overflow list
    $overflow_list = array();
    $overflow_counter = 1;
    $cluster_url = rawurlencode($clustername);
    $size = isset($clustergraphsize) ? $clustergraphsize : 'small';
    if ($conf['hostcols'] == 0) {
        // enforce small size in multi-host report
        $size = 'small';
    }
    // set host zoom class based on the size of the graph shown
    if (isset($conf['zoom_support']) && $conf['zoom_support'] === true) {
        $additional_host_img_html_args = "class=host_{$size}_zoomable";
    }
    foreach ($sorted_hosts as $host => $value) {
        if (isset($hosts_down[$host]) and $hosts_down[$host] && isset($conf['cluster_hide_down_hosts']) && $conf['cluster_hide_down_hosts']) {
            // If we're hiding DOWN hosts, we skip to next iteration of the loop.
            continue;
        }
        $host_url = $case_sensitive_hostnames ? rawurlencode($host) : strtolower(rawurlencode($host));
        $host_link = "\"?c={$cluster_url}&amp;h={$host_url}&amp;{$get_metric_string}\"";
        $textval = "";
        //echo "$host: $value, ";
        if (isset($hosts_down[$host]) and $hosts_down[$host]) {
            $last_heartbeat = $cluster['LOCALTIME'] - $hosts_down[$host]['REPORTED'];
            $age = $last_heartbeat > 3600 ? uptime($last_heartbeat) : "{$last_heartbeat}s";
            $class = "down";
            $textval = "down <br>&nbsp;<font size=\"-2\">Last heartbeat {$age} ago</font>";
        } else {
            if (isset($metrics[$host][$metricname])) {
                $val = $metrics[$host][$metricname];
            } else {
                $val = NULL;
            }
//.........这里部分代码省略.........
开发者ID:fjpqzm,项目名称:ganglia-web,代码行数:101,代码来源:cluster_view.php


示例19: foreach

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP uptimef函数代码示例发布时间:2022-05-23
下一篇:
PHP uppercase函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap