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

PHP formatStorage函数代码示例

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

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



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

示例1: round

    }
    $perc = round($drive['storage_perc'], 0);
    $total = formatStorage($drive['storage_size']);
    $free = formatStorage($drive['storage_free']);
    $used = formatStorage($drive['storage_used']);
    $store_url = "graph.php?id=" . $drive['storage_id'] . "&type=storage&from={$month}&to={$now}&width=400&height=125";
    $store_popup = "onmouseover=\"return overlib('<img src=\\'{$store_url}\\'>', LEFT);\" onmouseout=\"return nd();\"";
    $mini_graph = $config['base_url'] . "/graph.php?id=" . $drive['storage_id'] . "&type=storage&from=" . $day . "&to=" . $now . "&width=80&height=20&bg=f4f4f4";
    if ($perc > '90') {
        $left_background = 'c4323f';
        $right_background = 'C96A73';
    } elseif ($perc > '75') {
        $left_background = 'bf5d5b';
        $right_background = 'd39392';
    } elseif ($perc > '50') {
        $left_background = 'bf875b';
        $right_background = 'd3ae92';
    } elseif ($perc > '25') {
        $left_background = '5b93bf';
        $right_background = '92b7d3';
    } else {
        $left_background = '9abf5b';
        $right_background = 'bbd392';
    }
    echo "<tr bgcolor='{$row_colour}'><td>" . generatedevicelink($drive) . "</td><td class=tablehead>" . $drive['storage_descr'] . "</td>\n         <td><img src='{$mini_graph}'></td>\n         <td>\n          <a href='#' {$store_popup}>" . print_percentage_bar(400, 20, $perc, "{$used} / {$total}", "ffffff", $left_background, formatStorage($free), "ffffff", $right_background) . "</a>\n          </td><td>{$perc}" . "%</td></tr>";
    $row++;
}
echo "</table></div>";
?>

开发者ID:kyrisu,项目名称:observernms,代码行数:29,代码来源:storage.php


示例2: microtime

</div>
<?php 
$runtime_end = microtime(true);
$runtime = $runtime_end - $runtime_start;
$gentime = substr($runtime, 0, 5);
# FIXME - move this
if ($config['page_gen']) {
    echo '  <br />MySQL: Cell    ' . ($db_stats['fetchcell'] + 0) . '/' . round($db_stats['fetchcell_sec'] + 0, 3) . 's' . ' Row    ' . ($db_stats['fetchrow'] + 0) . '/' . round($db_stats['fetchrow_sec'] + 0, 3) . 's' . ' Rows   ' . ($db_stats['fetchrows'] + 0) . '/' . round($db_stats['fetchrows_sec'] + 0, 3) . 's' . ' Column ' . ($db_stats['fetchcol'] + 0) . '/' . round($db_stats['fetchcol_sec'] + 0, 3) . 's';
    $fullsize = memory_get_usage();
    unset($cache);
    $cachesize = $fullsize - memory_get_usage();
    if ($cachesize < 0) {
        $cachesize = 0;
    }
    // Silly PHP!
    echo '  <br />Cached data in memory is ' . formatStorage($cachesize) . '. Page memory usage is ' . formatStorage($fullsize) . ', peaked at ' . formatStorage(memory_get_peak_usage()) . '.';
    echo '  <br />Generated in ' . $gentime . ' seconds.';
}
if (isset($pagetitle) && is_array($pagetitle)) {
    # if prefix is set, put it in front
    if ($config['page_title_prefix']) {
        array_unshift($pagetitle, $config['page_title_prefix']);
    }
    # if suffix is set, put it in the back
    if ($config['page_title_suffix']) {
        $pagetitle[] = $config['page_title_suffix'];
    }
    # create and set the title
    $title = join(" - ", $pagetitle);
    echo "<script type=\"text/javascript\">\ndocument.title = '{$title}';\n</script>";
}
开发者ID:vitalisator,项目名称:librenms,代码行数:31,代码来源:index.php


示例3: transferOverview

