initial commit; version 22.5.12042
This commit is contained in:
43
html/includes/graphs/multi-port/auth.inc.php
Normal file
43
html/includes/graphs/multi-port/auth.inc.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
// FIXME - expand $vars['data']['groups'] for auth. For now only allow for >5
|
||||
|
||||
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);
|
||||
|
||||
// EOF
|
57
html/includes/graphs/multi-port/bcastpkts.inc.php
Normal file
57
html/includes/graphs/multi-port/bcastpkts.inc.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
$units = '';
|
||||
$unit_text = 'Packets/sec';
|
||||
$total_units = '';
|
||||
$colours_in = 'purples';
|
||||
$multiplier = "1";
|
||||
$colours_out = 'oranges';
|
||||
|
||||
|
||||
$ds_in = "INBROADCASTPKTS";
|
||||
$ds_out = "OUTBROADCASTPKTS";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
$i = 1;
|
||||
|
||||
$rrd_list = array();
|
||||
|
||||
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));
|
||||
|
||||
$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");
|
||||
|
||||
// EOF
|
44
html/includes/graphs/multi-port/bits.inc.php
Normal file
44
html/includes/graphs/multi-port/bits.inc.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
if (!is_array($vars['id'])) { $vars['id'] = array($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++;
|
||||
}
|
||||
}
|
||||
|
||||
$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");
|
||||
|
||||
// EOF
|
145
html/includes/graphs/multi-port/bits_duo.inc.php
Normal file
145
html/includes/graphs/multi-port/bits_duo.inc.php
Normal file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
// 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['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 ($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,*";
|
||||
$rrd_options .= " CDEF:doutbits=doutoctets,8,*";
|
||||
$rrd_options .= " CDEF:doutoctetsb=outoctetsb,-1,*";
|
||||
$rrd_options .= " CDEF:inbitsb=inoctetsb,8,*";
|
||||
$rrd_options .= " CDEF:outbitsb=outoctetsb,8,*";
|
||||
$rrd_options .= " CDEF:doutbitsb=doutoctetsb,8,*";
|
||||
$rrd_options .= " CDEF:inbits_tot=inbits,inbitsb,+";
|
||||
$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:";
|
||||
# $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:";
|
||||
} 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 .= " 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 .= " 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:";
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// EOF
|
66
html/includes/graphs/multi-port/bits_duo_separate.inc.php
Normal file
66
html/includes/graphs/multi-port/bits_duo_separate.inc.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
if (!is_array($vars['id'])) { $vars['id'] = array($vars['id']); }
|
||||
if (!is_array($vars['idb'])) { $vars['idb'] = array($vars['idb']); }
|
||||
|
||||
$i = 0;
|
||||
|
||||
$groups[0]['ports'] = $vars['id'];
|
||||
$groups[0]['colours_in'] = 'oranges';
|
||||
$groups[0]['colours_out'] = 'red2';
|
||||
|
||||
$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'];
|
||||
|
||||
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";
|
||||
|
||||
#$nototal = 1;
|
||||
|
||||
$ds_in = "INOCTETS";
|
||||
$ds_out = "OUTOCTETS";
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_bits_separated.inc.php");
|
||||
|
||||
// EOF
|
45
html/includes/graphs/multi-port/bits_old.inc.php
Normal file
45
html/includes/graphs/multi-port/bits_old.inc.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
if (!is_array($vars['id'])) { $vars['id'] = array($vars['id']); }
|
||||
|
||||
$i = 1;
|
||||
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
||||
$ds_in = "INOCTETS";
|
||||
$ds_out = "OUTOCTETS";
|
||||
|
||||
$colour_line_in = "006600";
|
||||
$colour_line_out = "000099";
|
||||
$colour_area_in = "91B13C";
|
||||
$colour_area_out = "8080BD";
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_data.inc.php");
|
||||
|
||||
// EOF
|
39
html/includes/graphs/multi-port/bits_separate.inc.php
Normal file
39
html/includes/graphs/multi-port/bits_separate.inc.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
$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++;
|
||||
}
|
||||
}
|
||||
|
||||
$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");
|
||||
|
||||
// EOF
|
198
html/includes/graphs/multi-port/bits_trio.inc.php
Normal file
198
html/includes/graphs/multi-port/bits_trio.inc.php
Normal file
@ -0,0 +1,198 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
// 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++;
|
||||
}
|
||||
}
|
||||
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
|
||||
$rrd_multi['in_thingc'][] = "inoctetsc" . $i . ",UN,0," . "inoctetsc" . $i . ",IF";
|
||||
$rrd_multi['out_thingc'][] = "outoctetsc" . $i . ",UN,0," . "outoctetsc" . $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);
|
||||
}
|
||||
|
||||
$rrd_options .= " CDEF:inoctets=" . $in_thing . $pluses;
|
||||
$rrd_options .= " CDEF:outoctets=" . $out_thing . $pluses;
|
||||
$rrd_options .= " CDEF:inoctetsb=" . $in_thingb . $plusesb;
|
||||
$rrd_options .= " CDEF:outoctetsb=" . $out_thingb . $plusesb;
|
||||
$rrd_options .= " CDEF:inoctetsc=" . $in_thingc . $plusesc;
|
||||
$rrd_options .= " CDEF:outoctetsc=" . $out_thingc . $plusesc;
|
||||
$rrd_options .= " CDEF:doutoctets=outoctets,-1,*";
|
||||
$rrd_options .= " CDEF:inbits=inoctets,8,*";
|
||||
$rrd_options .= " CDEF:outbits=outoctets,8,*";
|
||||
$rrd_options .= " CDEF:doutbits=doutoctets,8,*";
|
||||
$rrd_options .= " CDEF:doutoctetsb=outoctetsb,-1,*";
|
||||
$rrd_options .= " CDEF:inbitsb=inoctetsb,8,*";
|
||||
$rrd_options .= " CDEF:outbitsb=outoctetsb,8,*";
|
||||
$rrd_options .= " CDEF:doutbitsb=doutoctetsb,8,*";
|
||||
$rrd_options .= " CDEF:doutoctetsc=outoctetsc,-1,*";
|
||||
$rrd_options .= " CDEF:inbitsc=inoctetsc,8,*";
|
||||
$rrd_options .= " CDEF:outbitsc=outoctetsc,8,*";
|
||||
$rrd_options .= " CDEF:doutbitsc=doutoctetsc,8,*";
|
||||
$rrd_options .= " CDEF:inbits_tot=inbits,inbitsb,inbitsc,+,+";
|
||||
$rrd_options .= " CDEF:outbits_tot=outbits,outbitsb,outbitsc,+,+";
|
||||
$rrd_options .= " CDEF:inbits_stot=inbitsc,inbitsb,+";
|
||||
$rrd_options .= " CDEF:outbits_stot=outbitsc,outbitsb,+";
|
||||
$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:";
|
||||
} 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:'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";
|
||||
}
|
||||
|
||||
|
||||
// Clean
|
||||
unset($rrd_multi, $in_thing, $out_thing, $pluses, $in_thingb, $out_thingb, $plusesb, $in_thingc, $out_thingc, $plusesc);
|
||||
|
||||
// EOF
|
254
html/includes/graphs/multi-port/bits_trio_compare.inc.php
Normal file
254
html/includes/graphs/multi-port/bits_trio_compare.inc.php
Normal file
@ -0,0 +1,254 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
// 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 (!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 ($vars['legend']) { $legend = $vars['legend']; }
|
||||
|
||||
$descr_lens = array(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++;
|
||||
}
|
||||
}
|
||||
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
|
||||
$rrd_multi['in_thingc'][] = "inoctetsc" . $i . ",UN,0," . "inoctetsc" . $i . ",IF";
|
||||
$rrd_multi['out_thingc'][] = "outoctetsc" . $i . ",UN,0," . "outoctetsc" . $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);
|
||||
}
|
||||
|
||||
$rrd_options .= " CDEF:inoctets=" . $in_thing . $pluses;
|
||||
$rrd_options .= " CDEF:outoctets=" . $out_thing . $pluses;
|
||||
$rrd_options .= " CDEF:inoctetsb=" . $in_thingb . $plusesb;
|
||||
$rrd_options .= " CDEF:outoctetsb=" . $out_thingb . $plusesb;
|
||||
$rrd_options .= " CDEF:inoctetsc=" . $in_thingc . $plusesc;
|
||||
$rrd_options .= " CDEF:outoctetsc=" . $out_thingc . $plusesc;
|
||||
|
||||
$rrd_options .= " CDEF:outoctetst=outoctets,outoctetsb,outoctetsc,+,+";
|
||||
$rrd_options .= " CDEF:inoctetst=inoctets,inoctetsb,inoctetsc,+,+";
|
||||
|
||||
$rrd_options .= " CDEF:octets_total=inoctetst,outoctetst,+";
|
||||
|
||||
$rrd_options .= " CDEF:in_perc_a=inoctets,inoctetst,/,100,*";
|
||||
$rrd_options .= " CDEF:in_perc_b=inoctetsb,inoctetst,/,100,*";
|
||||
$rrd_options .= " CDEF:in_perc_c=inoctetsc,inoctetst,/,100,*";
|
||||
|
||||
$rrd_options .= " CDEF:out_perc_a=outoctets,outoctetst,/,100,*";
|
||||
$rrd_options .= " CDEF:out_perc_b=outoctetsb,outoctetst,/,100,*";
|
||||
$rrd_options .= " CDEF:out_perc_c=outoctetsc,outoctetst,/,100,*";
|
||||
|
||||
$rrd_options .= " CDEF:perc_a=inoctets,outoctets,+,octets_total,/,100,*";
|
||||
$rrd_options .= " CDEF:perc_b=inoctetsb,outoctetsb,+,octets_total,/,100,*";
|
||||
$rrd_options .= " CDEF:perc_c=inoctetsc,outoctetsc,+,octets_total,/,100,*";
|
||||
|
||||
|
||||
$rrd_options .= " CDEF:doutoctets=outoctets,-1,*";
|
||||
$rrd_options .= " CDEF:inbits=inoctets,8,*";
|
||||
$rrd_options .= " CDEF:outbits=outoctets,8,*";
|
||||
$rrd_options .= " CDEF:doutbits=doutoctets,8,*";
|
||||
$rrd_options .= " CDEF:doutoctetsb=outoctetsb,-1,*";
|
||||
$rrd_options .= " CDEF:inbitsb=inoctetsb,8,*";
|
||||
$rrd_options .= " CDEF:outbitsb=outoctetsb,8,*";
|
||||
$rrd_options .= " CDEF:doutbitsb=doutoctetsb,8,*";
|
||||
$rrd_options .= " CDEF:doutoctetsc=outoctetsc,-1,*";
|
||||
$rrd_options .= " CDEF:inbitsc=inoctetsc,8,*";
|
||||
$rrd_options .= " CDEF:outbitsc=outoctetsc,8,*";
|
||||
$rrd_options .= " CDEF:doutbitsc=doutoctetsc,8,*";
|
||||
$rrd_options .= " CDEF:inbits_tot=inbits,inbitsb,inbitsc,+,+";
|
||||
$rrd_options .= " CDEF:outbits_tot=outbits,outbitsb,outbitsc,+,+";
|
||||
$rrd_options .= " CDEF:inbits_stot=inbitsc,inbitsb,+";
|
||||
$rrd_options .= " CDEF:outbits_stot=outbitsc,outbitsb,+";
|
||||
$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 .= " 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 .= " 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 .= " 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";
|
||||
$rrd_options .= " GPRINT:perc_c:MAX:%6.2lf%s\\l";
|
||||
|
||||
|
||||
/*
|
||||
if ($legend == "no" && FALSE)
|
||||
{
|
||||
$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:'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";
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
// Clean
|
||||
unset($rrd_multi, $in_thing, $out_thing, $pluses, $in_thingb, $out_thingb, $plusesb, $in_thingc, $out_thingc, $plusesc);
|
||||
|
||||
// EOF
|
56
html/includes/graphs/multi-port/discards.inc.php
Normal file
56
html/includes/graphs/multi-port/discards.inc.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
$units = '';
|
||||
$unit_text = 'Discards/sec';
|
||||
$total_units = '';
|
||||
$colours_in = 'purples';
|
||||
$multiplier = "1";
|
||||
$colours_out = 'oranges';
|
||||
|
||||
$ds_in = "INDISCARDS";
|
||||
$ds_out = "OUTDISCARDS";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
$i = 1;
|
||||
|
||||
$rrd_list = array();
|
||||
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_separated.inc.php");
|
||||
|
||||
// EOF
|
56
html/includes/graphs/multi-port/errors.inc.php
Normal file
56
html/includes/graphs/multi-port/errors.inc.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
$units = '';
|
||||
$unit_text = 'Packets/sec';
|
||||
$total_units = '';
|
||||
$colours_in = 'reds';
|
||||
$multiplier = "1";
|
||||
$colours_out = 'red2';
|
||||
|
||||
$ds_in = "INERRORS";
|
||||
$ds_out = "OUTERRORS";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
$i = 1;
|
||||
|
||||
$rrd_list = array();
|
||||
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_separated.inc.php");
|
||||
|
||||
// EOF
|
55
html/includes/graphs/multi-port/groups_bits.inc.php
Normal file
55
html/includes/graphs/multi-port/groups_bits.inc.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
//$vars['data'] = json_decode($vars['data'], TRUE);
|
||||
|
||||
$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);
|
||||
|
||||
if (rrd_is_file($filename))
|
||||
{
|
||||
$rrds[] = array('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($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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_group_bits.inc.php");
|
44
html/includes/graphs/multi-port/ipv6_bits.inc.php
Normal file
44
html/includes/graphs/multi-port/ipv6_bits.inc.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
if (!is_array($vars['id'])) { $vars['id'] = array($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++;
|
||||
}
|
||||
}
|
||||
|
||||
$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");
|
||||
|
||||
// EOF
|
57
html/includes/graphs/multi-port/mcastpkts.inc.php
Normal file
57
html/includes/graphs/multi-port/mcastpkts.inc.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
$units = '';
|
||||
$unit_text = 'Packets/sec';
|
||||
$total_units = '';
|
||||
$colours_in = 'purples';
|
||||
$multiplier = "1";
|
||||
$colours_out = 'oranges';
|
||||
|
||||
|
||||
$ds_in = "INMULTICASTPKTS";
|
||||
$ds_out = "OUTMULTICASTPKTS";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
$i = 1;
|
||||
|
||||
$rrd_list = array();
|
||||
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_separated.inc.php");
|
||||
|
||||
// EOF
|
56
html/includes/graphs/multi-port/upkts.inc.php
Normal file
56
html/includes/graphs/multi-port/upkts.inc.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage graphs
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
$units = '';
|
||||
$unit_text = 'Packets/sec';
|
||||
$total_units = '';
|
||||
$colours_in = 'purples';
|
||||
$multiplier = "1";
|
||||
$colours_out = 'oranges';
|
||||
|
||||
$ds_in = "INUCASTPKTS";
|
||||
$ds_out = "OUTUCASTPKTS";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
$i = 1;
|
||||
|
||||
$rrd_list = array();
|
||||
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
include($config['html_dir']."/includes/graphs/generic_multi_separated.inc.php");
|
||||
|
||||
// EOF
|
Reference in New Issue
Block a user