本文整理汇总了PHP中get_port_rrdfile_path函数的典型用法代码示例。如果您正苦于以下问题:PHP get_port_rrdfile_path函数的具体用法?PHP get_port_rrdfile_path怎么用?PHP get_port_rrdfile_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_port_rrdfile_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_port_rrdfile_path
<?php
$rrd_filename = get_port_rrdfile_path($device['hostname'], $port['port_id'], 'adsl');
$rrd_list[0]['filename'] = $rrd_filename;
$rrd_list[0]['descr'] = 'Downstream';
$rrd_list[0]['ds'] = 'AturCurrAtn';
$rrd_list[1]['filename'] = $rrd_filename;
$rrd_list[1]['descr'] = 'Upstream';
$rrd_list[1]['ds'] = 'AtucCurrAtn';
$unit_text = 'dB';
$units = '';
$total_units = '';
$colours = 'mixed';
$scale_min = '0';
$nototal = 1;
if ($rrd_list) {
include 'includes/graphs/generic_multi_line.inc.php';
}
开发者ID:awlx,项目名称:librenms,代码行数:18,代码来源:adsl_attenuation.inc.php
示例2: delete_port
function delete_port($int_id)
{
global $config;
$interface = dbFetchRow("SELECT * FROM `ports` AS P, `devices` AS D WHERE P.port_id = ? AND D.device_id = P.device_id", array($int_id));
$interface_tables = array('adjacencies', 'ipaddr', 'ip6adjacencies', 'ip6addr', 'mac_accounting', 'bill_ports', 'pseudowires', 'ports');
foreach ($interface_tables as $table) {
dbDelete($table, "`port_id` = ?", array($int_id));
}
dbDelete('links', "`local_port_id` = ?", array($int_id));
dbDelete('links', "`remote_port_id` = ?", array($int_id));
dbDelete('bill_ports', "`port_id` = ?", array($int_id));
unlink(get_port_rrdfile_path($interface['hostname'], $interface['port_id']));
}
开发者ID:BillTheBest,项目名称:librenms,代码行数:13,代码来源:common.php
示例3: unset
$rrd_options .= ' DEF:inoctetsb' . $i . '=' . $rrd_file . ':' . $in . 'OCTETS:AVERAGE';
$rrd_options .= ' DEF:outoctetsb' . $i . '=' . $rrd_file . ':' . $out . 'OCTETS:AVERAGE';
$in_thingb .= $seperator . 'inoctetsb' . $i . ',UN,0,' . 'inoctetsb' . $i . ',IF';
$out_thingb .= $seperator . 'outoctetsb' . $i . ',UN,0,' . 'outoctetsb' . $i . ',IF';
$plusesb .= $plus;
$seperator = ',';
$plus = ',+';
$i++;
}
}
//end foreach
unset($seperator);
unset($plus);
foreach (explode(',', $_GET['idc']) as $ifid) {
$int = dbFetchRow('SELECT `hostname` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id', array($ifid));
$rrd_file = get_port_rrdfile_path($int['hostname'], $ifid);
if (is_file($rrd_file)) {
if (strstr($inverse, 'c')) {
$in = 'OUT';
$out = 'IN';
} else {
$in = 'IN';
$out = 'OUT';
}
$rrd_options .= ' DEF:inoctetsc' . $i . '=' . $rrd_file . ':' . $in . 'OCTETS:AVERAGE';
$rrd_options .= ' DEF:outoctetsc' . $i . '=' . $rrd_file . ':' . $out . 'OCTETS:AVERAGE';
$in_thingc .= $seperator . 'inoctetsc' . $i . ',UN,0,' . 'inoctetsc' . $i . ',IF';
$out_thingc .= $seperator . 'outoctetsc' . $i . ',UN,0,' . 'outoctetsc' . $i . ',IF';
$plusesc .= $plus;
$seperator = ',';
$plus = ',+';
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:bits_trio.inc.php
示例4: rrdtool_pipe_open
#!/usr/bin/env php
<?php
require 'includes/defaults.inc.php';
require 'config.php';
require 'includes/definitions.inc.php';
require 'includes/functions.php';
rrdtool_pipe_open($rrd_process, $rrd_pipes);
$options = getopt('h:p:');
$hosts = str_replace('*', '%', mres($options['h']));
$ports = str_replace('*', '%', mres($options['p']));
if (empty($hosts) && empty($ports)) {
echo "-h <device hostname wildcard> Device(s) to match\n";
echo "-p <ifName widcard> Port(s) to match using ifName\n";
echo "\n";
}
foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` WHERE `hostname` LIKE ?", array('%' . $hosts . '%')) as $device) {
echo "Found hostname " . $device['hostname'] . ".......\n";
foreach (dbFetchRows("SELECT `port_id`,`ifIndex`,`ifName`,`ifSpeed` FROM `ports` WHERE `ifName` LIKE ? AND `device_id` = ?", array('%' . $ports . '%', $device['device_id'])) as $port) {
echo "Tuning port " . $port['ifName'] . ".......\n";
$rrdfile = get_port_rrdfile_path($device['hostname'], $port['port_id']);
rrdtool_tune('port', $rrdfile, $port['ifSpeed']);
}
}
开发者ID:pblasquez,项目名称:librenms,代码行数:23,代码来源:tune_port.php
示例5: safename
<?php
if ($this_port['dot3StatsIndex'] and $port['ifType'] == 'ethernetCsmacd') {
// TODO: remove legacy check?
$old_rrdfile = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('etherlike-' . $port['ifIndex'] . '.rrd');
$rrd_file = get_port_rrdfile_path($device['hostname'], $port_id, 'dot3');
$rrd_create = $config['rrd_rra'];
if (!file_exists($rrdfile)) {
if (file_exists($old_rrdfile)) {
rename($old_rrdfile, $rrd_file);
} else {
foreach ($etherlike_oids as $oid) {
$oid = truncate(str_replace('dot3Stats', '', $oid), 19, '');
$rrd_create .= " DS:{$oid}:COUNTER:600:U:100000000000";
}
rrdtool_create($rrdfile, $rrd_create);
}
}
$fields = array();
foreach ($etherlike_oids as $oid) {
$data = $this_port[$oid] + 0;
$fields[$oid] = $data;
}
rrdtool_update($rrdfile, $fields);
$tags = array('ifName' => $port['ifName']);
influx_update($device, 'dot3', $tags, $fields);
echo 'EtherLike ';
}
开发者ID:greggcz,项目名称:librenms,代码行数:28,代码来源:port-etherlike.inc.php
示例6: get_port_rrdfile_path
// adslAturChanCurrTxRate.1 = 512000 bps
// adslAturChanPrevTxRate.1 = 0 bps
// adslAtucPerfLofs.1 = 0
// adslAtucPerfLoss.1 = 0
// adslAtucPerfLols.1 = 0
// adslAtucPerfLprs.1 = 0
// adslAtucPerfESs.1 = 0
// adslAtucPerfInits.1 = 1
// adslAtucPerfValidIntervals.1 = 0
// adslAtucPerfInvalidIntervals.1 = 0
// adslAturPerfLoss.1 = 0 seconds
// adslAturPerfESs.1 = 0 seconds
// adslAturPerfValidIntervals.1 = 0
// adslAturPerfInvalidIntervals.1 = 0
if (isset($this_port['adslLineCoding'])) {
$rrdfile = get_port_rrdfile_path($device['hostname'], $port_id, 'adsl');
$rrd_create = ' --step 300';
$rrd_create .= ' DS:AtucCurrSnrMgn:GAUGE:600:0:635';
$rrd_create .= ' DS:AtucCurrAtn:GAUGE:600:0:635';
$rrd_create .= ' DS:AtucCurrOutputPwr:GAUGE:600:0:635';
$rrd_create .= ' DS:AtucCurrAttainableR:GAUGE:600:0:U';
$rrd_create .= ' DS:AtucChanCurrTxRate:GAUGE:600:0:U';
$rrd_create .= ' DS:AturCurrSnrMgn:GAUGE:600:0:635';
$rrd_create .= ' DS:AturCurrAtn:GAUGE:600:0:635';
$rrd_create .= ' DS:AturCurrOutputPwr:GAUGE:600:0:635';
$rrd_create .= ' DS:AturCurrAttainableR:GAUGE:600:0:U';
$rrd_create .= ' DS:AturChanCurrTxRate:GAUGE:600:0:U';
$rrd_create .= ' DS:AtucPerfLofs:COUNTER:600:U:100000000000';
$rrd_create .= ' DS:AtucPerfLoss:COUNTER:600:U:100000000000';
$rrd_create .= ' DS:AtucPerfLprs:COUNTER:600:U:100000000000';
$rrd_create .= ' DS:AtucPerfESs:COUNTER:600:U:100000000000';
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:port-adsl.inc.php
示例7: unset
$done = 'yes';
unset($class);
$port['ifAlias'] = str_ireplace($type . ': ', '', $port['ifAlias']);
$port['ifAlias'] = str_ireplace('[PNI]', 'Private', $port['ifAlias']);
$ifclass = ifclass($port['ifOperStatus'], $port['ifAdminStatus']);
if ($bg == '#ffffff') {
$bg = '#e5e5e5';
} else {
$bg = '#ffffff';
}
echo "<tr class='iftype'>\n <td><span class=list-large>" . generate_port_link($port, $port['port_descr_descr']) . "</span><br />\n <span class=interface-desc style='float: left;'>" . generate_device_link($port) . ' ' . generate_port_link($port) . ' </span></td>
<td>' . generate_port_link($port, makeshortif($port['ifDescr'])) . '</td>
<td>' . $port['port_descr_speed'] . '</td>
<td>' . $port['port_descr_circuit'] . '</td>
<td>' . $port['port_descr_notes'] . "</td>\n </tr>\n <tr class='iftype'>\n <td colspan='5'";
if (dbFetchCell('SELECT count(*) FROM mac_accounting WHERE port_id = ?', array($port['port_id']))) {
echo "<span style='float: right;'><a href='" . generate_url(array('page' => 'device', 'device' => $port['device_id'], 'tab' => 'port', 'port' => $port['port_id'], 'view' => 'macaccounting')) . "'><img src='images/16/chart_curve.png' align='absmiddle'> MAC Accounting</a></span>";
}
echo '<br />';
if (file_exists(get_port_rrdfile_path($port['hostname'], $port['port_id']))) {
$graph_type = 'port_bits';
include 'includes/print-interface-graphs.inc.php';
}
echo '</td></tr>';
}
} else {
echo 'None found.</td></tr>';
}
?>
</table>
开发者ID:greggcz,项目名称:librenms,代码行数:30,代码来源:iftype.inc.php
示例8:
<?php
if (file_exists(get_port_rrdfile_path($device['hostname'], $port['port_id'], 'adsl'))) {
$iid = $id;
echo '<div class=graphhead>ADSL Line Speed</div>';
$graph_type = 'port_adsl_speed';
include 'includes/print-interface-graphs.inc.php';
echo '<div class=graphhead>ADSL Line Attenuation</div>';
$graph_type = 'port_adsl_attenuation';
include 'includes/print-interface-graphs.inc.php';
echo '<div class=graphhead>ADSL Line SNR Margin</div>';
$graph_type = 'port_adsl_snr';
include 'includes/print-interface-graphs.inc.php';
echo '<div class=graphhead>ADSL Output Powers</div>';
$graph_type = 'port_adsl_power';
include 'includes/print-interface-graphs.inc.php';
}
开发者ID:greggcz,项目名称:librenms,代码行数:17,代码来源:adsl.inc.php
示例9: foreach
$ignore = 0;
if (is_array($config['device_traffic_iftype'])) {
foreach ($config['device_traffic_iftype'] as $iftype) {
if (preg_match($iftype . 'i', $port['ifType'])) {
$ignore = 1;
}
}
}
if (is_array($config['device_traffic_descr'])) {
foreach ($config['device_traffic_descr'] as $ifdescr) {
if (preg_match($ifdescr . 'i', $port['ifDescr']) || preg_match($ifdescr . 'i', $port['ifName']) || preg_match($ifdescr . 'i', $port['portName'])) {
$ignore = 1;
}
}
}
$rrd_filename = get_port_rrdfile_path($port['hostname'], $port['port_id']);
if (!$ignore && $i < 1100 && is_file($rrd_filename)) {
$rrd_filenames[] = $rrd_filename;
$rrd_list[$i]['filename'] = $rrd_filename;
// $rrd_list[$i]['descr'] = $port['device_id'] . " " . $port['ifDescr'];
$rrd_list[$i]['descr'] = 'dev' . $port['device_id'] . 'if' . $port['ifIndex'];
$rrd_list[$i]['rra_in'] = $rra_in;
$rrd_list[$i]['rra_out'] = $rra_out;
$i++;
}
unset($ignore);
}
//end foreach
$units = 'bps';
$total_units = 'B';
$colours_in = 'greens';
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:bits.inc.php
示例10: get_port_by_index_cache
$this_port = get_port_by_index_cache($device['device_id'], $higher_if['port_id_high']);
echo "{$br}<img src='images/16/arrow_divide.png' align=absmiddle> <strong>" . generate_port_link($this_port) . '</strong>';
$br = '<br />';
}
}
foreach (dbFetchRows('SELECT * FROM `ports_stack` WHERE `port_id_high` = ? and `device_id` = ?', array($port['ifIndex'], $device['device_id'])) as $lower_if) {
if ($lower_if['port_id_low']) {
$this_port = get_port_by_index_cache($device['device_id'], $lower_if['port_id_low']);
echo "{$br}<img src='images/16/arrow_join.png' align=absmiddle> <strong>" . generate_port_link($this_port) . '</strong>';
$br = '<br />';
}
}
}
//end if
unset($int_links, $int_links_v6, $int_links_v4, $int_links_phys, $br);
if ($nbLinks > 3) {
echo '</span></div>';
}
echo '</td></tr>';
// If we're showing graphs, generate the graph and print the img tags
if ($graph_type == 'etherlike') {
$graph_file = get_port_rrdfile_path($device['hostname'], $if_id, 'dot3');
} else {
$graph_file = get_port_rrdfile_path($device['hostname'], $if_id);
}
if ($graph_type && is_file($graph_file)) {
$type = $graph_type;
echo "<tr style='background-color: {$row_colour}; padding: 0px;'><td colspan=7>";
include 'includes/print-interface-graphs.inc.php';
echo '</td></tr>';
}
开发者ID:Tatermen,项目名称:librenms,代码行数:31,代码来源:print-interface.inc.php
示例11: delete_port
function delete_port($int_id)
{
$interface = dbFetchRow("SELECT * FROM `ports` AS P, `devices` AS D WHERE P.port_id = ? AND D.device_id = P.device_id", array($int_id));
$interface_tables = array('ipv4_addresses', 'ipv4_mac', 'ipv6_addresses', 'juniAtmVp', 'mac_accounting', 'ospf_nbrs', 'ospf_ports', 'ports', 'ports_adsl', 'ports_perms', 'ports_statistics', 'ports_stp', 'ports_vlans', 'pseudowires');
foreach ($interface_tables as $table) {
dbDelete($table, "`port_id` = ?", array($int_id));
}
dbDelete('links', "`local_port_id` = ? OR `remote_port_id` = ?", array($int_id, $int_id));
dbDelete('ports_stack', "`port_id_low` = ? OR `port_id_high` = ?", array($int_id, $int_id));
unlink(get_port_rrdfile_path($interface['hostname'], $interface['port_id']));
}
开发者ID:Rosiak,项目名称:librenms,代码行数:11,代码来源:common.php
示例12: get_port_assoc_mode_name
if ($device['port_association_mode']) {
$port_association_mode = get_port_assoc_mode_name($device['port_association_mode']);
}
// Build array of ports in the database and an ifIndex/ifName -> port_id map
$ports_mapped = get_ports_mapped($device['device_id']);
$ports_db = $ports_mapped['ports'];
//
// Rename any old RRD files still named after the previous ifIndex based naming schema.
foreach ($ports_mapped['maps']['ifIndex'] as $ifIndex => $port_id) {
foreach (array('', 'adsl', 'dot3') as $suffix) {
$suffix_tmp = '';
if ($suffix) {
$suffix_tmp = "-{$suffix}";
}
$old_rrd_path = trim($config['rrd_dir']) . '/' . $device['hostname'] . "/port-{$ifIndex}{$suffix_tmp}.rrd";
$new_rrd_path = get_port_rrdfile_path($device['hostname'], $port_id, $suffix);
if (is_file($old_rrd_path)) {
rename($old_rrd_path, $new_rrd_path);
}
}
}
// New interface detection
foreach ($port_stats as $ifIndex => $port) {
// Store ifIndex in port entry and prefetch ifName as we'll need it multiple times
$port['ifIndex'] = $ifIndex;
$ifName = $port['ifName'];
// Get port_id according to port_association_mode used for this device
$port_id = get_port_id($ports_mapped, $port, $port_association_mode);
if (is_port_valid($port, $device)) {
// Port newly discovered?
if (!is_array($ports_db[$port_id])) {
开发者ID:pheinrichs,项目名称:librenms,代码行数:31,代码来源:ports.inc.php
示例13: foreach
<?php
// Generate a list of ports and then call the multi_bits grapher to generate from the list
$i = 0;
foreach (dbFetchRows('SELECT * FROM `ports` WHERE `device_id` = ? AND `pagpGroupIfIndex` = ?', array($port['device_id'], $port['ifIndex'])) as $int) {
$rrd_file = get_port_rrdfile_path($hostname, int['port_id']);
if (is_file($rrd_file)) {
$rrd_list[$i]['filename'] = $rrd_file;
$rrd_list[$i]['descr'] = $int['ifDescr'];
$i++;
}
}
$units = 'bps';
$total_units = 'B';
$colours_in = 'greens';
$multiplier = '8';
$colours_out = 'blues';
$nototal = 1;
$ds_in = 'INOCTETS';
$ds_out = 'OUTOCTETS';
require 'includes/graphs/generic_multi_bits_separated.inc.php';
开发者ID:greggcz,项目名称:librenms,代码行数:21,代码来源:pagp_bits.inc.php
示例14:
$graph_type = 'port_upkts';
echo '<div class="panel-body">';
include 'includes/print-interface-graphs.inc.php';
echo '</div></div>';
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Interface Non Unicast</h3>
</div>';
$graph_type = 'port_nupkts';
echo '<div class="panel-body">';
include 'includes/print-interface-graphs.inc.php';
echo '</div></div>';
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Interface Errors</h3>
</div>';
$graph_type = 'port_errors';
echo '<div class="panel-body">';
include 'includes/print-interface-graphs.inc.php';
echo '</div></div>';
if (is_file(get_port_rrdfile_path($device['hostname'], $port['port_id'], 'dot3'))) {
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Ethernet Errors</h3>
</div>';
$graph_type = 'port_etherlike';
echo '<div class="panel-body">';
include 'includes/print-interface-graphs.inc.php';
echo '</div></div>';
}
}
开发者ID:Tatermen,项目名称:librenms,代码行数:31,代码来源:graphs.inc.php
示例15:
$graph_type = 'port_upkts';
echo '<div class="panel-body">';
include 'includes/print-interface-graphs.inc.php';
echo '</div></div>';
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Interface Non Unicast</h3>
</div>';
$graph_type = 'port_nupkts';
echo '<div class="panel-body">';
include 'includes/print-interface-graphs.inc.php';
echo '</div></div>';
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Interface Errors</h3>
</div>';
$graph_type = 'port_errors';
echo '<div class="panel-body">';
include 'includes/print-interface-graphs.inc.php';
echo '</div></div>';
if (rrdtool_check_rrd_exists(get_port_rrdfile_path($device['hostname'], $port['port_id'], 'dot3'))) {
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Ethernet Errors</h3>
</div>';
$graph_type = 'port_etherlike';
echo '<div class="panel-body">';
include 'includes/print-interface-graphs.inc.php';
echo '</div></div>';
}
}
开发者ID:awlx,项目名称:librenms,代码行数:31,代码来源:graphs.inc.php
注:本文中的get_port_rrdfile_path函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论