function transferOverview($bill_id, $history)
{
    global $list_colour_a, $list_colour_b, $config;
    $i = 0;
    $tot = array();
    $traf = array();
    $start = $history['timestampfrom'];
    $end = $history['timestampto'];
    //$background= $history['background'];
    $res = "";
    $res .= "<table class=\"transferOverview\">";
    $res .= "  <tr bgcolor=\"#000\">";
    $res .= "    <th class=\"period\">Date</th>";
    $res .= "    <th class=\"inbound\">Inbound</th>";
    $res .= "    <th class=\"outbound\">Outbound</th>";
    $res .= "    <th class=\"total\">Total</th>";
    $res .= "  </tr>";
    foreach (dbFetch("SELECT DISTINCT UNIX_TIMESTAMP(timestamp) as timestamp, SUM(delta) as traf_total, SUM(in_delta) as traf_in, SUM(out_delta) as traf_out FROM bill_data WHERE `bill_id`= ? AND `timestamp` >= FROM_UNIXTIME(?) AND `timestamp` <= FROM_UNIXTIME(?) GROUP BY DATE(timestamp) ORDER BY timestamp ASC", array($bill_id, $start, $end)) as $data) {
        $date = strftime("%A, %e %B %Y", $data['timestamp']);
        $tot['in'] += gbConvert($data['traf_in']);
        $tot['out'] += gbConvert($data['traf_out']);
        $tot['tot'] += gbConvert($data['traf_total']);
        $traf['in'] = formatStorage(gbConvert($data['traf_in']), "3");
        $traf['out'] = formatStorage(gbConvert($data['traf_out']), "3");
        $traf['tot'] = formatStorage(gbConvert($data['traf_total']), "3");
        $row_colour = !is_integer($i / 2) ? $list_colour_a : $list_colour_b;
        $res .= "  <tr bgcolor=\"" . $row_colour . "\">";
        $res .= "    <td>" . $date . "</td>";
        $res .= "    <td class=\"right\">" . $traf['in'] . "</td>";
        $res .= "    <td class=\"right\">" . $traf['out'] . "</td>";
        $res .= "    <td class=\"right\">" . $traf['tot'] . "</td>";
        $res .= "  </tr>";
        $i++;
    }
    $tot['in'] = formatStorage($tot['in']);
    $tot['out'] = formatStorage($tot['out']);
    $tot['tot'] = formatStorage($tot['tot']);
    $res .= "  <tr bgcolor=\"#ccc\" style=\"border-top: 1px solid #000;\">";
    $res .= "    <td></td>";
    $res .= "    <td class=\"right\"><b>" . $tot['in'] . "</b></td>";
    $res .= "    <td class=\"right\"><b>" . $tot['out'] . "</b></td>";
    $res .= "    <td class=\"right\"><b>" . $tot['tot'] . "</b></td>";
    $res .= "  </tr>";
    $res .= "</table>";
    return $res;
}
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:46,代码来源:pdf_history.inc.php


示例4: rrdtool_update_ng

    $mempool['free'] = $mempool['total'] - $mempool['used'];
    $hc = $mempool['mempool_hc'] ? ' (HC)' : '';
    // Update StatsD/Carbon
    if ($config['statsd']['enable'] == TRUE) {
        StatsD::gauge(str_replace(".", "_", $device['hostname']) . '.' . 'mempool' . '.' . $mempool['mempool_mib'] . "." . $mempool['mempool_index'] . ".used", $mempool['used']);
        StatsD::gauge(str_replace(".", "_", $device['hostname']) . '.' . 'mempool' . '.' . $mempool['mempool_mib'] . "." . $mempool['mempool_index'] . ".free", $mempool['free']);
    }
    rrdtool_update_ng($device, 'mempool', array('used' => $mempool['used'], 'free' => $mempool['free']), $mempool['mempool_mib'] . "-" . $mempool['mempool_index']);
    if (!is_numeric($mempool['mempool_polled'])) {
        dbInsert(array('mempool_id' => $mempool['mempool_id']), 'mempools-state');
    }
    $mempool['state'] = array('mempool_polled' => time(), 'mempool_used' => $mempool['used'], 'mempool_perc' => $mempool['perc'], 'mempool_free' => $mempool['free'], 'mempool_total' => $mempool['total']);
    dbUpdate($mempool['state'], 'mempools-state', '`mempool_id` = ?', array($mempool['mempool_id']));
    $graphs['mempool'] = TRUE;
    check_entity('mempool', $mempool, array('mempool_perc' => $mempool['perc'], 'mempool_free' => $mempool['free'], 'mempool_used' => $mempool['used']));
    //  print_message("Mempool ". $mempool['mempool_descr'] . ': '.$mempool['perc'].'%%'.$hc);
    $table_row = array();
    $table_row[] = $mempool['mempool_descr'];
    $table_row[] = $mempool['mempool_mib'];
    $table_row[] = $mempool['mempool_index'];
    $table_row[] = formatStorage($mempool['total']);
    $table_row[] = formatStorage($mempool['used']);
    $table_row[] = formatStorage($mempool['free']);
    $table_row[] = $mempool['perc'] . '%';
    $table_rows[] = $table_row;
    unset($table_row);
}
$headers = array('%WLabel%n', '%WType%n', '%WIndex%n', '%WTotal%n', '%WUsed%n', '%WFree%n', '%WPerc%n');
print_cli_table($table_rows, $headers);
unset($cache_mempool, $mempool, $index, $table_row, $table_rows, $table_headers);
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:mempools.inc.php


示例5: dbFetchCell

$stat_ns_vsvrs = dbFetchCell('SELECT COUNT(*) FROM `netscaler_vservers`');
$stat_ns_svcs = dbFetchCell('SELECT COUNT(*) FROM `netscaler_services`');
$stat_vms = dbFetchCell('SELECT COUNT(*) FROM `vminfo`');
$stat_ip_sla = dbFetchCell('SELECT COUNT(*) FROM `slas`');
$stat_db = get_db_size();
$stat_rrd = get_dir_size($config['rrd_dir']);
?>
      <table class="table table-striped table-condensed">
        <tbody>
          <tr>
            <td style="width: 45%;"><i class="oicon-database"></i> <strong>DB size</strong></td><td><span class="pull-right"><?php 
