Commit version 24.12.13800
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,37 +6,13 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
// FIXME - expand $vars['data']['groups'] for auth. For now only allow for >5
|
||||
$entity_type = "port";
|
||||
$entity_data = $GLOBALS['config']['entities'][$entity_type];
|
||||
|
||||
if (!is_array($vars['id'])) { $vars['id'] = array($vars['id']); }
|
||||
|
||||
$is_permitted = FALSE;
|
||||
|
||||
foreach ($vars['id'] as $port_id)
|
||||
{
|
||||
if (is_numeric($port_id) && port_permitted($port_id))
|
||||
{
|
||||
$is_permitted = TRUE;
|
||||
} else {
|
||||
$is_permitted = FALSE;
|
||||
// Bail on first reject.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($auth || $is_permitted || $_SESSION['userlevel'] >= 5)
|
||||
{
|
||||
$title_array = array();
|
||||
$title_array[] = array('text' => 'Multiple Ports');
|
||||
$title_array[] = array('text' => safe_count($vars['id']) . ' Ports');
|
||||
|
||||
$auth = TRUE;
|
||||
}
|
||||
|
||||
unset($is_permitted);
|
||||
include($config['html_dir'] . "/includes/graphs/multi-auth-generic.inc.php");
|
||||
|
||||
// EOF
|
||||
|
@ -5,18 +5,18 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
$units = '';
|
||||
$unit_text = 'Packets/sec';
|
||||
$units = '';
|
||||
$unit_text = 'Packets/sec';
|
||||
$total_units = '';
|
||||
$colours_in = 'purples';
|
||||
$multiplier = "1";
|
||||
$colours_in = 'purples';
|
||||
$multiplier = "1";
|
||||
$colours_out = 'oranges';
|
||||
|
||||
|
||||
@ -27,31 +27,28 @@ $nototal = 1;
|
||||
|
||||
$i = 1;
|
||||
|
||||
$rrd_list = array();
|
||||
$rrd_list = [];
|
||||
|
||||
foreach ($vars['id'] as $ifid)
|
||||
{
|
||||
if (strstr($ifid, "!"))
|
||||
{
|
||||
$rrd_inverted[$i] = TRUE;
|
||||
$ifid = str_replace("!", "", $ifid);
|
||||
}
|
||||
foreach ($vars['id'] as $ifid) {
|
||||
if (strstr($ifid, "!")) {
|
||||
$rrd_inverted[$i] = TRUE;
|
||||
$ifid = str_replace("!", "", $ifid);
|
||||
}
|
||||
|
||||
$port = dbFetchRow("SELECT * FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
$port = dbFetchRow("SELECT * FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", [$ifid]);
|
||||
|
||||
$rrd_file = get_port_rrdfilename($port, NULL, TRUE);
|
||||
if (rrd_is_file($rrd_file))
|
||||
{
|
||||
$rrd_list[$i]['filename'] = $rrd_file;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label'];
|
||||
$rrd_list[$i]['ds_in'] = $ds_in;
|
||||
$rrd_list[$i]['ds_out'] = $ds_out;
|
||||
$i++;
|
||||
}
|
||||
$rrd_file = get_port_rrdfilename($port, NULL, TRUE);
|
||||
if (rrd_is_file($rrd_file)) {
|
||||
$rrd_list[$i]['filename'] = $rrd_file;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label'];
|
||||
$rrd_list[$i]['ds_in'] = $ds_in;
|
||||
$rrd_list[$i]['ds_out'] = $ds_out;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_separated.inc.php");
|
||||
include($config['html_dir'] . "/includes/graphs/generic_multi_separated.inc.php");
|
||||
|
||||
// EOF
|
||||
|
@ -1,44 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
if (!is_array($vars['id'])) { $vars['id'] = array($vars['id']); }
|
||||
if (!is_array($vars['id'])) {
|
||||
$vars['id'] = [$vars['id']];
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
|
||||
foreach ($vars['id'] as $ifid)
|
||||
{
|
||||
$port = dbFetchRow("SELECT * FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
$rrdfile = get_port_rrdfilename($port, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile))
|
||||
{
|
||||
humanize_port($port);
|
||||
$rrd_list[$i]['filename'] = $rrdfile;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'] . " " . $port['ifDescr'];
|
||||
$rrd_list[$i]['descr_in'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label_short']; // Options sets for skip htmlentities
|
||||
$i++;
|
||||
}
|
||||
$sql = 'SELECT `ports`.*, `devices`.`hostname` FROM `ports` LEFT JOIN `devices` USING (`device_id`) WHERE ' .
|
||||
generate_query_values($vars['id'], 'ports.port_id');
|
||||
|
||||
foreach (dbFetchRows($sql) as $port) {
|
||||
//$port = dbFetchRow("SELECT * FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", [$ifid]);
|
||||
$rrdfile = get_port_rrdfilename($port, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile)) {
|
||||
//humanize_port($port);
|
||||
$rrd_list[$i]['filename'] = $rrdfile;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'] . " " . $port['ifDescr'];
|
||||
$rrd_list[$i]['descr_in'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label_short']; // Options sets for skip htmlentities
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$units = 'b';
|
||||
$total_units='B';
|
||||
$colours_in='greens';
|
||||
$multiplier = "8";
|
||||
$units = 'b';
|
||||
$total_units = 'B';
|
||||
$colours_in = 'greens';
|
||||
$multiplier = "8";
|
||||
$colours_out = 'blues';
|
||||
|
||||
$ds_in = "INOCTETS";
|
||||
$ds_out = "OUTOCTETS";
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_bits_separated.inc.php");
|
||||
include($config['html_dir'] . "/includes/graphs/generic_multi_bits_separated.inc.php");
|
||||
|
||||
// EOF
|
||||
|
@ -5,66 +5,76 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
// FIXME. This file unused
|
||||
return;
|
||||
|
||||
if (!is_array($vars['id'])) { $vars['id'] = array($vars['id']); }
|
||||
|
||||
if ($vars['legend']) { $legend = $vars['legend']; }
|
||||
|
||||
if ($height < "99") { $rrd_options .= " --only-graph"; }
|
||||
$i = 1;
|
||||
$rrd_multi = array();
|
||||
foreach ($vars['id'] as $ifid)
|
||||
{
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
$rrdfile = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile))
|
||||
{
|
||||
$rrd_options .= " DEF:inoctets" . $i . "=" . $rrdfile . ":INOCTETS:AVERAGE";
|
||||
$rrd_options .= " DEF:outoctets" . $i . "=" . $rrdfile . ":OUTOCTETS:AVERAGE";
|
||||
|
||||
$rrd_multi['in_thing'][] = "inoctets" . $i . ",UN,0," . "inoctets" . $i . ",IF";
|
||||
$rrd_multi['out_thing'][] = "outoctets" . $i . ",UN,0," . "outoctets" . $i . ",IF";
|
||||
|
||||
$i++;
|
||||
}
|
||||
if (!is_array($vars['id'])) {
|
||||
$vars['id'] = [$vars['id']];
|
||||
}
|
||||
|
||||
if (!is_array($vars['idb'])) { $vars['idb'] = array($vars['idb']); }
|
||||
foreach ($vars['idb'] as $ifid)
|
||||
{
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
$rrdfile = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile))
|
||||
{
|
||||
$rrd_options .= " DEF:inoctetsb" . $i . "=" . $rrdfile . ":INOCTETS:AVERAGE";
|
||||
$rrd_options .= " DEF:outoctetsb" . $i . "=" . $rrdfile . ":OUTOCTETS:AVERAGE";
|
||||
|
||||
$rrd_multi['in_thingb'][] = "inoctetsb" . $i . ",UN,0," . "inoctetsb" . $i . ",IF";
|
||||
$rrd_multi['out_thingb'][] = "outoctetsb" . $i . ",UN,0," . "outoctetsb" . $i . ",IF";
|
||||
|
||||
$i++;
|
||||
}
|
||||
if ($vars['legend']) {
|
||||
$legend = $vars['legend'];
|
||||
}
|
||||
|
||||
if ($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; }
|
||||
$in_thing = implode(',', $rrd_multi['in_thing']);
|
||||
$out_thing = implode(',', $rrd_multi['out_thing']);
|
||||
$pluses = str_repeat(',ADDNAN', safe_count($rrd_multi['in_thing']) - 1);
|
||||
$in_thingb = implode(',', $rrd_multi['in_thingb']);
|
||||
$out_thingb = implode(',', $rrd_multi['out_thingb']);
|
||||
$plusesb = str_repeat(',ADDNAN', safe_count($rrd_multi['in_thingb']) - 1);
|
||||
$rrd_options .= " CDEF:".$in."octets=" . $in_thing . $pluses;
|
||||
$rrd_options .= " CDEF:".$out."octets=" . $out_thing . $pluses;
|
||||
$rrd_options .= " CDEF:".$in."octetsb=" . $in_thingb . $plusesb;
|
||||
$rrd_options .= " CDEF:".$out."octetsb=" . $out_thingb . $plusesb;
|
||||
if ($height < "99") {
|
||||
$rrd_options .= " --only-graph";
|
||||
}
|
||||
$i = 1;
|
||||
$rrd_multi = [];
|
||||
foreach ($vars['id'] as $ifid) {
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", [$ifid]);
|
||||
$rrdfile = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile)) {
|
||||
$rrd_options .= " DEF:inoctets" . $i . "=" . $rrdfile . ":INOCTETS:AVERAGE";
|
||||
$rrd_options .= " DEF:outoctets" . $i . "=" . $rrdfile . ":OUTOCTETS:AVERAGE";
|
||||
|
||||
$rrd_multi['in_thing'][] = "inoctets" . $i . ",UN,0," . "inoctets" . $i . ",IF";
|
||||
$rrd_multi['out_thing'][] = "outoctets" . $i . ",UN,0," . "outoctets" . $i . ",IF";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($vars['idb'])) {
|
||||
$vars['idb'] = [$vars['idb']];
|
||||
}
|
||||
foreach ($vars['idb'] as $ifid) {
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id", [$ifid]);
|
||||
$rrdfile = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile)) {
|
||||
$rrd_options .= " DEF:inoctetsb" . $i . "=" . $rrdfile . ":INOCTETS:AVERAGE";
|
||||
$rrd_options .= " DEF:outoctetsb" . $i . "=" . $rrdfile . ":OUTOCTETS:AVERAGE";
|
||||
|
||||
$rrd_multi['in_thingb'][] = "inoctetsb" . $i . ",UN,0," . "inoctetsb" . $i . ",IF";
|
||||
$rrd_multi['out_thingb'][] = "outoctetsb" . $i . ",UN,0," . "outoctetsb" . $i . ",IF";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($inverse) {
|
||||
$in = 'out';
|
||||
$out = 'in';
|
||||
} else {
|
||||
$in = 'in';
|
||||
$out = 'out';
|
||||
}
|
||||
$in_thing = implode(',', $rrd_multi['in_thing']);
|
||||
$out_thing = implode(',', $rrd_multi['out_thing']);
|
||||
$pluses = str_repeat(',ADDNAN', safe_count($rrd_multi['in_thing']) - 1);
|
||||
$in_thingb = implode(',', $rrd_multi['in_thingb']);
|
||||
$out_thingb = implode(',', $rrd_multi['out_thingb']);
|
||||
$plusesb = str_repeat(',ADDNAN', safe_count($rrd_multi['in_thingb']) - 1);
|
||||
$rrd_options .= " CDEF:" . $in . "octets=" . $in_thing . $pluses;
|
||||
$rrd_options .= " CDEF:" . $out . "octets=" . $out_thing . $pluses;
|
||||
$rrd_options .= " CDEF:" . $in . "octetsb=" . $in_thingb . $plusesb;
|
||||
$rrd_options .= " CDEF:" . $out . "octetsb=" . $out_thingb . $plusesb;
|
||||
$rrd_options .= " CDEF:doutoctets=outoctets,-1,*";
|
||||
$rrd_options .= " CDEF:inbits=inoctets,8,*";
|
||||
$rrd_options .= " CDEF:outbits=outoctets,8,*";
|
||||
@ -78,66 +88,67 @@ $rrd_options .= " CDEF:outbits_tot=outbits,outbitsb,+";
|
||||
$rrd_options .= " CDEF:doutbits_tot=outbits_tot,-1,*";
|
||||
$rrd_options .= " CDEF:nothing=outbits_tot,outbits_tot,-";
|
||||
|
||||
if ($legend == "no")
|
||||
{
|
||||
$rrd_options .= " AREA:inbits_tot#cdeb8b:";
|
||||
$rrd_options .= " AREA:inbits#ffcc99:";
|
||||
$rrd_options .= " AREA:doutbits_tot#C3D9FF:";
|
||||
$rrd_options .= " AREA:doutbits#ffcc99:";
|
||||
$rrd_options .= " LINE1:inbits#aa9966:";
|
||||
$rrd_options .= " LINE1:doutbits#aa9966:";
|
||||
if ($legend == "no") {
|
||||
$rrd_options .= " AREA:inbits_tot#cdeb8b:";
|
||||
$rrd_options .= " AREA:inbits#ffcc99:";
|
||||
$rrd_options .= " AREA:doutbits_tot#C3D9FF:";
|
||||
$rrd_options .= " AREA:doutbits#ffcc99:";
|
||||
$rrd_options .= " LINE1:inbits#aa9966:";
|
||||
$rrd_options .= " LINE1:doutbits#aa9966:";
|
||||
# $rrd_options .= " LINE1:inbitsb#006600:";
|
||||
# $rrd_options .= " LINE1:doutbitsb#000066:";
|
||||
$rrd_options .= " LINE1.25:inbits_tot#006600:";
|
||||
$rrd_options .= " LINE1.25:doutbits_tot#000099:";
|
||||
$rrd_options .= " LINE0.5:nothing#555555:";
|
||||
$rrd_options .= " LINE1.25:inbits_tot#006600:";
|
||||
$rrd_options .= " LINE1.25:doutbits_tot#000099:";
|
||||
$rrd_options .= " LINE0.5:nothing#555555:";
|
||||
} else {
|
||||
$rrd_options .= " COMMENT:'bps Current Average Min Max\\n'";
|
||||
$rrd_options .= " AREA:inbits_tot#cdeb8b:'Peering In '";
|
||||
$rrd_options .= " GPRINT:inbitsb:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsb:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsb:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsb:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " AREA:doutbits_tot#C3D9FF:";
|
||||
$rrd_options .= " COMMENT:' Out'";
|
||||
$rrd_options .= " GPRINT:outbitsb:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsb:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsb:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsb:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " COMMENT:'bps Current Average Min Max\\n'";
|
||||
$rrd_options .= " AREA:inbits_tot#cdeb8b:'Peering In '";
|
||||
$rrd_options .= " GPRINT:inbitsb:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsb:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsb:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsb:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " AREA:doutbits_tot#C3D9FF:";
|
||||
$rrd_options .= " COMMENT:' Out'";
|
||||
$rrd_options .= " GPRINT:outbitsb:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsb:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsb:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsb:MAX:%6.2lf%s\\l";
|
||||
|
||||
$rrd_options .= " AREA:inbits#ffcc99:'Transit In '";
|
||||
$rrd_options .= " GPRINT:inbits:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " AREA:doutbits#ffcc99:";
|
||||
$rrd_options .= " COMMENT:' Out'";
|
||||
$rrd_options .= " GPRINT:outbits:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " AREA:inbits#ffcc99:'Transit In '";
|
||||
$rrd_options .= " GPRINT:inbits:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " AREA:doutbits#ffcc99:";
|
||||
$rrd_options .= " COMMENT:' Out'";
|
||||
$rrd_options .= " GPRINT:outbits:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits:MAX:%6.2lf%s\\l";
|
||||
|
||||
$rrd_options .= " COMMENT:'Total In '";
|
||||
$rrd_options .= " GPRINT:inbits_tot:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits_tot:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits_tot:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits_tot:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " COMMENT:' Out'";
|
||||
$rrd_options .= " GPRINT:outbits_tot:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits_tot:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits_tot:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits_tot:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " COMMENT:'Total In '";
|
||||
$rrd_options .= " GPRINT:inbits_tot:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits_tot:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits_tot:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits_tot:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " COMMENT:' Out'";
|
||||
$rrd_options .= " GPRINT:outbits_tot:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits_tot:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits_tot:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits_tot:MAX:%6.2lf%s\\l";
|
||||
|
||||
$rrd_options .= " LINE1:inbits#aa9966:";
|
||||
$rrd_options .= " LINE1:doutbits#aa9966:";
|
||||
$rrd_options .= " LINE1:inbits#aa9966:";
|
||||
$rrd_options .= " LINE1:doutbits#aa9966:";
|
||||
# $rrd_options .= " LINE1.25:inbitsb#006600:";
|
||||
# $rrd_options .= " LINE1.25:doutbitsb#006600:";
|
||||
$rrd_options .= " LINE1.25:inbits_tot#006600:";
|
||||
$rrd_options .= " LINE1.25:doutbits_tot#000099:";
|
||||
$rrd_options .= " LINE0.5:nothing#555555:";
|
||||
$rrd_options .= " LINE1.25:inbits_tot#006600:";
|
||||
$rrd_options .= " LINE1.25:doutbits_tot#000099:";
|
||||
$rrd_options .= " LINE0.5:nothing#555555:";
|
||||
}
|
||||
|
||||
if ($width <= "300") { $rrd_options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal"; }
|
||||
if ($width <= "300") {
|
||||
$rrd_options .= " --font LEGEND:7:" . $config['mono_font'] . " --font AXIS:6:" . $config['mono_font'] . " --font-render-mode normal";
|
||||
}
|
||||
|
||||
// Clean
|
||||
unset($rrd_multi, $in_thing, $out_thing, $pluses, $in_thingb, $out_thingb, $plusesb);
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,16 +6,20 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
if (!is_array($vars['id'])) { $vars['id'] = array($vars['id']); }
|
||||
if (!is_array($vars['idb'])) { $vars['idb'] = array($vars['idb']); }
|
||||
if (!is_array($vars['id'])) {
|
||||
$vars['id'] = [$vars['id']];
|
||||
}
|
||||
if (!is_array($vars['idb'])) {
|
||||
$vars['idb'] = [$vars['idb']];
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
|
||||
$groups[0]['ports'] = $vars['id'];
|
||||
$groups[0]['ports'] = $vars['id'];
|
||||
$groups[0]['colours_in'] = 'oranges';
|
||||
$groups[0]['colours_out'] = 'red2';
|
||||
|
||||
@ -24,43 +27,46 @@ $groups[1]['ports'] = $vars['idb'];
|
||||
$groups[1]['colours_in'] = 'greens';
|
||||
$groups[1]['colours_out'] = 'blues';
|
||||
|
||||
foreach ($groups as $group_id => $group)
|
||||
{
|
||||
$iter=0;
|
||||
foreach ($group['ports'] as $port_id)
|
||||
{
|
||||
$port = dbFetchRow("SELECT * FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id", array($port_id));
|
||||
$rrdfile = get_port_rrdfilename($port, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile))
|
||||
{
|
||||
humanize_port($port);
|
||||
$rrd_list[$i]['filename'] = $rrdfile;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'] . " " . $port['ifDescr'];
|
||||
$rrd_list[$i]['descr_in'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label_short'];
|
||||
foreach ($groups as $group_id => $group) {
|
||||
$iter = 0;
|
||||
|
||||
if (!$config['graph_colours'][$group['colours_in']][$iter] || !$config['graph_colours'][$group['colours_out']][$iter]) { $iter = 0; }
|
||||
$rrd_list[$i]['colour_in'] = $config['graph_colours'][$group['colours_in']][$iter];
|
||||
$rrd_list[$i]['colour_out'] = $config['graph_colours'][$group['colours_out']][$iter];
|
||||
$i++; $iter++;
|
||||
$sql = 'SELECT `ports`.*, `devices`.`hostname` FROM `ports` LEFT JOIN `devices` USING (`device_id`) WHERE ' .
|
||||
generate_query_values($group['ports'], 'ports.port_id');
|
||||
foreach (dbFetchRows($sql) as $port) {
|
||||
//$port = dbFetchRow("SELECT * FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id", [$port_id]);
|
||||
$rrdfile = get_port_rrdfilename($port, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile)) {
|
||||
//humanize_port($port);
|
||||
$rrd_list[$i]['filename'] = $rrdfile;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'] . " " . $port['ifDescr'];
|
||||
$rrd_list[$i]['descr_in'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label_short'];
|
||||
|
||||
if (!$config['graph_colours'][$group['colours_in']][$iter] || !$config['graph_colours'][$group['colours_out']][$iter]) {
|
||||
$iter = 0;
|
||||
}
|
||||
$rrd_list[$i]['colour_in'] = $config['graph_colours'][$group['colours_in']][$iter];
|
||||
$rrd_list[$i]['colour_out'] = $config['graph_colours'][$group['colours_out']][$iter];
|
||||
$i++;
|
||||
$iter++;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#echo("<pre>");
|
||||
#print_vars($rrd_list);
|
||||
#echo("</pre>");
|
||||
|
||||
$units = 'bps';
|
||||
$total_units='B';
|
||||
$multiplier = "8";
|
||||
$units = 'bps';
|
||||
$total_units = 'B';
|
||||
$multiplier = "8";
|
||||
|
||||
#$nototal = 1;
|
||||
|
||||
$ds_in = "INOCTETS";
|
||||
$ds_out = "OUTOCTETS";
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_bits_separated.inc.php");
|
||||
include($config['html_dir'] . "/includes/graphs/generic_multi_bits_separated.inc.php");
|
||||
|
||||
// EOF
|
||||
|
@ -5,41 +5,40 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
if (!is_array($vars['id'])) { $vars['id'] = array($vars['id']); }
|
||||
if (!is_array($vars['id'])) {
|
||||
$vars['id'] = [$vars['id']];
|
||||
}
|
||||
|
||||
$i = 1;
|
||||
|
||||
foreach ($vars['id'] as $ifid)
|
||||
{
|
||||
if (strstr($ifid, "!"))
|
||||
{
|
||||
$rrd_inverted[$i] = TRUE;
|
||||
$ifid = str_replace("!", "", $ifid);
|
||||
}
|
||||
foreach ($vars['id'] as $ifid) {
|
||||
if (strstr($ifid, "!")) {
|
||||
$rrd_inverted[$i] = TRUE;
|
||||
$ifid = str_replace("!", "", $ifid);
|
||||
}
|
||||
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
$rrd_file = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrd_file))
|
||||
{
|
||||
$rrd_filenames[$i] = $rrd_file;
|
||||
$i++;
|
||||
}
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", [$ifid]);
|
||||
$rrd_file = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrd_file)) {
|
||||
$rrd_filenames[$i] = $rrd_file;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$ds_in = "INOCTETS";
|
||||
$ds_out = "OUTOCTETS";
|
||||
|
||||
$colour_line_in = "006600";
|
||||
$colour_line_in = "006600";
|
||||
$colour_line_out = "000099";
|
||||
$colour_area_in = "91B13C";
|
||||
$colour_area_in = "91B13C";
|
||||
$colour_area_out = "8080BD";
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_data.inc.php");
|
||||
include($config['html_dir'] . "/includes/graphs/generic_multi_data.inc.php");
|
||||
|
||||
// EOF
|
||||
|
@ -4,36 +4,36 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
$i = 0;
|
||||
|
||||
foreach ((array) $vars['id'] as $ifid) {
|
||||
$port = dbFetchRow("SELECT * FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
$rrdfile = get_port_rrdfilename($port, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile, TRUE)) {
|
||||
//humanize_port($port);
|
||||
$rrd_list[$i]['filename'] = $rrdfile;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'] . " " . $port['ifDescr'];
|
||||
$rrd_list[$i]['descr_in'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label_short'];
|
||||
$i++;
|
||||
}
|
||||
foreach ((array)$vars['id'] as $ifid) {
|
||||
$port = dbFetchRow("SELECT * FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", [$ifid]);
|
||||
$rrdfile = get_port_rrdfilename($port, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile, TRUE)) {
|
||||
//humanize_port($port);
|
||||
$rrd_list[$i]['filename'] = $rrdfile;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'] . " " . $port['ifDescr'];
|
||||
$rrd_list[$i]['descr_in'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label_short'];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$units = 'b';
|
||||
$total_units='B';
|
||||
$colours_in='greens';
|
||||
$multiplier = "8";
|
||||
$units = 'b';
|
||||
$total_units = 'B';
|
||||
$colours_in = 'greens';
|
||||
$multiplier = "8";
|
||||
$colours_out = 'blues';
|
||||
|
||||
$ds_in = "INOCTETS";
|
||||
$ds_out = "OUTOCTETS";
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_bits_separated.inc.php");
|
||||
include($config['html_dir'] . "/includes/graphs/generic_multi_bits_separated.inc.php");
|
||||
|
||||
// EOF
|
||||
|
@ -5,86 +5,107 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
// FIXME. This file unused
|
||||
|
||||
if (!is_array($vars['id'])) { $vars['id'] = array($vars['id']); }
|
||||
if (!is_array($vars['idb'])) { $vars['idb'] = array($vars['idb']); }
|
||||
if (!is_array($vars['idc'])) { $vars['idc'] = array($vars['idc']); }
|
||||
|
||||
if ($vars['legend']) { $legend = $vars['legend']; }
|
||||
|
||||
include($config['html_dir']."/includes/graphs/common.inc.php");
|
||||
|
||||
if ($height < "99") { $rrd_options .= " --only-graph"; }
|
||||
$i = 1;
|
||||
$rrd_multi = array();
|
||||
foreach ($vars['id'] as $ifid)
|
||||
{
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
$rrdfile = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile))
|
||||
{
|
||||
if (strstr($inverse, "a")) { $in = "OUT"; $out = "IN"; } else { $in = "IN"; $out = "OUT"; }
|
||||
$rrd_options .= " DEF:inoctets" . $i . "=" . $rrdfile . ":".$in."OCTETS:AVERAGE";
|
||||
$rrd_options .= " DEF:outoctets" . $i . "=" . $rrdfile . ":".$out."OCTETS:AVERAGE";
|
||||
|
||||
$rrd_multi['in_thing'][] = "inoctets" . $i . ",UN,0," . "inoctets" . $i . ",IF";
|
||||
$rrd_multi['out_thing'][] = "outoctets" . $i . ",UN,0," . "outoctets" . $i . ",IF";
|
||||
|
||||
$i++;
|
||||
}
|
||||
if (!is_array($vars['id'])) {
|
||||
$vars['id'] = [$vars['id']];
|
||||
}
|
||||
if (!is_array($vars['idb'])) {
|
||||
$vars['idb'] = [$vars['idb']];
|
||||
}
|
||||
if (!is_array($vars['idc'])) {
|
||||
$vars['idc'] = [$vars['idc']];
|
||||
}
|
||||
|
||||
foreach ($vars['idb'] as $ifid)
|
||||
{
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
$rrdfile = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile))
|
||||
{
|
||||
if (strstr($inverse, "b")) { $in = "OUT"; $out = "IN"; } else { $in = "IN"; $out = "OUT"; }
|
||||
$rrd_options .= " DEF:inoctetsb" . $i . "=" . $rrdfile . ":".$in."OCTETS:AVERAGE";
|
||||
$rrd_options .= " DEF:outoctetsb" . $i . "=" . $rrdfile . ":".$out."OCTETS:AVERAGE";
|
||||
|
||||
$rrd_multi['in_thingb'][] = "inoctetsb" . $i . ",UN,0," . "inoctetsb" . $i . ",IF";
|
||||
$rrd_multi['out_thingb'][] = "outoctetsb" . $i . ",UN,0," . "outoctetsb" . $i . ",IF";
|
||||
|
||||
$i++;
|
||||
}
|
||||
if ($vars['legend']) {
|
||||
$legend = $vars['legend'];
|
||||
}
|
||||
|
||||
foreach ($vars['idc'] as $ifid)
|
||||
{
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
$rrdfile = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile))
|
||||
{
|
||||
if (strstr($inverse, "c")) { $in = "OUT"; $out = "IN"; } else { $in = "IN"; $out = "OUT"; }
|
||||
$rrd_options .= " DEF:inoctetsc" . $i . "=" . $rrdfile . ":".$in."OCTETS:AVERAGE";
|
||||
$rrd_options .= " DEF:outoctetsc" . $i . "=" . $rrdfile . ":".$out."OCTETS:AVERAGE";
|
||||
include($config['html_dir'] . "/includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_multi['in_thingc'][] = "inoctetsc" . $i . ",UN,0," . "inoctetsc" . $i . ",IF";
|
||||
$rrd_multi['out_thingc'][] = "outoctetsc" . $i . ",UN,0," . "outoctetsc" . $i . ",IF";
|
||||
if ($height < "99") {
|
||||
$rrd_options .= " --only-graph";
|
||||
}
|
||||
$i = 1;
|
||||
$rrd_multi = [];
|
||||
foreach ($vars['id'] as $ifid) {
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", [$ifid]);
|
||||
$rrdfile = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile)) {
|
||||
if (strstr($inverse, "a")) {
|
||||
$in = "OUT";
|
||||
$out = "IN";
|
||||
} else {
|
||||
$in = "IN";
|
||||
$out = "OUT";
|
||||
}
|
||||
$rrd_options .= " DEF:inoctets" . $i . "=" . $rrdfile . ":" . $in . "OCTETS:AVERAGE";
|
||||
$rrd_options .= " DEF:outoctets" . $i . "=" . $rrdfile . ":" . $out . "OCTETS:AVERAGE";
|
||||
|
||||
$i++;
|
||||
}
|
||||
$rrd_multi['in_thing'][] = "inoctets" . $i . ",UN,0," . "inoctets" . $i . ",IF";
|
||||
$rrd_multi['out_thing'][] = "outoctets" . $i . ",UN,0," . "outoctets" . $i . ",IF";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
foreach(array('', 'b', 'c') as $trio)
|
||||
{
|
||||
$in_name = 'in_thing'.$trio;
|
||||
$out_name = 'out_thing'.$trio;
|
||||
$pluses_name = 'pluses'.$trio;
|
||||
|
||||
$$in_name = implode(',', $rrd_multi[$in_name]);
|
||||
$$out_name = implode(',', $rrd_multi[$out_name]);
|
||||
$$pluses_name = str_repeat(',ADDNAN', safe_count($rrd_multi[$in_name]) - 1);
|
||||
unset($in_name, $out_name, $pluses_name);
|
||||
foreach ($vars['idb'] as $ifid) {
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", [$ifid]);
|
||||
$rrdfile = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile)) {
|
||||
if (strstr($inverse, "b")) {
|
||||
$in = "OUT";
|
||||
$out = "IN";
|
||||
} else {
|
||||
$in = "IN";
|
||||
$out = "OUT";
|
||||
}
|
||||
$rrd_options .= " DEF:inoctetsb" . $i . "=" . $rrdfile . ":" . $in . "OCTETS:AVERAGE";
|
||||
$rrd_options .= " DEF:outoctetsb" . $i . "=" . $rrdfile . ":" . $out . "OCTETS:AVERAGE";
|
||||
|
||||
$rrd_multi['in_thingb'][] = "inoctetsb" . $i . ",UN,0," . "inoctetsb" . $i . ",IF";
|
||||
$rrd_multi['out_thingb'][] = "outoctetsb" . $i . ",UN,0," . "outoctetsb" . $i . ",IF";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($vars['idc'] as $ifid) {
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id", [$ifid]);
|
||||
$rrdfile = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile)) {
|
||||
if (strstr($inverse, "c")) {
|
||||
$in = "OUT";
|
||||
$out = "IN";
|
||||
} else {
|
||||
$in = "IN";
|
||||
$out = "OUT";
|
||||
}
|
||||
$rrd_options .= " DEF:inoctetsc" . $i . "=" . $rrdfile . ":" . $in . "OCTETS:AVERAGE";
|
||||
$rrd_options .= " DEF:outoctetsc" . $i . "=" . $rrdfile . ":" . $out . "OCTETS:AVERAGE";
|
||||
|
||||
$rrd_multi['in_thingc'][] = "inoctetsc" . $i . ",UN,0," . "inoctetsc" . $i . ",IF";
|
||||
$rrd_multi['out_thingc'][] = "outoctetsc" . $i . ",UN,0," . "outoctetsc" . $i . ",IF";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (['', 'b', 'c'] as $trio) {
|
||||
$in_name = 'in_thing' . $trio;
|
||||
$out_name = 'out_thing' . $trio;
|
||||
$pluses_name = 'pluses' . $trio;
|
||||
|
||||
$$in_name = implode(',', $rrd_multi[$in_name]);
|
||||
$$out_name = implode(',', $rrd_multi[$out_name]);
|
||||
$$pluses_name = str_repeat(',ADDNAN', safe_count($rrd_multi[$in_name]) - 1);
|
||||
unset($in_name, $out_name, $pluses_name);
|
||||
}
|
||||
|
||||
$rrd_options .= " CDEF:inoctets=" . $in_thing . $pluses;
|
||||
@ -113,82 +134,81 @@ $rrd_options .= " CDEF:doutbits_stot=outbits_stot,-1,*";
|
||||
$rrd_options .= " CDEF:doutbits_tot=outbits_tot,-1,*";
|
||||
$rrd_options .= " CDEF:nothing=outbits_tot,outbits_tot,-";
|
||||
|
||||
if ($legend == "no")
|
||||
{
|
||||
$rrd_options .= " AREA:inbits_tot#cdeb8b:";
|
||||
$rrd_options .= " AREA:doutbits_tot#cdeb8b:";
|
||||
$rrd_options .= " LINE1.25:inbits_tot#aacc77:";
|
||||
$rrd_options .= " LINE1.25:doutbits_tot#aacc88:";
|
||||
$rrd_options .= " AREA:inbits_stot#c3d9ff:";
|
||||
$rrd_options .= " AREA:doutbits_stot#c3d9ff:";
|
||||
$rrd_options .= " LINE1:inbits_stot#b3a9cf:";
|
||||
$rrd_options .= " LINE1:doutbits_stot#b3a9cf:";
|
||||
$rrd_options .= " AREA:inbitsc#ffcc99:";
|
||||
$rrd_options .= " AREA:doutbitsc#ffcc99:";
|
||||
$rrd_options .= " LINE1.25:inbitsc#ddaa88";
|
||||
$rrd_options .= " LINE1.25:doutbitsc#ddaa88";
|
||||
$rrd_options .= " LINE1:inbits#006600:";
|
||||
$rrd_options .= " LINE1:doutbits#006600:";
|
||||
$rrd_options .= " LINE1:inbitsb#000099:";
|
||||
$rrd_options .= " LINE1:doutbitsb#000099:";
|
||||
$rrd_options .= " LINE0.5:nothing#555555:";
|
||||
if ($legend == "no") {
|
||||
$rrd_options .= " AREA:inbits_tot#cdeb8b:";
|
||||
$rrd_options .= " AREA:doutbits_tot#cdeb8b:";
|
||||
$rrd_options .= " LINE1.25:inbits_tot#aacc77:";
|
||||
$rrd_options .= " LINE1.25:doutbits_tot#aacc88:";
|
||||
$rrd_options .= " AREA:inbits_stot#c3d9ff:";
|
||||
$rrd_options .= " AREA:doutbits_stot#c3d9ff:";
|
||||
$rrd_options .= " LINE1:inbits_stot#b3a9cf:";
|
||||
$rrd_options .= " LINE1:doutbits_stot#b3a9cf:";
|
||||
$rrd_options .= " AREA:inbitsc#ffcc99:";
|
||||
$rrd_options .= " AREA:doutbitsc#ffcc99:";
|
||||
$rrd_options .= " LINE1.25:inbitsc#ddaa88";
|
||||
$rrd_options .= " LINE1.25:doutbitsc#ddaa88";
|
||||
$rrd_options .= " LINE1:inbits#006600:";
|
||||
$rrd_options .= " LINE1:doutbits#006600:";
|
||||
$rrd_options .= " LINE1:inbitsb#000099:";
|
||||
$rrd_options .= " LINE1:doutbitsb#000099:";
|
||||
$rrd_options .= " LINE0.5:nothing#555555:";
|
||||
} else {
|
||||
$rrd_options .= " COMMENT:'bps Current Average Min Max\\n'";
|
||||
$rrd_options .= " AREA:inbits_tot#cdeb8b:'ATM In '";
|
||||
$rrd_options .= " GPRINT:inbits:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " AREA:doutbits_tot#cdeb8b:";
|
||||
$rrd_options .= " COMMENT:' Out'";
|
||||
$rrd_options .= " GPRINT:outbits:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " LINE1.25:inbits_tot#aacc77:";
|
||||
$rrd_options .= " LINE1.25:doutbits_tot#aacc88:";
|
||||
$rrd_options .= " AREA:inbits_stot#c3d9ff:'NGN In '";
|
||||
$rrd_options .= " GPRINT:inbitsb:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsb:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsb:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsb:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " AREA:doutbits_stot#c3d9ff:";
|
||||
$rrd_options .= " COMMENT:' Out'";
|
||||
$rrd_options .= " GPRINT:outbitsb:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsb:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsb:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsb:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " LINE1:inbits_stot#b3a9cf:";
|
||||
$rrd_options .= " LINE1:doutbits_stot#b3a9cf:";
|
||||
$rrd_options .= " AREA:inbitsc#ffcc99:'Wave In '";
|
||||
$rrd_options .= " GPRINT:inbitsc:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsc:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsc:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsc:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " AREA:doutbitsc#ffcc99:";
|
||||
$rrd_options .= " COMMENT:' Out'";
|
||||
$rrd_options .= " GPRINT:outbitsc:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsc:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsc:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsc:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " LINE1.25:inbitsc#ddaa88";
|
||||
$rrd_options .= " LINE1.25:doutbitsc#ddaa88";
|
||||
$rrd_options .= " LINE1:inbits#006600:";
|
||||
$rrd_options .= " LINE1:doutbits#006600:";
|
||||
$rrd_options .= " LINE1:inbitsb#000099:";
|
||||
$rrd_options .= " LINE1:doutbitsb#000099:";
|
||||
$rrd_options .= " LINE0.5:nothing#555555:";
|
||||
$rrd_options .= " COMMENT:'bps Current Average Min Max\\n'";
|
||||
$rrd_options .= " AREA:inbits_tot#cdeb8b:'ATM In '";
|
||||
$rrd_options .= " GPRINT:inbits:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " AREA:doutbits_tot#cdeb8b:";
|
||||
$rrd_options .= " COMMENT:' Out'";
|
||||
$rrd_options .= " GPRINT:outbits:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " LINE1.25:inbits_tot#aacc77:";
|
||||
$rrd_options .= " LINE1.25:doutbits_tot#aacc88:";
|
||||
$rrd_options .= " AREA:inbits_stot#c3d9ff:'NGN In '";
|
||||
$rrd_options .= " GPRINT:inbitsb:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsb:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsb:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsb:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " AREA:doutbits_stot#c3d9ff:";
|
||||
$rrd_options .= " COMMENT:' Out'";
|
||||
$rrd_options .= " GPRINT:outbitsb:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsb:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsb:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsb:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " LINE1:inbits_stot#b3a9cf:";
|
||||
$rrd_options .= " LINE1:doutbits_stot#b3a9cf:";
|
||||
$rrd_options .= " AREA:inbitsc#ffcc99:'Wave In '";
|
||||
$rrd_options .= " GPRINT:inbitsc:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsc:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsc:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbitsc:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " AREA:doutbitsc#ffcc99:";
|
||||
$rrd_options .= " COMMENT:' Out'";
|
||||
$rrd_options .= " GPRINT:outbitsc:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsc:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsc:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbitsc:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " LINE1.25:inbitsc#ddaa88";
|
||||
$rrd_options .= " LINE1.25:doutbitsc#ddaa88";
|
||||
$rrd_options .= " LINE1:inbits#006600:";
|
||||
$rrd_options .= " LINE1:doutbits#006600:";
|
||||
$rrd_options .= " LINE1:inbitsb#000099:";
|
||||
$rrd_options .= " LINE1:doutbitsb#000099:";
|
||||
$rrd_options .= " LINE0.5:nothing#555555:";
|
||||
|
||||
$rrd_options .= " COMMENT:'Total In '";
|
||||
$rrd_options .= " GPRINT:inbits_tot:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits_tot:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits_tot:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits_tot:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " COMMENT:' Out'";
|
||||
$rrd_options .= " GPRINT:outbits_tot:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits_tot:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits_tot:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits_tot:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " COMMENT:'Total In '";
|
||||
$rrd_options .= " GPRINT:inbits_tot:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits_tot:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits_tot:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:inbits_tot:MAX:%6.2lf%s\\l";
|
||||
$rrd_options .= " COMMENT:' Out'";
|
||||
$rrd_options .= " GPRINT:outbits_tot:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits_tot:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits_tot:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:outbits_tot:MAX:%6.2lf%s\\l";
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,100 +5,134 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
// FIXME. This file unused
|
||||
|
||||
if (!is_array($vars['id'])) { $vars['id'] = array($vars['id']); }
|
||||
if (!is_array($vars['idb'])) { $vars['idb'] = array($vars['idb']); }
|
||||
if (!is_array($vars['idc'])) { $vars['idc'] = array($vars['idc']); }
|
||||
if (!is_array($vars['id'])) {
|
||||
$vars['id'] = [$vars['id']];
|
||||
}
|
||||
if (!is_array($vars['idb'])) {
|
||||
$vars['idb'] = [$vars['idb']];
|
||||
}
|
||||
if (!is_array($vars['idc'])) {
|
||||
$vars['idc'] = [$vars['idc']];
|
||||
}
|
||||
|
||||
if (!isset($vars['colour_a'])) { $vars['colour_a'] = "0a5f7f"; }
|
||||
if (!isset($vars['colour_b'])) { $vars['colour_b'] = "4d9221"; }
|
||||
if (!isset($vars['colour_c'])) { $vars['colour_c'] = "d9534f"; }
|
||||
if (!isset($vars['colour_a'])) {
|
||||
$vars['colour_a'] = "0a5f7f";
|
||||
}
|
||||
if (!isset($vars['colour_b'])) {
|
||||
$vars['colour_b'] = "4d9221";
|
||||
}
|
||||
if (!isset($vars['colour_c'])) {
|
||||
$vars['colour_c'] = "d9534f";
|
||||
}
|
||||
|
||||
if (!isset($vars['descr_a'])) { $vars['descr_a'] = "Peering"; }
|
||||
if (!isset($vars['descr_b'])) { $vars['descr_b'] = "Cache"; }
|
||||
if (!isset($vars['descr_c'])) { $vars['descr_c'] = "Transit"; }
|
||||
if (!isset($vars['descr_a'])) {
|
||||
$vars['descr_a'] = "Peering";
|
||||
}
|
||||
if (!isset($vars['descr_b'])) {
|
||||
$vars['descr_b'] = "Cache";
|
||||
}
|
||||
if (!isset($vars['descr_c'])) {
|
||||
$vars['descr_c'] = "Transit";
|
||||
}
|
||||
|
||||
|
||||
if ($vars['legend']) { $legend = $vars['legend']; }
|
||||
if ($vars['legend']) {
|
||||
$legend = $vars['legend'];
|
||||
}
|
||||
|
||||
$descr_lens = array(strlen($vars['descr_a']), strlen($vars['descr_b']), strlen($vars['descr_c']));
|
||||
$descr_lens = [strlen($vars['descr_a']), strlen($vars['descr_b']), strlen($vars['descr_c'])];
|
||||
$max_descr = max($descr_lens);
|
||||
if($max_descr < 10) { $max_descr = 10; }
|
||||
|
||||
|
||||
|
||||
include($config['html_dir']."/includes/graphs/common.inc.php");
|
||||
|
||||
if ($height < "99") { $rrd_options .= " --only-graph"; }
|
||||
$i = 1;
|
||||
$rrd_multi = array();
|
||||
foreach ($vars['id'] as $ifid)
|
||||
{
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
$rrdfile = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile))
|
||||
{
|
||||
if (strstr($inverse, "a")) { $in = "OUT"; $out = "IN"; } else { $in = "IN"; $out = "OUT"; }
|
||||
$rrd_options .= " DEF:inoctets" . $i . "=" . $rrdfile . ":".$in."OCTETS:AVERAGE";
|
||||
$rrd_options .= " DEF:outoctets" . $i . "=" . $rrdfile . ":".$out."OCTETS:AVERAGE";
|
||||
|
||||
$rrd_multi['in_thing'][] = "inoctets" . $i . ",UN,0," . "inoctets" . $i . ",IF";
|
||||
$rrd_multi['out_thing'][] = "outoctets" . $i . ",UN,0," . "outoctets" . $i . ",IF";
|
||||
|
||||
$i++;
|
||||
}
|
||||
if ($max_descr < 10) {
|
||||
$max_descr = 10;
|
||||
}
|
||||
|
||||
foreach ($vars['idb'] as $ifid)
|
||||
{
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
$rrdfile = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile))
|
||||
{
|
||||
if (strstr($inverse, "b")) { $in = "OUT"; $out = "IN"; } else { $in = "IN"; $out = "OUT"; }
|
||||
$rrd_options .= " DEF:inoctetsb" . $i . "=" . $rrdfile . ":".$in."OCTETS:AVERAGE";
|
||||
$rrd_options .= " DEF:outoctetsb" . $i . "=" . $rrdfile . ":".$out."OCTETS:AVERAGE";
|
||||
|
||||
$rrd_multi['in_thingb'][] = "inoctetsb" . $i . ",UN,0," . "inoctetsb" . $i . ",IF";
|
||||
$rrd_multi['out_thingb'][] = "outoctetsb" . $i . ",UN,0," . "outoctetsb" . $i . ",IF";
|
||||
include($config['html_dir'] . "/includes/graphs/common.inc.php");
|
||||
|
||||
$i++;
|
||||
}
|
||||
if ($height < "99") {
|
||||
$rrd_options .= " --only-graph";
|
||||
}
|
||||
$i = 1;
|
||||
$rrd_multi = [];
|
||||
foreach ($vars['id'] as $ifid) {
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", [$ifid]);
|
||||
$rrdfile = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile)) {
|
||||
if (strstr($inverse, "a")) {
|
||||
$in = "OUT";
|
||||
$out = "IN";
|
||||
} else {
|
||||
$in = "IN";
|
||||
$out = "OUT";
|
||||
}
|
||||
$rrd_options .= " DEF:inoctets" . $i . "=" . $rrdfile . ":" . $in . "OCTETS:AVERAGE";
|
||||
$rrd_options .= " DEF:outoctets" . $i . "=" . $rrdfile . ":" . $out . "OCTETS:AVERAGE";
|
||||
|
||||
$rrd_multi['in_thing'][] = "inoctets" . $i . ",UN,0," . "inoctets" . $i . ",IF";
|
||||
$rrd_multi['out_thing'][] = "outoctets" . $i . ",UN,0," . "outoctets" . $i . ",IF";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($vars['idc'] as $ifid)
|
||||
{
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
$rrdfile = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile))
|
||||
{
|
||||
if (strstr($inverse, "c")) { $in = "OUT"; $out = "IN"; } else { $in = "IN"; $out = "OUT"; }
|
||||
$rrd_options .= " DEF:inoctetsc" . $i . "=" . $rrdfile . ":".$in."OCTETS:AVERAGE";
|
||||
$rrd_options .= " DEF:outoctetsc" . $i . "=" . $rrdfile . ":".$out."OCTETS:AVERAGE";
|
||||
foreach ($vars['idb'] as $ifid) {
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", [$ifid]);
|
||||
$rrdfile = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile)) {
|
||||
if (strstr($inverse, "b")) {
|
||||
$in = "OUT";
|
||||
$out = "IN";
|
||||
} else {
|
||||
$in = "IN";
|
||||
$out = "OUT";
|
||||
}
|
||||
$rrd_options .= " DEF:inoctetsb" . $i . "=" . $rrdfile . ":" . $in . "OCTETS:AVERAGE";
|
||||
$rrd_options .= " DEF:outoctetsb" . $i . "=" . $rrdfile . ":" . $out . "OCTETS:AVERAGE";
|
||||
|
||||
$rrd_multi['in_thingc'][] = "inoctetsc" . $i . ",UN,0," . "inoctetsc" . $i . ",IF";
|
||||
$rrd_multi['out_thingc'][] = "outoctetsc" . $i . ",UN,0," . "outoctetsc" . $i . ",IF";
|
||||
$rrd_multi['in_thingb'][] = "inoctetsb" . $i . ",UN,0," . "inoctetsb" . $i . ",IF";
|
||||
$rrd_multi['out_thingb'][] = "outoctetsb" . $i . ",UN,0," . "outoctetsb" . $i . ",IF";
|
||||
|
||||
$i++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
foreach(array('', 'b', 'c') as $trio)
|
||||
{
|
||||
$in_name = 'in_thing'.$trio;
|
||||
$out_name = 'out_thing'.$trio;
|
||||
$pluses_name = 'pluses'.$trio;
|
||||
$$in_name = implode(',', $rrd_multi[$in_name]);
|
||||
$$out_name = implode(',', $rrd_multi[$out_name]);
|
||||
$$pluses_name = str_repeat(',ADDNAN', safe_count($rrd_multi[$in_name]) - 1);
|
||||
unset($in_name, $out_name, $pluses_name);
|
||||
foreach ($vars['idc'] as $ifid) {
|
||||
$int = dbFetchRow("SELECT `ifIndex`, `hostname`, D.`device_id` FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id", [$ifid]);
|
||||
$rrdfile = get_port_rrdfilename($int, NULL, TRUE);
|
||||
if (rrd_is_file($rrdfile)) {
|
||||
if (strstr($inverse, "c")) {
|
||||
$in = "OUT";
|
||||
$out = "IN";
|
||||
} else {
|
||||
$in = "IN";
|
||||
$out = "OUT";
|
||||
}
|
||||
$rrd_options .= " DEF:inoctetsc" . $i . "=" . $rrdfile . ":" . $in . "OCTETS:AVERAGE";
|
||||
$rrd_options .= " DEF:outoctetsc" . $i . "=" . $rrdfile . ":" . $out . "OCTETS:AVERAGE";
|
||||
|
||||
$rrd_multi['in_thingc'][] = "inoctetsc" . $i . ",UN,0," . "inoctetsc" . $i . ",IF";
|
||||
$rrd_multi['out_thingc'][] = "outoctetsc" . $i . ",UN,0," . "outoctetsc" . $i . ",IF";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (['', 'b', 'c'] as $trio) {
|
||||
$in_name = 'in_thing' . $trio;
|
||||
$out_name = 'out_thing' . $trio;
|
||||
$pluses_name = 'pluses' . $trio;
|
||||
$$in_name = implode(',', $rrd_multi[$in_name]);
|
||||
$$out_name = implode(',', $rrd_multi[$out_name]);
|
||||
$$pluses_name = str_repeat(',ADDNAN', safe_count($rrd_multi[$in_name]) - 1);
|
||||
unset($in_name, $out_name, $pluses_name);
|
||||
}
|
||||
|
||||
$rrd_options .= " CDEF:inoctets=" . $in_thing . $pluses;
|
||||
@ -146,21 +180,21 @@ $rrd_options .= " CDEF:doutbits_stot=outbits_stot,-1,*";
|
||||
$rrd_options .= " CDEF:doutbits_tot=outbits_tot,-1,*";
|
||||
$rrd_options .= " CDEF:nothing=outbits_tot,outbits_tot,-";
|
||||
|
||||
$rrd_options .= " COMMENT:'".str_pad('%age', $max_descr)." Last Avg Min Max'\\n";
|
||||
$rrd_options .= " COMMENT:'" . str_pad('%age', $max_descr) . " Last Avg Min Max'\\n";
|
||||
|
||||
$rrd_options .= " AREA:perc_a#".$vars['colour_a'].":'".str_pad($vars['descr_a'], $max_descr)."'";
|
||||
$rrd_options .= " AREA:perc_a#" . $vars['colour_a'] . ":'" . str_pad($vars['descr_a'], $max_descr) . "'";
|
||||
$rrd_options .= " GPRINT:perc_a:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:perc_a:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:perc_a:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:perc_a:MAX:%6.2lf%s\\l";
|
||||
|
||||
$rrd_options .= " AREA:perc_b#".$vars['colour_b'].":'".str_pad($vars['descr_b'], $max_descr)."':STACK";
|
||||
$rrd_options .= " AREA:perc_b#" . $vars['colour_b'] . ":'" . str_pad($vars['descr_b'], $max_descr) . "':STACK";
|
||||
$rrd_options .= " GPRINT:perc_b:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:perc_b:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:perc_b:MIN:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:perc_b:MAX:%6.2lf%s\\l";
|
||||
|
||||
$rrd_options .= " AREA:perc_c#".$vars['colour_c'].":'".str_pad($vars['descr_c'], $max_descr)."':STACK";
|
||||
$rrd_options .= " AREA:perc_c#" . $vars['colour_c'] . ":'" . str_pad($vars['descr_c'], $max_descr) . "':STACK";
|
||||
$rrd_options .= " GPRINT:perc_c:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:perc_c:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:perc_c:MIN:%6.2lf%s";
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,50 +6,46 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
$units = '';
|
||||
$unit_text = 'Discards/sec';
|
||||
$units = '';
|
||||
$unit_text = 'Discards/sec';
|
||||
$total_units = '';
|
||||
$colours_in = 'purples';
|
||||
$multiplier = "1";
|
||||
$colours_in = 'purples';
|
||||
$multiplier = "1";
|
||||
$colours_out = 'oranges';
|
||||
|
||||
$ds_in = "INDISCARDS";
|
||||
$ds_in = "INDISCARDS";
|
||||
$ds_out = "OUTDISCARDS";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
$i = 1;
|
||||
|
||||
$rrd_list = array();
|
||||
$rrd_list = [];
|
||||
|
||||
foreach ($vars['id'] as $ifid)
|
||||
{
|
||||
if (strstr($ifid, "!"))
|
||||
{
|
||||
$rrd_inverted[$i] = TRUE;
|
||||
$ifid = str_replace("!", "", $ifid);
|
||||
}
|
||||
foreach ($vars['id'] as $ifid) {
|
||||
if (strstr($ifid, "!")) {
|
||||
$rrd_inverted[$i] = TRUE;
|
||||
$ifid = str_replace("!", "", $ifid);
|
||||
}
|
||||
|
||||
$port = dbFetchRow("SELECT * FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
humanize_port($port);
|
||||
$rrd_file = get_port_rrdfilename($port, NULL, TRUE);
|
||||
if (rrd_is_file($rrd_file))
|
||||
{
|
||||
$rrd_list[$i]['filename'] = $rrd_file;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label_short'];
|
||||
$rrd_list[$i]['ds_in'] = $ds_in;
|
||||
$rrd_list[$i]['ds_out'] = $ds_out;
|
||||
$i++;
|
||||
}
|
||||
$port = dbFetchRow("SELECT `ports`.*, `devices`.`hostname` FROM `ports` LEFT JOIN `devices` USING(`device_id`) WHERE `ports`.`port_id` = ?", [ $ifid ]);
|
||||
//humanize_port($port);
|
||||
$rrd_file = get_port_rrdfilename($port, NULL, TRUE);
|
||||
if (rrd_is_file($rrd_file)) {
|
||||
$rrd_list[$i]['filename'] = $rrd_file;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label_short'];
|
||||
$rrd_list[$i]['ds_in'] = $ds_in;
|
||||
$rrd_list[$i]['ds_out'] = $ds_out;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_separated.inc.php");
|
||||
include($config['html_dir'] . "/includes/graphs/generic_multi_separated.inc.php");
|
||||
|
||||
// EOF
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,50 +6,46 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
$units = '';
|
||||
$unit_text = 'Packets/sec';
|
||||
$units = '';
|
||||
$unit_text = 'Packets/sec';
|
||||
$total_units = '';
|
||||
$colours_in = 'reds';
|
||||
$multiplier = "1";
|
||||
$colours_in = 'reds';
|
||||
$multiplier = "1";
|
||||
$colours_out = 'red2';
|
||||
|
||||
$ds_in = "INERRORS";
|
||||
$ds_in = "INERRORS";
|
||||
$ds_out = "OUTERRORS";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
$i = 1;
|
||||
|
||||
$rrd_list = array();
|
||||
$rrd_list = [];
|
||||
|
||||
foreach ($vars['id'] as $ifid)
|
||||
{
|
||||
if (strstr($ifid, "!"))
|
||||
{
|
||||
$rrd_inverted[$i] = TRUE;
|
||||
$ifid = str_replace("!", "", $ifid);
|
||||
}
|
||||
foreach ($vars['id'] as $ifid) {
|
||||
if (strstr($ifid, "!")) {
|
||||
$rrd_inverted[$i] = TRUE;
|
||||
$ifid = str_replace("!", "", $ifid);
|
||||
}
|
||||
|
||||
$port = dbFetchRow("SELECT * FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
humanize_port($port);
|
||||
$rrd_file = get_port_rrdfilename($port, NULL, TRUE);
|
||||
if (rrd_is_file($rrd_file))
|
||||
{
|
||||
$rrd_list[$i]['filename'] = $rrd_file;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label_short'];
|
||||
$rrd_list[$i]['ds_in'] = $ds_in;
|
||||
$rrd_list[$i]['ds_out'] = $ds_out;
|
||||
$i++;
|
||||
}
|
||||
$port = dbFetchRow("SELECT `ports`.*, `devices`.`hostname` FROM `ports` LEFT JOIN `devices` USING(`device_id`) WHERE `ports`.`port_id` = ?", [ $ifid ]);
|
||||
//humanize_port($port);
|
||||
$rrd_file = get_port_rrdfilename($port, NULL, TRUE);
|
||||
if (rrd_is_file($rrd_file)) {
|
||||
$rrd_list[$i]['filename'] = $rrd_file;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label_short'];
|
||||
$rrd_list[$i]['ds_in'] = $ds_in;
|
||||
$rrd_list[$i]['ds_out'] = $ds_out;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_separated.inc.php");
|
||||
include($config['html_dir'] . "/includes/graphs/generic_multi_separated.inc.php");
|
||||
|
||||
// EOF
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
@ -17,39 +16,41 @@ $multiplier = 8;
|
||||
|
||||
//r($vars['data']);
|
||||
|
||||
foreach($vars['data'] as $entry)
|
||||
{
|
||||
$rrds = array();
|
||||
foreach (get_group_entities($entry['group_id']) as $port)
|
||||
{
|
||||
$port = get_port_by_id_cache($port);
|
||||
$device = device_by_id_cache($port['device_id']);
|
||||
$filename = get_port_rrdfilename($port, NULL, TRUE);
|
||||
foreach ($vars['data'] as $entry) {
|
||||
$rrds = [];
|
||||
foreach (get_group_entities($entry['group_id'], 'port') as $port_id) {
|
||||
$port = get_port_by_id_cache($port_id);
|
||||
$device = device_by_id_cache($port['device_id']);
|
||||
$filename = get_port_rrdfilename($port, NULL, TRUE);
|
||||
|
||||
if (rrd_is_file($filename))
|
||||
{
|
||||
$rrds[] = array('file' => $filename,
|
||||
'descr' => $device['hostname'] . " " . $port['port_label_short'],
|
||||
'ds_in' => 'INOCTETS',
|
||||
'ds_out' => 'OUTOCTETS');
|
||||
if (rrd_is_file($filename)) {
|
||||
$rrds[] = ['file' => $filename,
|
||||
'descr' => $device['hostname'] . " " . $port['port_label_short'],
|
||||
'ds_in' => 'INOCTETS',
|
||||
'ds_out' => 'OUTOCTETS'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (safe_count($rrds))
|
||||
{
|
||||
$this_data = array('rrds' => $rrds,
|
||||
'colour_in' => $entry['colour'],
|
||||
'colour_out' => adjust_colour_brightness($entry['colour'], 32),
|
||||
'descr' => $entry['descr']);
|
||||
if (safe_count($rrds)) {
|
||||
$this_data = ['rrds' => $rrds,
|
||||
'colour_in' => $entry['colour'],
|
||||
'colour_out' => adjust_colour_brightness($entry['colour'], 32),
|
||||
'descr' => $entry['descr']];
|
||||
|
||||
if($entry['colours']) { $this_data['colours'] = $entry['colours']; }
|
||||
if($entry['colours_in']) { $this_data['colours_in'] = $entry['colours_in']; }
|
||||
if($entry['colours_out']) { $this_data['colours_out'] = $entry['colours_out']; }
|
||||
if ($entry['colours']) {
|
||||
$this_data['colours'] = $entry['colours'];
|
||||
}
|
||||
if ($entry['colours_in']) {
|
||||
$this_data['colours_in'] = $entry['colours_in'];
|
||||
}
|
||||
if ($entry['colours_out']) {
|
||||
$this_data['colours_out'] = $entry['colours_out'];
|
||||
}
|
||||
|
||||
$data[] = $this_data;
|
||||
$data[] = $this_data;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_group_bits.inc.php");
|
||||
include($config['html_dir'] . "/includes/graphs/generic_multi_group_bits.inc.php");
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,38 +6,40 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
if (!is_array($vars['id'])) { $vars['id'] = array($vars['id']); }
|
||||
if (!is_array($vars['id'])) {
|
||||
$vars['id'] = [$vars['id']];
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
|
||||
foreach ($vars['id'] as $ifid)
|
||||
{
|
||||
$port = dbFetchRow("SELECT * FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
$rrdfile = get_port_rrdfilename($port, "ipv6-octets", TRUE);
|
||||
if (rrd_is_file($rrdfile))
|
||||
{
|
||||
humanize_port($port);
|
||||
$rrd_list[$i]['filename'] = $rrdfile;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'] . " " . $port['ifDescr'];
|
||||
$rrd_list[$i]['descr_in'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label_short']; // Options sets for skip htmlentities
|
||||
$i++;
|
||||
}
|
||||
$sql = 'SELECT `ports`.*, `devices`.`hostname` FROM `ports` LEFT JOIN `devices` USING (`device_id`) WHERE ' .
|
||||
generate_query_values($vars['id'], 'ports.port_id');
|
||||
foreach (dbFetchRows($sql) as $port) {
|
||||
//$port = dbFetchRow("SELECT * FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", [$ifid]);
|
||||
$rrdfile = get_port_rrdfilename($port, "ipv6-octets", TRUE);
|
||||
if (rrd_is_file($rrdfile)) {
|
||||
//humanize_port($port);
|
||||
$rrd_list[$i]['filename'] = $rrdfile;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'] . " " . $port['ifDescr'];
|
||||
$rrd_list[$i]['descr_in'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label_short']; // Options sets for skip htmlentities
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$units = 'b';
|
||||
$total_units='B';
|
||||
$colours_in='greens';
|
||||
$multiplier = "8";
|
||||
$units = 'b';
|
||||
$total_units = 'B';
|
||||
$colours_in = 'greens';
|
||||
$multiplier = "8";
|
||||
$colours_out = 'blues';
|
||||
|
||||
$ds_in = "InOctets";
|
||||
$ds_out = "OutOctets";
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_bits_separated.inc.php");
|
||||
include($config['html_dir'] . "/includes/graphs/generic_multi_bits_separated.inc.php");
|
||||
|
||||
// EOF
|
||||
|
@ -5,18 +5,18 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
$units = '';
|
||||
$unit_text = 'Packets/sec';
|
||||
$units = '';
|
||||
$unit_text = 'Packets/sec';
|
||||
$total_units = '';
|
||||
$colours_in = 'purples';
|
||||
$multiplier = "1";
|
||||
$colours_in = 'purples';
|
||||
$multiplier = "1";
|
||||
$colours_out = 'oranges';
|
||||
|
||||
|
||||
@ -27,31 +27,28 @@ $nototal = 1;
|
||||
|
||||
$i = 1;
|
||||
|
||||
$rrd_list = array();
|
||||
$rrd_list = [];
|
||||
|
||||
foreach ($vars['id'] as $ifid)
|
||||
{
|
||||
if (strstr($ifid, "!"))
|
||||
{
|
||||
$rrd_inverted[$i] = TRUE;
|
||||
$ifid = str_replace("!", "", $ifid);
|
||||
}
|
||||
foreach ($vars['id'] as $ifid) {
|
||||
if (strstr($ifid, "!")) {
|
||||
$rrd_inverted[$i] = TRUE;
|
||||
$ifid = str_replace("!", "", $ifid);
|
||||
}
|
||||
|
||||
$port = dbFetchRow("SELECT * FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
humanize_port($port);
|
||||
$rrd_file = get_port_rrdfilename($port, NULL, TRUE);
|
||||
if (rrd_is_file($rrd_file))
|
||||
{
|
||||
$rrd_list[$i]['filename'] = $rrd_file;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label'];
|
||||
$rrd_list[$i]['ds_in'] = $ds_in;
|
||||
$rrd_list[$i]['ds_out'] = $ds_out;
|
||||
$i++;
|
||||
}
|
||||
$port = dbFetchRow("SELECT * FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", [$ifid]);
|
||||
humanize_port($port);
|
||||
$rrd_file = get_port_rrdfilename($port, NULL, TRUE);
|
||||
if (rrd_is_file($rrd_file)) {
|
||||
$rrd_list[$i]['filename'] = $rrd_file;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label'];
|
||||
$rrd_list[$i]['ds_in'] = $ds_in;
|
||||
$rrd_list[$i]['ds_out'] = $ds_out;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_separated.inc.php");
|
||||
include($config['html_dir'] . "/includes/graphs/generic_multi_separated.inc.php");
|
||||
|
||||
// EOF
|
||||
|
@ -5,52 +5,49 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
$units = '';
|
||||
$unit_text = 'Packets/sec';
|
||||
$units = '';
|
||||
$unit_text = 'Packets/sec';
|
||||
$total_units = '';
|
||||
$colours_in = 'purples';
|
||||
$multiplier = "1";
|
||||
$colours_in = 'purples';
|
||||
$multiplier = "1";
|
||||
$colours_out = 'oranges';
|
||||
|
||||
$ds_in = "INUCASTPKTS";
|
||||
$ds_in = "INUCASTPKTS";
|
||||
$ds_out = "OUTUCASTPKTS";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
$i = 1;
|
||||
|
||||
$rrd_list = array();
|
||||
$rrd_list = [];
|
||||
|
||||
foreach ($vars['id'] as $ifid)
|
||||
{
|
||||
if (strstr($ifid, "!"))
|
||||
{
|
||||
$rrd_inverted[$i] = TRUE;
|
||||
$ifid = str_replace("!", "", $ifid);
|
||||
}
|
||||
foreach ($vars['id'] as $ifid) {
|
||||
if (strstr($ifid, "!")) {
|
||||
$rrd_inverted[$i] = TRUE;
|
||||
$ifid = str_replace("!", "", $ifid);
|
||||
}
|
||||
|
||||
$port = dbFetchRow("SELECT * FROM `ports` AS I, devices AS D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
|
||||
humanize_port($port);
|
||||
$rrd_file = get_port_rrdfilename($port, NULL, TRUE);
|
||||
if (rrd_is_file($rrd_file))
|
||||
{
|
||||
$rrd_list[$i]['filename'] = $rrd_file;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label'];
|
||||
$rrd_list[$i]['ds_in'] = $ds_in;
|
||||
$rrd_list[$i]['ds_out'] = $ds_out;
|
||||
$i++;
|
||||
}
|
||||
$port = dbFetchRow("SELECT `ports`.*, `devices`.`hostname` FROM `ports` LEFT JOIN `devices` USING(`device_id`) WHERE `ports`.`port_id` = ?", [ $ifid ]);
|
||||
//humanize_port($port);
|
||||
$rrd_file = get_port_rrdfilename($port, NULL, TRUE);
|
||||
if (rrd_is_file($rrd_file)) {
|
||||
$rrd_list[$i]['filename'] = $rrd_file;
|
||||
$rrd_list[$i]['descr'] = $port['hostname'];
|
||||
$rrd_list[$i]['descr_out'] = $port['port_label'];
|
||||
$rrd_list[$i]['ds_in'] = $ds_in;
|
||||
$rrd_list[$i]['ds_out'] = $ds_out;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_separated.inc.php");
|
||||
include($config['html_dir'] . "/includes/graphs/generic_multi_separated.inc.php");
|
||||
|
||||
// EOF
|
||||
|
Reference in New Issue
Block a user