Files
librenms-librenms/includes/html/graphs/common.inc.php
T

111 lines
2.4 KiB
PHP
Raw Normal View History

2009-10-02 15:10:32 +00:00
<?php
2019-05-31 07:43:12 -05:00
use LibreNMS\Util\Clean;
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';
}
$rrd_options .= ' -E --start '.$from.' --end '.$to.' --width '.$width.' --height '.$height.' ';
2019-06-23 00:29:12 -05:00
$rrd_options .= \LibreNMS\Config::get('rrdgraph_def_text') . ' -c FONT#' . \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
if ($_GET['font']) {
2019-05-31 07:43:12 -05:00
$rrd_options .= ' -c FONT#' . Clean::alphaDash($_GET['font']) . ' ';
}
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
}
2015-07-13 20:10:26 +02:00
$rrd_options .= ' --font-render-mode normal';
if (isset($_GET['absolute']) && $_GET['absolute'] == "1") {
$rrd_options .= ' --full-size-mode';
}