echo formatStorage($stat_db);
?>
</span></td>
            <td style="width: 45%;"><i class="oicon-box-zipper"></i> <strong>RRD size</strong></td><td><span class="pull-right"><?php 
echo formatStorage($stat_rrd);
?>
</span></td>
          </tr>
          <tr>
            <td><i class="oicon-servers"></i> <strong>Devices</strong></td><td><span class="pull-right"><?php 
echo $stat_devices;
?>
</span></td>
            <td><i class="oicon-network-ethernet"></i> <strong>Ports</strong></td><td><span class="pull-right"><?php 
echo $stat_ports;
?>
</span></td>
          </tr>
          <tr>
            <td><i class="oicon-ipv4"></i> <strong>IPv4 Addresses</strong></td><td><span class="pull-right"><?php 
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:about.inc.php


示例6: dbFetchRows

$graph_type = "toner_usage";
$toners = dbFetchRows("SELECT * FROM `toner` WHERE device_id = ?", array($device['device_id']));
if (count($toners)) {
    echo '<div class="row">
          <div class="col-md-12">
            <div class="panel panel-default panel-condensed">
              <div class="panel-heading">';
    echo '<a href="device/device=' . $device['device_id'] . '/tab=toner/">';
    echo "<img src='images/icons/toner.png'> Toner</a>";
    echo '</div>
        <table class="table table-hover table-condensed table-striped">';
    foreach ($toners as $toner) {
        $percent = round($toner['toner_current'], 0);
        $total = formatStorage($toner['toner_size']);
        $free = formatStorage($toner['toner_free']);
        $used = formatStorage($toner['toner_used']);
        $background = toner2colour($toner['toner_descr'], $percent);
        $graph_array = array();
        $graph_array['height'] = "100";
        $graph_array['width'] = "210";
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $toner['toner_id'];
        $graph_array['type'] = $graph_type;
        $graph_array['from'] = $config['time']['day'];
        $graph_array['legend'] = "no";
        $link_array = $graph_array;
        $link_array['page'] = "graphs";
        unset($link_array['height'], $link_array['width'], $link_array['legend']);
        $link = generate_url($link_array);
        $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - " . $toner['toner_descr']);
        $graph_array['width'] = 80;
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:toner.inc.php


示例7: preg_replace

     $drive["storage_descr"] = preg_replace("/.*mounted on: (.*)/", "\\1", $drive["storage_descr"]);
 }
 if ($drive['os'] == "freebsd") {
     foreach ($config['ignore_bsd_os_drives'] as $jdrive) {
         if (preg_match($jdrive, $drive["storage_descr"])) {
             $skipdrive = 1;
         }
     }
 }
 if ($skipdrive) {
     continue;
 }
 $perc = round($drive['storage_perc'], 0);
 $total = formatStorage($drive['storage_size']);
 $free = formatStorage($drive['storage_free']);
 $used = formatStorage($drive['storage_used']);
 $graph_array['type'] = $graph_type;
 $graph_array['id'] = $drive['storage_id'];
 $graph_array['from'] = $config['time']['day'];
 $graph_array['to'] = $config['time']['now'];
 $graph_array['height'] = "20";
 $graph_array['width'] = "80";
 $graph_array_zoom = $graph_array;
 $graph_array_zoom['height'] = "150";
 $graph_array_zoom['width'] = "400";
 $link = "graphs/id=" . $graph_array['id'] . "/type=" . $graph_array['type'] . "/from=" . $graph_array['from'] . "/to=" . $graph_array['to'] . "/";
 $mini_graph = overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
 $background = get_percentage_colours($perc);
 echo "<tr class='health'><td>" . generate_device_link($drive) . "</td><td class=tablehead>" . $drive['storage_descr'] . "</td>\n         <td>{$mini_graph}</td>\n         <td>\n          <a href='#' {$store_popup}>" . print_percentage_bar(400, 20, $perc, "{$used} / {$total}", "ffffff", $background['left'], $free, "ffffff", $background['right']) . "</a>\n          </td><td>{$perc}" . "%</td></tr>";
 if ($vars['view'] == "graphs") {
     echo "<tr></tr><tr class='health'><td colspan=5>";
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:31,代码来源:storage.inc.php


示例8: print_vars

        print_vars($storage);
    }
    if ($storage['size']) {
        $percent = round($storage['used'] / $storage['size'] * 100, 2);
    } else {
        $percent = 0;
    }
    $hc = $storage['storage_hc'] ? ' (HC)' : '';
    print_message("存储 " . $storage['storage_descr'] . ': ' . $percent . '%%' . $hc);
    // Update StatsD/Carbon
    if ($config['statsd']['enable'] == TRUE) {
        StatsD::gauge(str_replace(".", "_", $device['hostname']) . '.' . 'storage' . '.' . $storage['storage_mib'] . "-" . safename($storage['storage_descr']) . ".used", $storage['used']);
        StatsD::gauge(str_replace(".", "_", $device['hostname']) . '.' . 'storage' . '.' . $storage['storage_mib'] . "-" . safename($storage['storage_descr']) . ".free", $storage['free']);
    }
    // Update RRD
    rrdtool_update($device, $storage_rrd, "N:" . $storage['used'] . ":" . $storage['free']);
    if (!is_numeric($storage['storage_polled'])) {
        dbInsert(array('storage_id' => $storage['storage_id'], 'storage_polled' => time(), 'storage_used' => $storage['used'], 'storage_free' => $storage['free'], 'storage_size' => $storage['size'], 'storage_units' => $storage['units'], 'storage_perc' => $percent), 'storage-state');
    } else {
        $update = dbUpdate(array('storage_polled' => time(), 'storage_used' => $storage['used'], 'storage_free' => $storage['free'], 'storage_size' => $storage['size'], 'storage_units' => $storage['units'], 'storage_perc' => $percent), 'storage-state', '`storage_id` = ?', array($storage['storage_id']));
        if ($storage_size != $storage['storage_size']) {
            log_event('存储容量变更: ' . formatStorage($storage_size) . ' -> ' . formatStorage($storage['storage_size']) . ' (' . $storage['storage_descr'] . ')', $device, 'storage', $storage['storage_id']);
        }
    }
    $graphs['storage'] = TRUE;
    // Check alerts
    check_entity('storage', $storage, array('storage_perc' => $percent, 'storage_free' => $storage['free'], 'storage_used' => $storage['used']));
    echo PHP_EOL;
}
unset($storage);
// EOF
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:storage.inc.php


