rrdimage: Add scripts for new graph display method

This patch adds two scripts which will later be used to display graphs:

-> getrrdimage.cgi: Generates PNG images for graphs.
Until now, each CGI with embedded graphs had to be able to output
images. These functions are now gathered in this new script.
The additional parameter handling can be removed and the CGIs can
be simplified. This makes it easier to use and output the graphs.

-> rrdimage.js: Interactive Javascript functions
This allows the user to select time ranges without reloading the page.
In addition, the graphs are now periodically updated, allowing users
to live monitor the data.

Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Leo-Andres Hofmann
2021-04-01 15:35:14 +02:00
committed by Michael Tremer
parent abd8ff79e6
commit 910f1e8494
4 changed files with 377 additions and 2 deletions

View File

@@ -29,6 +29,12 @@ require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
# Graph image size in pixel
our %image_size = ('width' => 910, 'height' => 300);
# List of all available time ranges
our @time_ranges = ("hour", "day", "week", "month", "year");
my $ERROR;
my @GRAPH_ARGS = (
@@ -48,8 +54,8 @@ my @GRAPH_ARGS = (
"-W www.ipfire.org",
# Default size
"-w 910",
"-h 300",
"-w $image_size{'width'}",
"-h $image_size{'height'}",
# Use alternative grid
"--alt-y-grid",