2009-10-02 15:10:32 +00:00
|
|
|
<?php
|
|
|
|
|
2019-05-31 07:43:12 -05:00
|
|
|
use LibreNMS\Util\Clean;
|
2020-05-21 21:04:54 -03:00
|
|
|
use LibreNMS\Config;
|
2019-05-31 07:43:12 -05:00
|
|
|
|
2019-08-22 16:23:24 -05:00
|
|
|
if ($_GET['from']) {
|
|
|
|
$from = parse_at_time($_GET['from']);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($_GET['to']) {
|
|
|
|
$to = parse_at_time($_GET['to']);
|
|
|
|
}
|
2015-07-13 20:10:26 +02:00
|
|
|
|
|
|
|
if ($_GET['width']) {
|
2019-05-31 07:43:12 -05:00
|
|
|
$width = (int)$_GET['width'];
|
2015-07-13 20:10:26 +02:00
|
|
|
}
|
|
|
|
|
2019-06-23 00:29:12 -05:00
|
|
|
if (\LibreNMS\Config::get('trim_tobias')) {
|
2015-07-13 20:10:26 +02:00
|
|
|
$width += 12;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($_GET['height']) {
|
2019-05-31 07:43:12 -05:00
|
|
|
$height = (int)$_GET['height'];
|
2015-07-13 20:10:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($_GET['inverse']) {
|
|
|
|
$in = 'out';
|
|
|
|
$out = 'in';
|
|
|
|
$inverse = true;
|
2016-08-18 20:28:22 -05:00
|
|
|
} else {
|
2015-07-13 20:10:26 +02:00
|
|
|
$in = 'in';
|
|
|
|
$out = 'out';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($_GET['legend'] == 'no') {
|
|
|
|
$rrd_options .= ' -g';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_GET['nototal'])) {
|
|
|
|
$nototal = ((bool) $_GET['nototal']);
|
2016-08-18 20:28:22 -05:00
|
|
|
} else {
|
2015-07-13 20:10:26 +02:00
|
|
|
$nototal = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_GET['nodetails'])) {
|
|
|
|
$nodetails = ((bool) $_GET['nodetails']);
|
2016-08-18 20:28:22 -05:00
|
|
|
} else {
|
2015-07-13 20:10:26 +02:00
|
|
|
$nodetails = false;
|
|
|
|
}
|
2009-10-27 13:04:16 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if (isset($_GET['noagg'])) {
|
|
|
|
$noagg = ((bool) $_GET['noagg']);
|
2016-08-18 20:28:22 -05:00
|
|
|
} else {
|
2015-07-13 20:10:26 +02:00
|
|
|
$noagg = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($_GET['title'] == 'yes') {
|
|
|
|
$rrd_options .= " --title='".$graph_title."' ";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_GET['graph_title'])) {
|
2019-05-31 07:43:12 -05:00
|
|
|
$rrd_options .= " --title='" . Clean::alphaDashSpace($_GET['graph_title']) . "' ";
|
2015-07-13 20:10:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!isset($scale_min) && !isset($scale_max)) {
|
|
|
|
$rrd_options .= ' --alt-autoscale-max';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isset($scale_min) && !isset($scale_max) && !isset($norigid)) {
|
|
|
|
$rrd_options .= ' --rigid';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($scale_min)) {
|
|
|
|
$rrd_options .= " -l $scale_min";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($scale_max)) {
|
|
|
|
$rrd_options .= " -u $scale_max";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($scale_rigid)) {
|
|
|
|
$rrd_options .= ' -r';
|
|
|
|
}
|
|
|
|
|
2020-06-25 21:51:55 +02:00
|
|
|
if (!isset($float_precision)) {
|
|
|
|
$float_precision = 2;
|
|
|
|
}
|
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
$rrd_options .= ' -E --start '.$from.' --end '.$to.' --width '.$width.' --height '.$height.' ';
|
2020-05-21 21:04:54 -03:00
|
|
|
|
|
|
|
if (Config::get('applied_site_style') == 'dark') {
|
|
|
|
$rrd_options .= \LibreNMS\Config::get('rrdgraph_def_text_dark') . ' -c FONT#' . ltrim(\LibreNMS\Config::get('rrdgraph_def_text_color_dark'), '#');
|
|
|
|
} else {
|
|
|
|
$rrd_options .= \LibreNMS\Config::get('rrdgraph_def_text') . ' -c FONT#' . ltrim(\LibreNMS\Config::get('rrdgraph_def_text_color'), '#');
|
|
|
|
}
|
|
|
|
|
2009-11-11 18:20:32 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($_GET['bg']) {
|
2019-05-31 07:43:12 -05:00
|
|
|
$rrd_options .= ' -c CANVAS#' . Clean::alphaDash($_GET['bg']) . ' ';
|
2015-07-13 20:10:26 +02:00
|
|
|
}
|
2009-10-27 13:04:16 +00:00
|
|
|
|
2016-07-02 00:14:18 +02:00
|
|
|
if ($_GET['font']) {
|
2019-05-31 07:43:12 -05:00
|
|
|
$rrd_options .= ' -c FONT#' . Clean::alphaDash($_GET['font']) . ' ';
|
2016-07-02 00:14:18 +02:00
|
|
|
}
|
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
// $rrd_options .= " -c BACK#FFFFFF";
|
|
|
|
if ($height < '99') {
|
|
|
|
$rrd_options .= ' --only-graph';
|
|
|
|
}
|
2011-03-17 10:57:51 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($width <= '300') {
|
2019-06-23 00:29:12 -05:00
|
|
|
$rrd_options .= ' --font LEGEND:7:' . \LibreNMS\Config::get('mono_font') . ' --font AXIS:6:' . \LibreNMS\Config::get('mono_font');
|
2016-08-18 20:28:22 -05:00
|
|
|
} else {
|
2019-06-23 00:29:12 -05:00
|
|
|
$rrd_options .= ' --font LEGEND:8:' . \LibreNMS\Config::get('mono_font') . ' --font AXIS:7:' . \LibreNMS\Config::get('mono_font');
|
2015-07-13 20:10:26 +02:00
|
|
|
}
|
2010-09-26 22:10:04 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
$rrd_options .= ' --font-render-mode normal';
|
2015-09-06 10:59:44 +01:00
|
|
|
|
|
|
|
if (isset($_GET['absolute']) && $_GET['absolute'] == "1") {
|
|
|
|
$rrd_options .= ' --full-size-mode';
|
|
|
|
}
|