示例9: formatStorage

                </tr>
                <tr>
                  <th>Cached</th><td><?php 
    echo formatStorage($cachesize);
    ?>
</td>
                </tr>
                <tr>
                  <th>Page</th><td><?php 
    echo formatStorage($fullsize);
    ?>
</td>
                </tr>
                <tr>
                  <th>Peak</th><td><?php 
    echo formatStorage(memory_get_peak_usage());
    ?>
</td>
                </tr>
              </table>
            </div>
          </li>

<?php 
    if ($config['profile_sql'] == TRUE && ($SESSION['userlevel'] = '10')) {
        ?>
          <li class="dropdown">
            <a href="<?php 
        echo generate_url(array('page' => 'overview'));
        ?>
" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown">
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:index.php


示例10: unset

  $graph_array['legend'] = "no";
  $link_array = $graph_array;
  $link_array['page'] = "graphs";
  unset($link_array['height'], $link_array['width'], $link_array['legend']);
  $link_graph = generate_url($link_array);
  $link = generate_url(array("page" => "device", "device" => $storage['device_id'], "tab" => "health", "metric" => 'storage'));
  $overlib_content = generate_overlib_content($graph_array, $storage['hostname'] . " - " . htmlentities($storage['storage_descr']), NULL);
  $graph_array['width'] = 80;
  $graph_array['height'] = 20;
  $graph_array['bg'] = 'ffffff00';
  # the 00 at the end makes the area transparent.
  $graph_array['from'] = $config['time']['day'];
  $mini_graph = generate_graph_tag($graph_array);
  $total = formatStorage($storage['storage_size']);
  $used = formatStorage($storage['storage_used']);
  $free = formatStorage($storage['storage_free']);
  $background = get_percentage_colours($storage['storage_perc']);
  echo '<tr class="' . $storage['html_row_class'] . '">
      <td class="entity">' . generate_device_link($storage) . '</td>
      <td>' . overlib_link($link, htmlentities($storage['storage_descr']), $overlib_content) . '</td>
      <td>' . $total . '</td>
      <td>' . $used . '</td>
      <td>' . $free . '</td>
      <td>' . overlib_link($link_graph, $mini_graph, $overlib_content) . '</td>
      <td><a href="' . $link_graph . '">
        ' . print_percentage_bar(400, 20, $storage['storage_perc'], $storage['storage_perc'] . '%', "ffffff", $background['left'], 100 - $storage['storage_perc'] . "%", "ffffff", $background['right']) . '
        </a>
      </td>
    </tr>
 ';
  if ($vars['view'] == "graphs") {
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:storage.inc.php


示例11: transferOverview

function transferOverview($bill_id, $history)
{
    global $list_colour_a, $list_colour_b, $config;
    $i = 0;
    $tot = array();
    $traf = array();
    $start = $history['timestampfrom'];
    $end = $history['timestampto'];
    // $background= $history['background'];
    $res = '';
    $res .= '<table class="transferOverview">';
    $res .= '  <tr bgcolor="#000">';
    $res .= '    <th class="period">Date</th>';
    $res .= '    <th class="inbound">Inbound</th>';
    $res .= '    <th class="outbound">Outbound</th>';
    $res .= '    <th class="total">Total</th>';
    $res .= '  </tr>';
    foreach (dbFetch('SELECT DISTINCT UNIX_TIMESTAMP(timestamp) as timestamp, SUM(delta) as traf_total, SUM(in_delta) as traf_in, SUM(out_delta) as traf_out FROM bill_data WHERE `bill_id`= ? AND `timestamp` >= FROM_UNIXTIME(?) AND `timestamp` <= FROM_UNIXTIME(?) GROUP BY DATE(timestamp) ORDER BY timestamp ASC', array($bill_id, $start, $end)) as $data) {
        $date = strftime('%A, %e %B %Y', $data['timestamp']);
        $tot['in'] += gbConvert($data['traf_in']);
        $tot['out'] += gbConvert($data['traf_out']);
        $tot['tot'] += gbConvert($data['traf_total']);
        $traf['in'] = formatStorage(gbConvert($data['traf_in']), '3');
        $traf['out'] = formatStorage(gbConvert($data['traf_out']), '3');
        $traf['tot'] = formatStorage(gbConvert($data['traf_total']), '3');
        $row_colour = !is_integer($i / 2) ? $list_colour_a : $list_colour_b;
        $res .= '  <tr bgcolor="' . $row_colour . '">';
        $res .= '    <td>' . $date . '</td>';
        $res .= '    <td class="right">' . $traf['in'] . '</td>';
        $res .= '    <td class="right">' . $traf['out'] . '</td>';
        $res .= '    <td class="right">' . $traf['tot'] . '</td>';
        $res .= '  </tr>';
        $i++;
    }
    $tot['in'] = formatStorage($tot['in']);
    $tot['out'] = formatStorage($tot['out']);
    $tot['tot'] = formatStorage($tot['tot']);
    $res .= '  <tr bgcolor="#ccc" style="border-top: 1px solid #000;">';
    $res .= '    <td></td>';
    $res .= '    <td class="right"><b>' . $tot['in'] . '</b></td>';
    $res .= '    <td class="right"><b>' . $tot['out'] . '</b></td>';
    $res .= '    <td class="right"><b>' . $tot['tot'] . '</b></td>';
    $res .= '  </tr>';
    $res .= '</table>';
    return $res;
}
开发者ID:samyscoub,项目名称:librenms,代码行数:46,代码来源:pdf_history.inc.php


示例12: print_vars

        print_vars($storage);
    }
    if ($storage['size']) {
        $percent = round($storage['used'] / $storage['size'] * 100, 2);
    } else {
        $percent = 0;
    }
    $hc = $storage['storage_hc'] ? ' (HC)' : '';
    print_message("Storage " . $storage['storage_descr'] . ': ' . $percent . '%%' . $hc);
    // Update StatsD/Carbon
    if ($config['statsd']['enable'] == TRUE) {
        StatsD::gauge(str_replace(".", "_", $device['hostname']) . '.' . 'storage' . '.' . $storage['storage_mib'] . "-" . safename($storage['storage_descr']) . ".used", $storage['used']);
        StatsD::gauge(str_replace(".", "_", $device['hostname']) . '.' . 'storage' . '.' . $storage['storage_mib'] . "-" . safename($storage['storage_descr']) . ".free", $storage['free']);
    }
    // Update RRD
    rrdtool_update($storage_rrd, "N:" . $storage['used'] . ":" . $storage['free']);
    if (!is_numeric($storage['storage_polled'])) {
        dbInsert(array('storage_id' => $storage['storage_id'], 'storage_polled' => time(), 'storage_used' => $storage['used'], 'storage_free' => $storage['free'], 'storage_size' => $storage['size'], 'storage_units' => $storage['units'], 'storage_perc' => $percent), 'storage-state');
    } else {
        $update = dbUpdate(array('storage_polled' => time(), 'storage_used' => $storage['used'], 'storage_free' => $storage['free'], 'storage_size' => $storage['size'], 'storage_units' => $storage['units'], 'storage_perc' => $percent), 'storage-state', '`storage_id` = ?', array($storage['storage_id']));
        if ($storage_size != $storage['storage_size']) {
            log_event('Storage size changed: ' . formatStorage($storage_size) . ' -> ' . formatStorage($storage['storage_size']) . ' (' . $storage['storage_descr'] . ')', $device, 'storage', $storage['storage_id']);
        }
    }
    $graphs['storage'] = TRUE;
    // Check alerts
    check_entity('storage', $storage, array('storage_perc' => $percent, 'storage_free' => $storage['free']));
    echo PHP_EOL;
}
unset($storage);
// EOF
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:storage.inc.php


