当前位置: 首页>>代码示例>>PHP>>正文


PHP collectd_flush函数代码示例

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


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

示例1: host_summary

function host_summary($hosts)
{
    global $CONFIG;
    $rrd = new RRDTool($CONFIG['rrdtool']);
    echo "<table class=\"summary\">\n";
    $row_style = array(0 => "even", 1 => "odd");
    $host_counter = 0;
    foreach ($hosts as $host) {
        $host_counter++;
        printf('<tr class="%s">', $row_style[$host_counter % 2]);
        printf('<th><a href="%s/host.php?h=%s">%s</a></th>', $CONFIG['weburl'], $host, $host);
        if ($CONFIG['showload']) {
            collectd_flush(sprintf('%s/load/load', $host));
            $rrd_info = $rrd->rrd_info($CONFIG['datadir'] . '/' . $host . '/load/load.rrd');
            # ignore if file does not exist
            if (!$rrd_info) {
                continue;
            }
            if (isset($rrd_info['ds[shortterm].last_ds']) && isset($rrd_info['ds[midterm].last_ds']) && isset($rrd_info['ds[longterm].last_ds'])) {
                printf('<td>%.2f</td><td>%.2f</td><td>%.2f</td>', $rrd_info['ds[shortterm].last_ds'], $rrd_info['ds[midterm].last_ds'], $rrd_info['ds[longterm].last_ds']);
            }
        }
        print "</tr>\n";
    }
    echo "</table>\n";
}
开发者ID:jrottenberg,项目名称:cgp,代码行数:26,代码来源:html.inc.php

示例2: array

if ($tinylegend) {
    $opts['tinylegend'] = 1;
}
$rrd_cmd = false;
if (isset($MetaGraphDefs[$type])) {
    $identifiers = array();
    foreach ($all_tinst as &$atinst) {
        $identifiers[] = collectd_identifier($host, $plugin, is_null($pinst) ? '' : $pinst, $type, $atinst);
    }
    collectd_flush($identifiers);
    $rrd_cmd = $MetaGraphDefs[$type]($host, $plugin, $pinst, $type, $all_tinst, $opts);
} else {
    if (!in_array(is_null($tinst) ? '' : $tinst, $all_tinst)) {
        return error404($host . '/' . $plugin . (!is_null($pinst) ? '-' . $pinst : '') . '/' . $type . (!is_null($tinst) ? '-' . $tinst : ''), "No rrd file found for graphing");
    }
    collectd_flush(collectd_identifier($host, $plugin, is_null($pinst) ? '' : $pinst, $type, is_null($tinst) ? '' : $tinst));
    if (isset($GraphDefs[$type])) {
        $rrd_cmd = collectd_draw_generic($timespan, $host, $plugin, $pinst, $type, $tinst);
    } else {
        $rrd_cmd = collectd_draw_rrd($host, $plugin, $pinst, $type, $tinst);
    }
}
if (isset($rrd_cmd)) {
    if ($vars['from']) {
        $from = $vars['from'];
    }
    if ($vars['to']) {
        $to = $vars['to'];
    }
    $rrd_cmd .= " -s " . escapeshellarg($from) . " -e " . escapeshellarg($to);
}
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:collectd.inc.php

示例3: Type_Default

require_once 'inc/collectd.inc.php';
## LAYOUT
# ping/
# ping/ping-<host>.rrd
# ping/ping_stddev-<host>.rrd
# ping/ping_droprate-<host>.rrd
$obj = new Type_Default($CONFIG);
$obj->data_sources = array('value');
$obj->ds_names = array('ping' => 'Ping time', 'ping_stddev' => 'Ping stddev', 'ping_droprate' => 'Ping droprate');
$obj->width = $width;
$obj->heigth = $heigth;
$obj->rrd_format = '%5.1lf';
switch ($obj->args['type']) {
    case 'ping':
        if ($CONFIG['version'] < 5) {
            $obj->data_sources = array('ping');
        }
        $obj->rrd_title = 'Ping latency';
        $obj->rrd_vertical = 'Milliseconds';
        break;
    case 'ping_stddev':
        $obj->rrd_title = 'Ping stddev';
        $obj->rrd_vertical = '';
        break;
    case 'ping_droprate':
        $obj->rrd_title = 'Ping droprate';
        $obj->rrd_vertical = '';
        break;
}
collectd_flush($obj->identifiers);
$obj->rrd_graph();
开发者ID:jrottenberg,项目名称:cgp,代码行数:31,代码来源:ping.php


注:本文中的collectd_flush函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。