Merge pull request #2797 from BarbarossaTM/issue-386-v2

Ability to use ifIndex,ifName and ifDescr to create and update port rrd files
This commit is contained in:
Neil Lathwood
2016-01-29 13:05:03 +00:00
36 changed files with 483 additions and 150 deletions

View File

@@ -1,6 +1,6 @@
<?php
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'-adsl.rrd');
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl');
$rrd_list[0]['filename'] = $rrd_filename;
$rrd_list[0]['descr'] = 'Downstream';

View File

@@ -1,6 +1,6 @@
<?php
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'-adsl.rrd');
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl');
$rrd_list[0]['filename'] = $rrd_filename;
$rrd_list[0]['descr'] = 'Downstream';

View File

@@ -1,6 +1,6 @@
<?php
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'-adsl.rrd');
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl');
$rrd_list[0]['filename'] = $rrd_filename;
$rrd_list[0]['descr'] = 'Downstream';

View File

@@ -1,6 +1,6 @@
<?php
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'-adsl.rrd');
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl');
$rrd_list[0]['filename'] = $rrd_filename;
$rrd_list[0]['descr'] = 'Downstream';

View File

@@ -1,6 +1,6 @@
<?php
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'-adsl.rrd');
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'adsl');
$rrd_list[0]['filename'] = $rrd_filename;
$rrd_list[0]['descr'] = 'Downstream';

View File

@@ -13,5 +13,5 @@ if (is_numeric($vars['id']) && ($auth || port_permitted($vars['id']))) {
$auth = true;
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id']);
}

View File

@@ -18,7 +18,7 @@ $oids = array(
);
$i = 0;
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('port-'.$port['ifIndex'].'-dot3.rrd');
$rrd_filename = get_port_rrdfile_path ($device['hostname'], $port['port_id'], 'dot3');
if (is_file($rrd_filename)) {
foreach ($oids as $oid) {

View File

@@ -1,15 +1,17 @@
<?php
$rrd_file = get_port_rrdfile_path ($device['hostname'], $port['port_id']);
// FIXME uhh..
if (1) {
// $rrd_list[1]['filename'] = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd");
// $rrd_list[1]['filename'] = $rrd_file;
// $rrd_list[1]['descr'] = $int['ifDescr'];
// $rrd_list[1]['ds_in'] = "INNUCASTPKTS";
// $rrd_list[1]['ds_out'] = "OUTNUCASTPKTS";
// $rrd_list[1]['descr'] = "NonUnicast";
// $rrd_list[1]['colour_area_in'] = "BB77BB";
// $rrd_list[1]['colour_area_out'] = "FFDD88";
$rrd_list[2]['filename'] = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
$rrd_list[2]['filename'] = $rrd_file;
$rrd_list[2]['descr'] = $int['ifDescr'];
$rrd_list[2]['ds_in'] = 'INBROADCASTPKTS';
$rrd_list[2]['ds_out'] = 'OUTBROADCASTPKTS';
@@ -17,7 +19,7 @@ if (1) {
$rrd_list[2]['colour_area_in'] = 'aa37BB';
$rrd_list[2]['colour_area_out'] = 'ee9D88';
$rrd_list[4]['filename'] = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex'].'.rrd');
$rrd_list[4]['filename'] = $rrd_file;
$rrd_list[4]['descr'] = $int['ifDescr'];
$rrd_list[4]['ds_in'] = 'INMULTICASTPKTS';
$rrd_list[4]['ds_out'] = 'OUTMULTICASTPKTS';
@@ -36,8 +38,8 @@ if (1) {
include 'includes/graphs/generic_multi_seperated.inc.php';
}
else if (is_file($config['rrd_dir'].'/'.$device['hostname'].'/'.safename($port['ifIndex'].'.rrd'))) {
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename($port['ifIndex'].'.rrd');
else if (is_file($rrd_file)) {
$rrd_filename = $rrd_file;
$ds_in = 'INNUCASTPKTS';
$ds_out = 'OUTNUCASTPKTS';

View File

@@ -3,8 +3,9 @@
// 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) {
if (is_file($config['rrd_dir'].'/'.$hostname.'/port-'.safename($int['ifIndex'].'.rrd'))) {
$rrd_list[$i]['filename'] = $config['rrd_dir'].'/'.$hostname.'/port-'.safename($int['ifIndex'].'.rrd');
$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++;
}