示例13: generate_mempool_row

function generate_mempool_row($mempool, $vars)
{
    global $config;
    $table_cols = 7;
    if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
        $table_cols++;
    }
    // Add a column for device.
    $graph_array = array();
    $graph_array['to'] = $config['time']['now'];
    $graph_array['id'] = $mempool['mempool_id'];
    $graph_array['type'] = "mempool_usage";
    $graph_array['legend'] = "no";
    $link_array = $graph_array;
    $link_array['page'] = "graphs";
    unset($link_array['height'], $link_array['width'], $link_array['legend']);
    $link_graph = generate_url($link_array);
    $link = generate_url(array("page" => "device", "device" => $mempool['device_id'], "tab" => "health", "metric" => 'mempool'));
    $overlib_content = generate_overlib_content($graph_array, $mempool['hostname'] . " - " . $mempool['mempool_descr']);
    $graph_array['width'] = 80;
    $graph_array['height'] = 20;
    $graph_array['bg'] = 'ffffff00';
    $graph_array['from'] = $config['time']['day'];
    $mini_graph = generate_graph_tag($graph_array);
    if ($mempool['mempool_total'] != '100') {
        $total = formatStorage($mempool['mempool_total']);
        $used = formatStorage($mempool['mempool_used']);
        $free = formatStorage($mempool['mempool_free']);
    } else {
        // If total == 100, than memory not have correct size and uses percents only
        $total = $mempool['mempool_total'] . '%';
        $used = $mempool['mempool_used'] . '%';
        $free = $mempool['mempool_free'] . '%';
    }
    $background = get_percentage_colours($mempool['mempool_perc']);
    $mempool['html_row_class'] = $background['class'];
    $row .= '<tr class="' . $mempool['html_row_class'] . '">
            <td class="state-marker"></td>';
    if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
        $row .= '<td class="entity">' . generate_device_link($mempool) . '</td>';
    }
    $row .= '<td class="entity">' . generate_entity_link('mempool', $mempool) . '</td>
        <td>' . overlib_link($link_graph, $mini_graph, $overlib_content) . '</td>
        <td><a href="' . $link_graph . '">
          ' . print_percentage_bar(400, 20, $mempool['mempool_perc'], $used . '/' . $total . ' (' . $mempool['mempool_perc'] . '%)', "ffffff", $background['left'], $free . ' (' . (100 - $mempool['mempool_perc']) . '%)', "ffffff", $background['right']) . '
          </a>
        </td>
        <td>' . $mempool['mempool_perc'] . '%</td>
      </tr>
   ';
    if ($vars['view'] == "graphs") {
        $vars['graph'] = "usage";
    }
    if ($vars['graph']) {
        $row .= '<tr class="' . $mempool['html_row_class'] . '">';
        $row .= '<td class="state-marker"></td>';
        $row .= '<td colspan="' . $table_cols . '">';
        unset($graph_array['height'], $graph_array['width'], $graph_array['legend']);
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $mempool['mempool_id'];
        $graph_array['type'] = 'mempool_' . $vars['graph'];
        print_graph_row($graph_array, TRUE);
        $row .= '</td></tr>';
    }
    # endif graphs
    return $row;
}
开发者ID:Natolumin,项目名称:observium,代码行数:67,代码来源:mempool.inc.php


