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


PHP generate_smokeping_file函数代码示例

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


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

示例1: round

    $descr_len = 12 + round(($width - 275) / 8);
}
// FIXME str_pad really needs a "limit to length" so we can rid of all the substrs all over the code to limit the length as below...
if ($width > '500') {
    $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . " RTT      Loss    SDev   RTT\\:SDev\\l'";
} else {
    $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . " RTT      Loss    SDev   RTT\\:SDev\\l'";
}
foreach ($smokeping_files[$direction][$device['hostname']] as $source => $filename) {
    if (!isset($config['graph_colours'][$colourset][$iter])) {
        $iter = 0;
    }
    $colour = $config['graph_colours'][$colourset][$iter];
    $iter++;
    $descr = rrdtool_escape($source, $descr_len);
    $filename = generate_smokeping_file($device, $filename);
    $rrd_options .= " DEF:median{$i}=" . $filename . ':median:AVERAGE ';
    $rrd_options .= " CDEF:dm{$i}=median{$i},UN,0,median{$i},IF";
    $rrd_options .= " DEF:loss{$i}=" . $filename . ':loss:AVERAGE';
    $rrd_options .= " CDEF:ploss{$i}=loss{$i},{$pings},/,100,*";
    // $rrd_options .= " CDEF:dm$i=median$i";
    // $rrd_options .= " CDEF:dm$i=median$i,0,".$max->{$start}.",LIMIT";
    // start emulate Smokeping::calc_stddev
    foreach (range(1, $pings) as $p) {
        $rrd_options .= ' DEF:pin' . $i . 'p' . $p . '=' . $filename . ':ping' . $p . ':AVERAGE';
        $rrd_options .= ' CDEF:p' . $i . 'p' . $p . '=pin' . $i . 'p' . $p . ',UN,0,pin' . $i . 'p' . $p . ',IF';
    }
    unset($pings_options, $m_options, $sdev_options);
    foreach (range(2, $pings) as $p) {
        $pings_options .= ',p' . $i . 'p' . $p . ',UN,+';
        $m_options .= ',p' . $i . 'p' . $p . ',+';
开发者ID:n-st,项目名称:librenms,代码行数:31,代码来源:smokeping_all_common_avg.inc.php

示例2: get_smokeping_files

function get_smokeping_files($device)
{
    global $config;
    $smokeping_files = array();
    if (isset($config['smokeping']['dir'])) {
        $smokeping_dir = generate_smokeping_file($device);
        if ($handle = opendir($smokeping_dir)) {
            while (false !== ($file = readdir($handle))) {
                if ($file != '.' && $file != '..') {
                    if (eregi('.rrd', $file)) {
                        if (eregi('~', $file)) {
                            list($target, $slave) = explode('~', str_replace('.rrd', '', $file));
                            $target = str_replace('_', '.', $target);
                            $smokeping_files['in'][$target][$slave] = $file;
                            $smokeping_files['out'][$slave][$target] = $file;
                        } else {
                            $target = str_replace('.rrd', '', $file);
                            $target = str_replace('_', '.', $target);
                            $smokeping_files['in'][$target][$config['own_hostname']] = $file;
                            $smokeping_files['out'][$config['own_hostname']][$target] = $file;
                        }
                    }
                }
            }
        }
    }
    return $smokeping_files;
}
开发者ID:BillTheBest,项目名称:librenms,代码行数:28,代码来源:common.php

示例3: round

require 'smokeping_common.inc.php';
$i = 0;
$pings = $config['smokeping']['pings'];
$iter = 0;
$colourset = 'mixed';
if ($width > '500') {
    $descr_len = 18;
} else {
    $descr_len = 12 + round(($width - 275) / 8);
}
if ($width > '500') {
    $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . " RTT      Loss    SDev   RTT\\:SDev                              \\l'";
} else {
    $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . " RTT      Loss    SDev   RTT\\:SDev                              \\l'";
}
$filename_dir = generate_smokeping_file($device);
if ($src['hostname'] == $config['own_hostname']) {
    $filename = $filename_dir . $device['hostname'] . '.rrd';
    if (!file_exists($filename_dir . $device['hostname'] . '.rrd')) {
        // Try with dots in hostname replaced by underscores
        $filename = $filename_dir . str_replace('.', '_', $device['hostname']) . '.rrd';
    }
} else {
    $filename = $filename_dir . $device['hostname'] . '~' . $src['hostname'] . '.rrd';
    if (!file_exists($filename)) {
        // Try with dots in hostname replaced by underscores
        $filename = $filename_dir . str_replace('.', '-', $device['hostname']) . '~' . $src['hostname'] . '.rrd';
    }
}
if (!isset($config['graph_colours'][$colourset][$iter])) {
    $iter = 0;
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:in.inc.php


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