示例14: safename

        StatsD::gauge(str_replace(".", "_", $device['hostname']) . '.' . 'storage' . '.' . $storage['storage_mib'] . "-" . safename($storage['storage_descr']) . ".used", $storage['used']);
        StatsD::gauge(str_replace(".", "_", $device['hostname']) . '.' . 'storage' . '.' . $storage['storage_mib'] . "-" . safename($storage['storage_descr']) . ".free", $storage['free']);
    }
    // Update RRD
    rrdtool_update_ng($device, 'storage', array('used' => $storage['used'], 'free' => $storage['free']), $storage['storage_mib'] . "-" . $storage['storage_descr']);
    if (!is_numeric($storage['storage_polled'])) {
        dbInsert(array('storage_id' => $storage['storage_id'], 'storage_polled' => time(), 'storage_used' => $storage['used'], 'storage_free' => $storage['free'], 'storage_size' => $storage['size'], 'storage_units' => $storage['units'], 'storage_perc' => $percent), 'storage-state');
    } else {
        $update = dbUpdate(array('storage_polled' => time(), 'storage_used' => $storage['used'], 'storage_free' => $storage['free'], 'storage_size' => $storage['size'], 'storage_units' => $storage['units'], 'storage_perc' => $percent), 'storage-state', '`storage_id` = ?', array($storage['storage_id']));
        if ($storage_size != $storage['storage_size']) {
            log_event('Storage size changed: ' . formatStorage($storage_size) . ' -> ' . formatStorage($storage['storage_size']) . ' (' . $storage['storage_descr'] . ')', $device, 'storage', $storage['storage_id']);
        }
    }
    $graphs['storage'] = TRUE;
    // Check alerts
    check_entity('storage', $storage, array('storage_perc' => $percent, 'storage_free' => $storage['free'], 'storage_used' => $storage['used']));
    $table_row = array();
    $table_row[] = $storage['storage_descr'];
    $table_row[] = $storage['storage_mib'];
    $table_row[] = $storage['storage_index'];
    $table_row[] = formatStorage($storage['size']);
    $table_row[] = formatStorage($storage['used']);
    $table_row[] = formatStorage($storage['free']);
    $table_row[] = $percent . '%';
    $table_rows[] = $table_row;
    unset($table_row);
}
$headers = array('%WLabel%n', '%WType%n', '%WIndex%n', '%WTotal%n', '%WUsed%n', '%WFree%n', '%WPerc%n');
print_cli_table($table_rows, $headers);
unset($storage, $table, $table_row, $table_rows);
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:storage.inc.php


示例15: foreach

    $sort = '`D`.`hostname`, `M`.`mempool_descr`';
}
$sql .= " ORDER BY {$sort}";
if (isset($current)) {
    $limit_low = $current * $rowCount - $rowCount;
    $limit_high = $rowCount;
}
if ($rowCount != -1) {
    $sql .= " LIMIT {$limit_low},{$limit_high}";
}
$sql = "SELECT * {$sql}";
foreach (dbFetchRows($sql, $param) as $mempool) {
    $perc = round($mempool['mempool_perc'], 0);
    $total = formatStorage($mempool['mempool_total']);
    $free = formatStorage($mempool['mempool_free']);
    $used = formatStorage($mempool['mempool_used']);
    $graph_array['type'] = $graph_type;
    $graph_array['id'] = $mempool['mempool_id'];
    $graph_array['from'] = $config['time']['day'];
    $graph_array['to'] = $config['time']['now'];
    $graph_array['height'] = "20";
    $graph_array['width'] = "80";
    $graph_array_zoom = $graph_array;
    $graph_array_zoom['height'] = "150";
    $graph_array_zoom['width'] = "400";
    $link = "graphs/id=" . $graph_array['id'] . "/type=" . $graph_array['type'] . "/from=" . $graph_array['from'] . "/to=" . $graph_array['to'] . "/";
    $mini_graph = overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
    $background = get_percentage_colours($perc);
    $bar_link = overlib_link($link, print_percentage_bar(400, 20, $perc, "{$used} / {$total}", "ffffff", $background['left'], $free, "ffffff", $background['right']), generate_graph_tag($graph_array_zoom), NULL);
    $response[] = array('hostname' => generate_device_link($mempool), 'mempool_descr' => $mempool['mempool_descr'], 'graph' => $mini_graph, 'mempool_used' => $bar_link, 'mempool_perc' => $perc . "%");
    if ($_POST['view'] == "graphs") {
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:mempool.inc.php


示例16: percentage_bar

            <tr>
              <td colspan="7">
                <?php 
    echo percentage_bar($percentage_bar);
    ?>
              </td>
            </tr>
            <tr class="small">
              <td><i style="font-size: 7px; line-height: 7px; background-color: #EE9955; border: 1px #aaa solid;">&nbsp;&nbsp;&nbsp;</i> Used</td>
              <td><?php 
    echo formatStorage($memory_used) . ' (' . $memory_used_perc . '%)';
    ?>
</td>
              <td><i style="font-size: 7px; line-height: 7px; background-color: #f0e0a0; border: 1px #aaa solid;">&nbsp;&nbsp;&nbsp;</i> Cached</td>
              <td><?php 
    echo formatStorage($app_data['memory']['cache']) . ' (' . $memory_cached_perc . '%)';
    ?>
</td>
              <td><i style="font-size: 7px; line-height: 7px; background-color: #f0f0f0; border: 1px #aaa solid;">&nbsp;&nbsp;&nbsp;</i> Free</td>
              <td><?php 
    echo formatStorage($memory_free) . ' (' . $memory_free_perc . '%)';
    ?>
</td>
            </tr>
          </table>
        </div>
      </div>
<?php 
}
unset($percentage_bar, $graph_array, $overlib_content, $graph, $link, $link_array);
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:memory.inc.php


示例17: file_put_contents

 //end foreach
 if ($config['debug_port'][$port['port_id']]) {
     $port_debug = $port['port_id'] . '|' . $polled . '|' . $polled_period . '|' . $this_port['ifHCInOctets'] . '|' . $this_port['ifHCOutOctets'];
     $port_debug .= '|' . $port['stats']['ifInOctets_rate'] . '|' . $port['stats']['ifOutOctets_rate'] . "\n";
     file_put_contents('/tmp/port_debug.txt', $port_debug, FILE_APPEND);
     echo 'Wrote port debugging data';
 }
 $port['stats']['ifInBits_rate'] = round($port['stats']['ifInOctets_rate'] * 8);
 $port['stats']['ifOutBits_rate'] = round($port['stats']['ifOutOctets_rate'] * 8);
 // If we have a valid ifSpeed we should populate the stats for checking.
 if (is_numeric($this_port['ifSpeed'])) {
     $port['stats']['ifInBits_perc'] = round($port['stats']['ifInBits_rate'] / $this_port['ifSpeed'] * 100);
     $port['stats']['ifOutBits_perc'] = round($port['stats']['ifOutBits_rate'] / $this_port['ifSpeed'] * 100);
 }
 echo 'bps(' . formatRates($port['stats']['ifInBits_rate']) . '/' . formatRates($port['stats']['ifOutBits_rate']) . ')';
 echo 'bytes(' . formatStorage($port['stats']['ifInOctets_diff']) . '/' . formatStorage($port['stats']['ifOutOctets_diff']) . ')';
 echo 'pkts(' . format_si($port['stats']['ifInUcastPkts_rate']) . 'pps/' . format_si($port['stats']['ifOutUcastPkts_rate']) . 'pps)';
 // Port utilisation % threshold alerting. // FIXME allow setting threshold per-port. probably 90% of ports we don't care about.
 if ($config['alerts']['port_util_alert'] && $port['ignore'] == '0') {
     // Check for port saturation of $config['alerts']['port_util_perc'] or higher.  Alert if we see this.
     // Check both inbound and outbound rates
     $saturation_threshold = $this_port['ifSpeed'] * ($config['alerts']['port_util_perc'] / 100);
     echo 'IN: ' . $port['stats']['ifInBits_rate'] . ' OUT: ' . $port['stats']['ifOutBits_rate'] . ' THRESH: ' . $saturation_threshold;
     if (($port['stats']['ifInBits_rate'] >= $saturation_threshold || $port['stats']['ifOutBits_rate'] >= $saturation_threshold) && $saturation_threshold > 0) {
         log_event('Port reached saturation threshold: ' . formatRates($port['stats']['ifInBits_rate']) . '/' . formatRates($port['stats']['ifOutBits_rate']) . ' - ifspeed: ' . formatRates($this_port['stats']['ifSpeed']), $device, 'interface', $port['port_id']);
     }
 }
 // Update RRDs
 $rrdfile = $host_rrd . '/port-' . safename($port['ifIndex'] . '.rrd');
 if (!is_file($rrdfile)) {
     rrdtool_create($rrdfile, ' --step 300 
开发者ID:MACscr,项目名称:librenms,代码行数:31,代码来源:ports.inc.php


示例18: generate_storage_row

function generate_storage_row($storage, $vars)
{
    global $config;
    $table_cols = 8;
    if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
        $table_cols++;
    }
    // Add a column for device.
    $graph_array = array();
    $graph_array['to'] = $config['time']['now'];
    $graph_array['id'] = $storage['storage_id'];
    $graph_array['type'] = 'storage_usage';
    $graph_array['legend'] = "no";
    $link_array = $graph_array;
    $link_array['page'] = "graphs";
    unset($link_array['height'], $link_array['width'], $link_array['legend']);
    $link_graph = generate_url($link_array);
    $link = generate_url(array("page" => "device", "device" => $storage['device_id'], "tab" => "health", "metric" => 'storage'));
    $overlib_content = generate_overlib_content($graph_array, $storage['hostname'] . ' - ' . $storage['storage_descr']);
    $graph_array['width'] = 80;
    $graph_array['height'] = 20;
    $graph_array['bg'] = 'ffffff00';
    $graph_array['from'] = $config['time']['day'];
    $mini_graph = generate_graph_tag($graph_array);
    $total = formatStorage($storage['storage_size']);
    $used = formatStorage($storage['storage_used']);
    $free = formatStorage($storage['storage_free']);
    $background = get_percentage_colours($storage['storage_perc']);
    if ($storage['storage_ignore']) {
        $storage['row_class'] = 'suppressed';
    } else {
        $storage['row_class'] = $background['class'];
    }
    $row .= '<tr class="ports ' . $storage['row_class'] . '">
          <td class="state-marker"></td>';
    if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
        $row .= '<td class="entity">' . generate_device_link($storage) . '</td>';
    }
    $row .= '  <td class="entity">' . generate_entity_link('storage', $storage) . '</td>
      <td>' . $total . '</td>
      <td>' . $used . '</td>
      <td>' . $free . '</td>
      <td>' . overlib_link($link_graph, $mini_graph, $overlib_content) . '</td>
      <td><a href="' . $link_graph . '">
        ' . print_percentage_bar(400, 20, $storage['storage_perc'], $storage['storage_perc'] . '%', "ffffff", $background['left'], 100 - $storage['storage_perc'] . "%", "ffffff", $background['right']) . '
        </a>
      </td>
    </tr>
  ';
    if ($vars['view'] == "graphs") {
        $vars['graph'] = "usage";
    }
    if ($vars['graph']) {
        echo '<tr class="' . $storage['row_class'] . '">';
        echo '<td class="state-marker"></td>';
        echo '<td colspan="' . $table_cols . '">';
        unset($graph_array['height'], $graph_array['width'], $graph_array['legend']);
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $storage['storage_id'];
        $graph_array['type'] = 'storage_' . $vars['graph'];
        print_graph_row($g 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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