From 2ada996f95e67f484f28e995cae16e66ce69ed24 Mon Sep 17 00:00:00 2001 From: Georg Hofmann Date: Mon, 1 Apr 2019 11:40:37 +0200 Subject: [PATCH 01/32] Fix bug where the main loop sleeps forever. On some system the alarm & pause sequence breaks with high system loads. --- monitorix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/monitorix b/monitorix index 788dfab..05e55fb 100755 --- a/monitorix +++ b/monitorix @@ -737,9 +737,8 @@ logger("Ok, ready."); # main loop while(1) { - local $SIG{'ALRM'} = sub { }; - alarm(1); - pause(); + + select undef, undef, undef, 1.0; my ($sec, $min, $hour, $mday, $mon, undef, $wday) = localtime(time); From 72c777355b111eca12a12c2961d2ba3041a8ea65 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Tue, 30 Apr 2019 15:22:50 +0200 Subject: [PATCH 02/32] update Changes --- Changes | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Changes b/Changes index a2e99db..b944917 100644 --- a/Changes +++ b/Changes @@ -7,6 +7,9 @@ - Added the ability, in the alerts of 'ambsens.pm', to support a range of two values, separated by a dash, in the threshold. [#221] - Added support for FreeBSD NFS Server stats. [#238] +- Changed the main loop functionality using now the select() function, instead + of the alarm()+pause() pair. This should improve the responsiveness on high + system loads. [#230] - Fixed the copyright year in 'monitorix.cgi'. - Fixed in 'mail.pm to use the option 'mail_log' instead the hard coded path I forgot to remove when adding the Exim support. From 87c102098ff0682c66c401931f1ec81291fcc59d Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Thu, 2 May 2019 11:10:16 +0200 Subject: [PATCH 03/32] many bugs fixed #167 --- lib/phpfpm.pm | 343 ++++++++++++++++++++++++++------------------------ 1 file changed, 176 insertions(+), 167 deletions(-) diff --git a/lib/phpfpm.pm b/lib/phpfpm.pm index 5e13c1b..b72e82d 100644 --- a/lib/phpfpm.pm +++ b/lib/phpfpm.pm @@ -154,6 +154,12 @@ sub phpfpm_update { foreach my $pfg (sort keys %{$phpfpm->{group}}) { my @pfl = split(',', $phpfpm->{list}->{$pfg}); + if(!scalar(@pfl)) { + for($n = 0; $n < 8; $n++) { + $rrdata .= ":0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0"; + } + next; + } for($n = 0; $n < 8; $n++) { my $uptim = 0; my $aconn = 0; @@ -167,11 +173,6 @@ sub phpfpm_update { my $ssl = ""; my $pool = trim($pfl[$n] || ""); - if(!$pool) { - $rrdata .= ":0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0"; - next; - } - my $url = $phpfpm->{desc}->{$pool} || ""; if(!$url) { logger("$myself: ERROR: the pool '$pool' don't has an associated URL."); @@ -310,6 +311,9 @@ sub phpfpm_cgi { push(@output, "
\n");
 		push(@output, "    ");
 		foreach my $pfg (sort keys %{$phpfpm->{group}}) {
+			if(!scalar(my @pfl = split(',', $phpfpm->{list}->{$pfg}))) {
+				next;
+			}
 			$line1 = " ";
 			$line2 .= " ";
 			$line3 .= " ";
@@ -322,10 +326,8 @@ sub phpfpm_cgi {
 				$line3 .= "  aconn  lqueue  mlqueu  idproc  acproc  macpro  mchild  slwreq";
 				$line4 .= "---------------------------------------------------------------";
 			}
-			if($line1) {
-				my $i = length($line1);
-				push(@output, sprintf(sprintf("%${i}s", sprintf("%s", trim($phpfpm->{group}->{$pfg})))));
-			}
+			my $i = length($line1);
+			push(@output, sprintf("%${i}s", sprintf("%s", trim($phpfpm->{group}->{$pfg}))));
 		}
 		push(@output, "\n");
 		push(@output, "    $line2\n");
@@ -344,6 +346,9 @@ sub phpfpm_cgi {
 			push(@output, sprintf(" %2d$tf->{tc} ", $time));
 			$n3 = 0;
 			foreach my $pfg (sort keys %{$phpfpm->{group}}) {
+				if(!scalar(my @pfl = split(',', $phpfpm->{list}->{$pfg}))) {
+					next;
+				}
 				for($n2 = 0; $n2 < scalar(my @pfl = split(',', $phpfpm->{list}->{$pfg})); $n2++) {
 					$from = $n2 * 18 + ($n3 * 144);
 					$to = $from + 18;
@@ -406,10 +411,13 @@ sub phpfpm_cgi {
 		$uptimeline = "COMMENT:uptime: " . uptime2str($uptime) . "\\c";
 	}
 
-	$e = 0;
+	$e = $n2 = 0;
 	foreach my $pfg (sort keys %{$phpfpm->{group}}) {
 		# skip empty lists
-		next if !$phpfpm->{list}->{$pfg};
+		if(!scalar(my @pfl = split(',', $phpfpm->{list}->{$pfg}))) {
+			$n2++;
+			next;
+		}
 
 		if($e) {
 			push(@output, "   
\n"); @@ -427,12 +435,12 @@ sub phpfpm_cgi { $str = trim($pfl[$n]); $str = $phpfpm->{map}->{$str} ? $phpfpm->{map}->{$str} : $str; my $dstr = sprintf("%-25s", substr($str, 0, 25)); - push(@tmp, "LINE2:acon" . $e . "_$n" . $LC[$n] . ":$dstr"); - push(@tmpz, "LINE2:acon" . $e . "_$n" . $LC[$n] . ":$str"); - push(@tmp, "GPRINT:acon" . $e . "_$n" . ":LAST: Cur\\:%5.2lf"); - push(@tmp, "GPRINT:acon" . $e . "_$n" . ":AVERAGE: Avg\\:%5.2lf"); - push(@tmp, "GPRINT:acon" . $e . "_$n" . ":MIN: Min\\:%5.2lf"); - push(@tmp, "GPRINT:acon" . $e . "_$n" . ":MAX: Max\\:%5.2lf\\n"); + push(@tmp, "LINE2:acon" . $n2 . "_$n" . $LC[$n] . ":$dstr"); + push(@tmpz, "LINE2:acon" . $n2 . "_$n" . $LC[$n] . ":$str"); + push(@tmp, "GPRINT:acon" . $n2 . "_$n" . ":LAST: Cur\\:%5.2lf"); + push(@tmp, "GPRINT:acon" . $n2 . "_$n" . ":AVERAGE: Avg\\:%5.2lf"); + push(@tmp, "GPRINT:acon" . $n2 . "_$n" . ":MIN: Min\\:%5.2lf"); + push(@tmp, "GPRINT:acon" . $n2 . "_$n" . ":MAX: Max\\:%5.2lf\\n"); } if($title) { @@ -459,15 +467,15 @@ sub phpfpm_cgi { $zoom, @{$cgi->{version12}}, @{$colors->{graph_colors}}, - "DEF:acon" . $e . "_0=$rrd:phpfpm" . $e . "_aconn0:AVERAGE", - "DEF:acon" . $e . "_1=$rrd:phpfpm" . $e . "_aconn1:AVERAGE", - "DEF:acon" . $e . "_2=$rrd:phpfpm" . $e . "_aconn2:AVERAGE", - "DEF:acon" . $e . "_3=$rrd:phpfpm" . $e . "_aconn3:AVERAGE", - "DEF:acon" . $e . "_4=$rrd:phpfpm" . $e . "_aconn4:AVERAGE", - "DEF:acon" . $e . "_5=$rrd:phpfpm" . $e . "_aconn5:AVERAGE", - "DEF:acon" . $e . "_6=$rrd:phpfpm" . $e . "_aconn6:AVERAGE", - "DEF:acon" . $e . "_7=$rrd:phpfpm" . $e . "_aconn7:AVERAGE", - "CDEF:allvalues=acon" . $e . "_0,acon" . $e . "_1,acon" . $e . "_2,acon" . $e . "_3,acon" . $e . "_4,acon" . $e . "_5,acon" . $e . "_6,acon" . $e . "_7,+,+,+,+,+,+,+", + "DEF:acon" . $n2 . "_0=$rrd:phpfpm" . $n2 . "_aconn0:AVERAGE", + "DEF:acon" . $n2 . "_1=$rrd:phpfpm" . $n2 . "_aconn1:AVERAGE", + "DEF:acon" . $n2 . "_2=$rrd:phpfpm" . $n2 . "_aconn2:AVERAGE", + "DEF:acon" . $n2 . "_3=$rrd:phpfpm" . $n2 . "_aconn3:AVERAGE", + "DEF:acon" . $n2 . "_4=$rrd:phpfpm" . $n2 . "_aconn4:AVERAGE", + "DEF:acon" . $n2 . "_5=$rrd:phpfpm" . $n2 . "_aconn5:AVERAGE", + "DEF:acon" . $n2 . "_6=$rrd:phpfpm" . $n2 . "_aconn6:AVERAGE", + "DEF:acon" . $n2 . "_7=$rrd:phpfpm" . $n2 . "_aconn7:AVERAGE", + "CDEF:allvalues=acon" . $n2 . "_0,acon" . $n2 . "_1,acon" . $n2 . "_2,acon" . $n2 . "_3,acon" . $n2 . "_4,acon" . $n2 . "_5,acon" . $n2 . "_6,acon" . $n2 . "_7,+,+,+,+,+,+,+", @CDEF, @tmp, $uptimeline); @@ -486,15 +494,15 @@ sub phpfpm_cgi { $zoom, @{$cgi->{version12}}, @{$colors->{graph_colors}}, - "DEF:acon" . $e . "_0=$rrd:phpfpm" . $e . "_aconn0:AVERAGE", - "DEF:acon" . $e . "_1=$rrd:phpfpm" . $e . "_aconn1:AVERAGE", - "DEF:acon" . $e . "_2=$rrd:phpfpm" . $e . "_aconn2:AVERAGE", - "DEF:acon" . $e . "_3=$rrd:phpfpm" . $e . "_aconn3:AVERAGE", - "DEF:acon" . $e . "_4=$rrd:phpfpm" . $e . "_aconn4:AVERAGE", - "DEF:acon" . $e . "_5=$rrd:phpfpm" . $e . "_aconn5:AVERAGE", - "DEF:acon" . $e . "_6=$rrd:phpfpm" . $e . "_aconn6:AVERAGE", - "DEF:acon" . $e . "_7=$rrd:phpfpm" . $e . "_aconn7:AVERAGE", - "CDEF:allvalues=acon" . $e . "_0,acon" . $e . "_1,acon" . $e . "_2,acon" . $e . "_3,acon" . $e . "_4,acon" . $e . "_5,acon" . $e . "_6,acon" . $e . "_7,+,+,+,+,+,+,+", + "DEF:acon" . $n2 . "_0=$rrd:phpfpm" . $n2 . "_aconn0:AVERAGE", + "DEF:acon" . $n2 . "_1=$rrd:phpfpm" . $n2 . "_aconn1:AVERAGE", + "DEF:acon" . $n2 . "_2=$rrd:phpfpm" . $n2 . "_aconn2:AVERAGE", + "DEF:acon" . $n2 . "_3=$rrd:phpfpm" . $n2 . "_aconn3:AVERAGE", + "DEF:acon" . $n2 . "_4=$rrd:phpfpm" . $n2 . "_aconn4:AVERAGE", + "DEF:acon" . $n2 . "_5=$rrd:phpfpm" . $n2 . "_aconn5:AVERAGE", + "DEF:acon" . $n2 . "_6=$rrd:phpfpm" . $n2 . "_aconn6:AVERAGE", + "DEF:acon" . $n2 . "_7=$rrd:phpfpm" . $n2 . "_aconn7:AVERAGE", + "CDEF:allvalues=acon" . $n2 . "_0,acon" . $n2 . "_1,acon" . $n2 . "_2,acon" . $n2 . "_3,acon" . $n2 . "_4,acon" . $n2 . "_5,acon" . $n2 . "_6,acon" . $n2 . "_7,+,+,+,+,+,+,+", @CDEF, @tmpz); $err = RRDs::error; @@ -528,12 +536,12 @@ sub phpfpm_cgi { $str = trim($pfl[$n]); $str = $phpfpm->{map}->{$str} ? $phpfpm->{map}->{$str} : $str; my $dstr = sprintf("%-25s", substr($str, 0, 25)); - push(@tmp, "LINE2:aproc" . $e . "_$n" . $LC[$n] . ":$dstr"); - push(@tmpz, "LINE2:aproc" . $e . "_$n" . $LC[$n] . ":$str"); - push(@tmp, "GPRINT:aproc" . $e . "_$n" . ":LAST: Cur\\:%5.2lf"); - push(@tmp, "GPRINT:aproc" . $e . "_$n" . ":AVERAGE: Avg\\:%5.2lf"); - push(@tmp, "GPRINT:aproc" . $e . "_$n" . ":MIN: Min\\:%5.2lf"); - push(@tmp, "GPRINT:aproc" . $e . "_$n" . ":MAX: Max\\:%5.2lf\\n"); + push(@tmp, "LINE2:aproc" . $n2 . "_$n" . $LC[$n] . ":$dstr"); + push(@tmpz, "LINE2:aproc" . $n2 . "_$n" . $LC[$n] . ":$str"); + push(@tmp, "GPRINT:aproc" . $n2 . "_$n" . ":LAST: Cur\\:%5.2lf"); + push(@tmp, "GPRINT:aproc" . $n2 . "_$n" . ":AVERAGE: Avg\\:%5.2lf"); + push(@tmp, "GPRINT:aproc" . $n2 . "_$n" . ":MIN: Min\\:%5.2lf"); + push(@tmp, "GPRINT:aproc" . $n2 . "_$n" . ":MAX: Max\\:%5.2lf\\n"); } if(lc($config->{show_gaps}) eq "y") { push(@tmp, "AREA:wrongdata#$colors->{gap}:"); @@ -555,15 +563,15 @@ sub phpfpm_cgi { $zoom, @{$cgi->{version12}}, @{$colors->{graph_colors}}, - "DEF:aproc" . $e . "_0=$rrd:phpfpm" . $e . "_aproc0:AVERAGE", - "DEF:aproc" . $e . "_1=$rrd:phpfpm" . $e . "_aproc1:AVERAGE", - "DEF:aproc" . $e . "_2=$rrd:phpfpm" . $e . "_aproc2:AVERAGE", - "DEF:aproc" . $e . "_3=$rrd:phpfpm" . $e . "_aproc3:AVERAGE", - "DEF:aproc" . $e . "_4=$rrd:phpfpm" . $e . "_aproc4:AVERAGE", - "DEF:aproc" . $e . "_5=$rrd:phpfpm" . $e . "_aproc5:AVERAGE", - "DEF:aproc" . $e . "_6=$rrd:phpfpm" . $e . "_aproc6:AVERAGE", - "DEF:aproc" . $e . "_7=$rrd:phpfpm" . $e . "_aproc7:AVERAGE", - "CDEF:allvalues=aproc" . $e . "_0,aproc" . $e . "_1,aproc" . $e . "_2,aproc" . $e . "_3,aproc" . $e . "_4,aproc" . $e . "_5,aproc" . $e . "_6,aproc" . $e . "_7,+,+,+,+,+,+,+", + "DEF:aproc" . $n2 . "_0=$rrd:phpfpm" . $n2 . "_aproc0:AVERAGE", + "DEF:aproc" . $n2 . "_1=$rrd:phpfpm" . $n2 . "_aproc1:AVERAGE", + "DEF:aproc" . $n2 . "_2=$rrd:phpfpm" . $n2 . "_aproc2:AVERAGE", + "DEF:aproc" . $n2 . "_3=$rrd:phpfpm" . $n2 . "_aproc3:AVERAGE", + "DEF:aproc" . $n2 . "_4=$rrd:phpfpm" . $n2 . "_aproc4:AVERAGE", + "DEF:aproc" . $n2 . "_5=$rrd:phpfpm" . $n2 . "_aproc5:AVERAGE", + "DEF:aproc" . $n2 . "_6=$rrd:phpfpm" . $n2 . "_aproc6:AVERAGE", + "DEF:aproc" . $n2 . "_7=$rrd:phpfpm" . $n2 . "_aproc7:AVERAGE", + "CDEF:allvalues=aproc" . $n2 . "_0,aproc" . $n2 . "_1,aproc" . $n2 . "_2,aproc" . $n2 . "_3,aproc" . $n2 . "_4,aproc" . $n2 . "_5,aproc" . $n2 . "_6,aproc" . $n2 . "_7,+,+,+,+,+,+,+", @CDEF, @tmp); $err = RRDs::error; @@ -581,15 +589,15 @@ sub phpfpm_cgi { $zoom, @{$cgi->{version12}}, @{$colors->{graph_colors}}, - "DEF:aproc" . $e . "_0=$rrd:phpfpm" . $e . "_aproc0:AVERAGE", - "DEF:aproc" . $e . "_1=$rrd:phpfpm" . $e . "_aproc1:AVERAGE", - "DEF:aproc" . $e . "_2=$rrd:phpfpm" . $e . "_aproc2:AVERAGE", - "DEF:aproc" . $e . "_3=$rrd:phpfpm" . $e . "_aproc3:AVERAGE", - "DEF:aproc" . $e . "_4=$rrd:phpfpm" . $e . "_aproc4:AVERAGE", - "DEF:aproc" . $e . "_5=$rrd:phpfpm" . $e . "_aproc5:AVERAGE", - "DEF:aproc" . $e . "_6=$rrd:phpfpm" . $e . "_aproc6:AVERAGE", - "DEF:aproc" . $e . "_7=$rrd:phpfpm" . $e . "_aproc7:AVERAGE", - "CDEF:allvalues=aproc" . $e . "_0,aproc" . $e . "_1,aproc" . $e . "_2,aproc" . $e . "_3,aproc" . $e . "_4,aproc" . $e . "_5,aproc" . $e . "_6,aproc" . $e . "_7,+,+,+,+,+,+,+", + "DEF:aproc" . $n2 . "_0=$rrd:phpfpm" . $n2 . "_aproc0:AVERAGE", + "DEF:aproc" . $n2 . "_1=$rrd:phpfpm" . $n2 . "_aproc1:AVERAGE", + "DEF:aproc" . $n2 . "_2=$rrd:phpfpm" . $n2 . "_aproc2:AVERAGE", + "DEF:aproc" . $n2 . "_3=$rrd:phpfpm" . $n2 . "_aproc3:AVERAGE", + "DEF:aproc" . $n2 . "_4=$rrd:phpfpm" . $n2 . "_aproc4:AVERAGE", + "DEF:aproc" . $n2 . "_5=$rrd:phpfpm" . $n2 . "_aproc5:AVERAGE", + "DEF:aproc" . $n2 . "_6=$rrd:phpfpm" . $n2 . "_aproc6:AVERAGE", + "DEF:aproc" . $n2 . "_7=$rrd:phpfpm" . $n2 . "_aproc7:AVERAGE", + "CDEF:allvalues=aproc" . $n2 . "_0,aproc" . $n2 . "_1,aproc" . $n2 . "_2,aproc" . $n2 . "_3,aproc" . $n2 . "_4,aproc" . $n2 . "_5,aproc" . $n2 . "_6,aproc" . $n2 . "_7,+,+,+,+,+,+,+", @CDEF, @tmpz); $err = RRDs::error; @@ -628,8 +636,8 @@ sub phpfpm_cgi { $str = trim($pfl[$n]); $str = $phpfpm->{map}->{$str} ? $phpfpm->{map}->{$str} : $str; my $dstr = substr($str, 0, 25); - push(@tmp, "LINE2:lqueue" . $e . "_$n" . $LC[$n] . ":$dstr"); - push(@tmpz, "LINE2:lqueue" . $e . "_$n" . $LC[$n] . ":$str\\g"); + push(@tmp, "LINE2:lqueue" . $n2 . "_$n" . $LC[$n] . ":$dstr"); + push(@tmpz, "LINE2:lqueue" . $n2 . "_$n" . $LC[$n] . ":$str\\g"); } if(lc($config->{show_gaps}) eq "y") { push(@tmp, "AREA:wrongdata#$colors->{gap}:"); @@ -649,15 +657,15 @@ sub phpfpm_cgi { @{$cgi->{version12}}, @{$cgi->{version12_small}}, @{$colors->{graph_colors}}, - "DEF:lqueue" . $e . "_0=$rrd:phpfpm" . $e . "_lqueu0:AVERAGE", - "DEF:lqueue" . $e . "_1=$rrd:phpfpm" . $e . "_lqueu1:AVERAGE", - "DEF:lqueue" . $e . "_2=$rrd:phpfpm" . $e . "_lqueu2:AVERAGE", - "DEF:lqueue" . $e . "_3=$rrd:phpfpm" . $e . "_lqueu3:AVERAGE", - "DEF:lqueue" . $e . "_4=$rrd:phpfpm" . $e . "_lqueu4:AVERAGE", - "DEF:lqueue" . $e . "_5=$rrd:phpfpm" . $e . "_lqueu5:AVERAGE", - "DEF:lqueue" . $e . "_6=$rrd:phpfpm" . $e . "_lqueu6:AVERAGE", - "DEF:lqueue" . $e . "_7=$rrd:phpfpm" . $e . "_lqueu7:AVERAGE", - "CDEF:allvalues=lqueue" . $e . "_0,lqueue" . $e . "_1,lqueue" . $e . "_2,lqueue" . $e . "_3,lqueue" . $e . "_4,lqueue" . $e . "_5,lqueue" . $e . "_6,lqueue" . $e . "_7,+,+,+,+,+,+,+", + "DEF:lqueue" . $n2 . "_0=$rrd:phpfpm" . $n2 . "_lqueu0:AVERAGE", + "DEF:lqueue" . $n2 . "_1=$rrd:phpfpm" . $n2 . "_lqueu1:AVERAGE", + "DEF:lqueue" . $n2 . "_2=$rrd:phpfpm" . $n2 . "_lqueu2:AVERAGE", + "DEF:lqueue" . $n2 . "_3=$rrd:phpfpm" . $n2 . "_lqueu3:AVERAGE", + "DEF:lqueue" . $n2 . "_4=$rrd:phpfpm" . $n2 . "_lqueu4:AVERAGE", + "DEF:lqueue" . $n2 . "_5=$rrd:phpfpm" . $n2 . "_lqueu5:AVERAGE", + "DEF:lqueue" . $n2 . "_6=$rrd:phpfpm" . $n2 . "_lqueu6:AVERAGE", + "DEF:lqueue" . $n2 . "_7=$rrd:phpfpm" . $n2 . "_lqueu7:AVERAGE", + "CDEF:allvalues=lqueue" . $n2 . "_0,lqueue" . $n2 . "_1,lqueue" . $n2 . "_2,lqueue" . $n2 . "_3,lqueue" . $n2 . "_4,lqueue" . $n2 . "_5,lqueue" . $n2 . "_6,lqueue" . $n2 . "_7,+,+,+,+,+,+,+", @CDEF, @tmp); $err = RRDs::error; @@ -676,15 +684,15 @@ sub phpfpm_cgi { @{$cgi->{version12}}, @{$cgi->{version12_small}}, @{$colors->{graph_colors}}, - "DEF:lqueue" . $e . "_0=$rrd:phpfpm" . $e . "_lqueu0:AVERAGE", - "DEF:lqueue" . $e . "_1=$rrd:phpfpm" . $e . "_lqueu1:AVERAGE", - "DEF:lqueue" . $e . "_2=$rrd:phpfpm" . $e . "_lqueu2:AVERAGE", - "DEF:lqueue" . $e . "_3=$rrd:phpfpm" . $e . "_lqueu3:AVERAGE", - "DEF:lqueue" . $e . "_4=$rrd:phpfpm" . $e . "_lqueu4:AVERAGE", - "DEF:lqueue" . $e . "_5=$rrd:phpfpm" . $e . "_lqueu5:AVERAGE", - "DEF:lqueue" . $e . "_6=$rrd:phpfpm" . $e . "_lqueu6:AVERAGE", - "DEF:lqueue" . $e . "_7=$rrd:phpfpm" . $e . "_lqueu7:AVERAGE", - "CDEF:allvalues=lqueue" . $e . "_0,lqueue" . $e . "_1,lqueue" . $e . "_2,lqueue" . $e . "_3,lqueue" . $e . "_4,lqueue" . $e . "_5,lqueue" . $e . "_6,lqueue" . $e . "_7,+,+,+,+,+,+,+", + "DEF:lqueue" . $n2 . "_0=$rrd:phpfpm" . $n2 . "_lqueu0:AVERAGE", + "DEF:lqueue" . $n2 . "_1=$rrd:phpfpm" . $n2 . "_lqueu1:AVERAGE", + "DEF:lqueue" . $n2 . "_2=$rrd:phpfpm" . $n2 . "_lqueu2:AVERAGE", + "DEF:lqueue" . $n2 . "_3=$rrd:phpfpm" . $n2 . "_lqueu3:AVERAGE", + "DEF:lqueue" . $n2 . "_4=$rrd:phpfpm" . $n2 . "_lqueu4:AVERAGE", + "DEF:lqueue" . $n2 . "_5=$rrd:phpfpm" . $n2 . "_lqueu5:AVERAGE", + "DEF:lqueue" . $n2 . "_6=$rrd:phpfpm" . $n2 . "_lqueu6:AVERAGE", + "DEF:lqueue" . $n2 . "_7=$rrd:phpfpm" . $n2 . "_lqueu7:AVERAGE", + "CDEF:allvalues=lqueue" . $n2 . "_0,lqueue" . $n2 . "_1,lqueue" . $n2 . "_2,lqueue" . $n2 . "_3,lqueue" . $n2 . "_4,lqueue" . $n2 . "_5,lqueue" . $n2 . "_6,lqueue" . $n2 . "_7,+,+,+,+,+,+,+", @CDEF, @tmpz); $err = RRDs::error; @@ -739,30 +747,30 @@ sub phpfpm_cgi { @{$cgi->{version12}}, @{$cgi->{version12_small}}, @{$colors->{graph_colors}}, - "DEF:iproc" . $e . "_0=$rrd:phpfpm" . $e . "_iproc0:AVERAGE", - "DEF:iproc" . $e . "_1=$rrd:phpfpm" . $e . "_iproc1:AVERAGE", - "DEF:iproc" . $e . "_2=$rrd:phpfpm" . $e . "_iproc2:AVERAGE", - "DEF:iproc" . $e . "_3=$rrd:phpfpm" . $e . "_iproc3:AVERAGE", - "DEF:iproc" . $e . "_4=$rrd:phpfpm" . $e . "_iproc4:AVERAGE", - "DEF:iproc" . $e . "_5=$rrd:phpfpm" . $e . "_iproc5:AVERAGE", - "DEF:iproc" . $e . "_6=$rrd:phpfpm" . $e . "_iproc6:AVERAGE", - "DEF:iproc" . $e . "_7=$rrd:phpfpm" . $e . "_iproc7:AVERAGE", - "DEF:aproc" . $e . "_0=$rrd:phpfpm" . $e . "_aproc0:AVERAGE", - "DEF:aproc" . $e . "_1=$rrd:phpfpm" . $e . "_aproc1:AVERAGE", - "DEF:aproc" . $e . "_2=$rrd:phpfpm" . $e . "_aproc2:AVERAGE", - "DEF:aproc" . $e . "_3=$rrd:phpfpm" . $e . "_aproc3:AVERAGE", - "DEF:aproc" . $e . "_4=$rrd:phpfpm" . $e . "_aproc4:AVERAGE", - "DEF:aproc" . $e . "_5=$rrd:phpfpm" . $e . "_aproc5:AVERAGE", - "DEF:aproc" . $e . "_6=$rrd:phpfpm" . $e . "_aproc6:AVERAGE", - "DEF:aproc" . $e . "_7=$rrd:phpfpm" . $e . "_aproc7:AVERAGE", - "CDEF:tproc0=iproc" . $e . "_0,aproc" . $e . "_0,+", - "CDEF:tproc1=iproc" . $e . "_1,aproc" . $e . "_1,+", - "CDEF:tproc2=iproc" . $e . "_2,aproc" . $e . "_2,+", - "CDEF:tproc3=iproc" . $e . "_3,aproc" . $e . "_3,+", - "CDEF:tproc4=iproc" . $e . "_4,aproc" . $e . "_4,+", - "CDEF:tproc5=iproc" . $e . "_5,aproc" . $e . "_5,+", - "CDEF:tproc6=iproc" . $e . "_6,aproc" . $e . "_6,+", - "CDEF:tproc7=iproc" . $e . "_7,aproc" . $e . "_6,+", + "DEF:iproc" . $n2 . "_0=$rrd:phpfpm" . $n2 . "_iproc0:AVERAGE", + "DEF:iproc" . $n2 . "_1=$rrd:phpfpm" . $n2 . "_iproc1:AVERAGE", + "DEF:iproc" . $n2 . "_2=$rrd:phpfpm" . $n2 . "_iproc2:AVERAGE", + "DEF:iproc" . $n2 . "_3=$rrd:phpfpm" . $n2 . "_iproc3:AVERAGE", + "DEF:iproc" . $n2 . "_4=$rrd:phpfpm" . $n2 . "_iproc4:AVERAGE", + "DEF:iproc" . $n2 . "_5=$rrd:phpfpm" . $n2 . "_iproc5:AVERAGE", + "DEF:iproc" . $n2 . "_6=$rrd:phpfpm" . $n2 . "_iproc6:AVERAGE", + "DEF:iproc" . $n2 . "_7=$rrd:phpfpm" . $n2 . "_iproc7:AVERAGE", + "DEF:aproc" . $n2 . "_0=$rrd:phpfpm" . $n2 . "_aproc0:AVERAGE", + "DEF:aproc" . $n2 . "_1=$rrd:phpfpm" . $n2 . "_aproc1:AVERAGE", + "DEF:aproc" . $n2 . "_2=$rrd:phpfpm" . $n2 . "_aproc2:AVERAGE", + "DEF:aproc" . $n2 . "_3=$rrd:phpfpm" . $n2 . "_aproc3:AVERAGE", + "DEF:aproc" . $n2 . "_4=$rrd:phpfpm" . $n2 . "_aproc4:AVERAGE", + "DEF:aproc" . $n2 . "_5=$rrd:phpfpm" . $n2 . "_aproc5:AVERAGE", + "DEF:aproc" . $n2 . "_6=$rrd:phpfpm" . $n2 . "_aproc6:AVERAGE", + "DEF:aproc" . $n2 . "_7=$rrd:phpfpm" . $n2 . "_aproc7:AVERAGE", + "CDEF:tproc0=iproc" . $n2 . "_0,aproc" . $n2 . "_0,+", + "CDEF:tproc1=iproc" . $n2 . "_1,aproc" . $n2 . "_1,+", + "CDEF:tproc2=iproc" . $n2 . "_2,aproc" . $n2 . "_2,+", + "CDEF:tproc3=iproc" . $n2 . "_3,aproc" . $n2 . "_3,+", + "CDEF:tproc4=iproc" . $n2 . "_4,aproc" . $n2 . "_4,+", + "CDEF:tproc5=iproc" . $n2 . "_5,aproc" . $n2 . "_5,+", + "CDEF:tproc6=iproc" . $n2 . "_6,aproc" . $n2 . "_6,+", + "CDEF:tproc7=iproc" . $n2 . "_7,aproc" . $n2 . "_6,+", "CDEF:allvalues=tproc0,tproc1,tproc2,tproc3,tproc4,tproc5,tproc6,tproc7,+,+,+,+,+,+,+", @CDEF, @tmp); @@ -782,30 +790,30 @@ sub phpfpm_cgi { @{$cgi->{version12}}, @{$cgi->{version12_small}}, @{$colors->{graph_colors}}, - "DEF:iproc" . $e . "_0=$rrd:phpfpm" . $e . "_iproc0:AVERAGE", - "DEF:iproc" . $e . "_1=$rrd:phpfpm" . $e . "_iproc1:AVERAGE", - "DEF:iproc" . $e . "_2=$rrd:phpfpm" . $e . "_iproc2:AVERAGE", - "DEF:iproc" . $e . "_3=$rrd:phpfpm" . $e . "_iproc3:AVERAGE", - "DEF:iproc" . $e . "_4=$rrd:phpfpm" . $e . "_iproc4:AVERAGE", - "DEF:iproc" . $e . "_5=$rrd:phpfpm" . $e . "_iproc5:AVERAGE", - "DEF:iproc" . $e . "_6=$rrd:phpfpm" . $e . "_iproc6:AVERAGE", - "DEF:iproc" . $e . "_7=$rrd:phpfpm" . $e . "_iproc7:AVERAGE", - "DEF:aproc" . $e . "_0=$rrd:phpfpm" . $e . "_aproc0:AVERAGE", - "DEF:aproc" . $e . "_1=$rrd:phpfpm" . $e . "_aproc1:AVERAGE", - "DEF:aproc" . $e . "_2=$rrd:phpfpm" . $e . "_aproc2:AVERAGE", - "DEF:aproc" . $e . "_3=$rrd:phpfpm" . $e . "_aproc3:AVERAGE", - "DEF:aproc" . $e . "_4=$rrd:phpfpm" . $e . "_aproc4:AVERAGE", - "DEF:aproc" . $e . "_5=$rrd:phpfpm" . $e . "_aproc5:AVERAGE", - "DEF:aproc" . $e . "_6=$rrd:phpfpm" . $e . "_aproc6:AVERAGE", - "DEF:aproc" . $e . "_7=$rrd:phpfpm" . $e . "_aproc7:AVERAGE", - "CDEF:tproc0=iproc" . $e . "_0,aproc" . $e . "_0,+", - "CDEF:tproc1=iproc" . $e . "_1,aproc" . $e . "_1,+", - "CDEF:tproc2=iproc" . $e . "_2,aproc" . $e . "_2,+", - "CDEF:tproc3=iproc" . $e . "_3,aproc" . $e . "_3,+", - "CDEF:tproc4=iproc" . $e . "_4,aproc" . $e . "_4,+", - "CDEF:tproc5=iproc" . $e . "_5,aproc" . $e . "_5,+", - "CDEF:tproc6=iproc" . $e . "_6,aproc" . $e . "_6,+", - "CDEF:tproc7=iproc" . $e . "_7,aproc" . $e . "_6,+", + "DEF:iproc" . $n2 . "_0=$rrd:phpfpm" . $n2 . "_iproc0:AVERAGE", + "DEF:iproc" . $n2 . "_1=$rrd:phpfpm" . $n2 . "_iproc1:AVERAGE", + "DEF:iproc" . $n2 . "_2=$rrd:phpfpm" . $n2 . "_iproc2:AVERAGE", + "DEF:iproc" . $n2 . "_3=$rrd:phpfpm" . $n2 . "_iproc3:AVERAGE", + "DEF:iproc" . $n2 . "_4=$rrd:phpfpm" . $n2 . "_iproc4:AVERAGE", + "DEF:iproc" . $n2 . "_5=$rrd:phpfpm" . $n2 . "_iproc5:AVERAGE", + "DEF:iproc" . $n2 . "_6=$rrd:phpfpm" . $n2 . "_iproc6:AVERAGE", + "DEF:iproc" . $n2 . "_7=$rrd:phpfpm" . $n2 . "_iproc7:AVERAGE", + "DEF:aproc" . $n2 . "_0=$rrd:phpfpm" . $n2 . "_aproc0:AVERAGE", + "DEF:aproc" . $n2 . "_1=$rrd:phpfpm" . $n2 . "_aproc1:AVERAGE", + "DEF:aproc" . $n2 . "_2=$rrd:phpfpm" . $n2 . "_aproc2:AVERAGE", + "DEF:aproc" . $n2 . "_3=$rrd:phpfpm" . $n2 . "_aproc3:AVERAGE", + "DEF:aproc" . $n2 . "_4=$rrd:phpfpm" . $n2 . "_aproc4:AVERAGE", + "DEF:aproc" . $n2 . "_5=$rrd:phpfpm" . $n2 . "_aproc5:AVERAGE", + "DEF:aproc" . $n2 . "_6=$rrd:phpfpm" . $n2 . "_aproc6:AVERAGE", + "DEF:aproc" . $n2 . "_7=$rrd:phpfpm" . $n2 . "_aproc7:AVERAGE", + "CDEF:tproc0=iproc" . $n2 . "_0,aproc" . $n2 . "_0,+", + "CDEF:tproc1=iproc" . $n2 . "_1,aproc" . $n2 . "_1,+", + "CDEF:tproc2=iproc" . $n2 . "_2,aproc" . $n2 . "_2,+", + "CDEF:tproc3=iproc" . $n2 . "_3,aproc" . $n2 . "_3,+", + "CDEF:tproc4=iproc" . $n2 . "_4,aproc" . $n2 . "_4,+", + "CDEF:tproc5=iproc" . $n2 . "_5,aproc" . $n2 . "_5,+", + "CDEF:tproc6=iproc" . $n2 . "_6,aproc" . $n2 . "_6,+", + "CDEF:tproc7=iproc" . $n2 . "_7,aproc" . $n2 . "_6,+", "CDEF:allvalues=tproc0,tproc1,tproc2,tproc3,tproc4,tproc5,tproc6,tproc7,+,+,+,+,+,+,+", @CDEF, @tmpz); @@ -840,8 +848,8 @@ sub phpfpm_cgi { $str = trim($pfl[$n]); $str = $phpfpm->{map}->{$str} ? $phpfpm->{map}->{$str} : $str; my $dstr = substr($str, 0, 25); - push(@tmp, "LINE2:mchild" . $e . "_$n" . $LC[$n] . ":$dstr"); - push(@tmpz, "LINE2:mchild" . $e . "_$n" . $LC[$n] . ":$str\\g"); + push(@tmp, "LINE2:mchild" . $n2 . "_$n" . $LC[$n] . ":$dstr"); + push(@tmpz, "LINE2:mchild" . $n2 . "_$n" . $LC[$n] . ":$str\\g"); } if(lc($config->{show_gaps}) eq "y") { push(@tmp, "AREA:wrongdata#$colors->{gap}:"); @@ -861,15 +869,15 @@ sub phpfpm_cgi { @{$cgi->{version12}}, @{$cgi->{version12_small}}, @{$colors->{graph_colors}}, - "DEF:mchild" . $e . "_0=$rrd:phpfpm" . $e . "_mchil0:AVERAGE", - "DEF:mchild" . $e . "_1=$rrd:phpfpm" . $e . "_mchil1:AVERAGE", - "DEF:mchild" . $e . "_2=$rrd:phpfpm" . $e . "_mchil2:AVERAGE", - "DEF:mchild" . $e . "_3=$rrd:phpfpm" . $e . "_mchil3:AVERAGE", - "DEF:mchild" . $e . "_4=$rrd:phpfpm" . $e . "_mchil4:AVERAGE", - "DEF:mchild" . $e . "_5=$rrd:phpfpm" . $e . "_mchil5:AVERAGE", - "DEF:mchild" . $e . "_6=$rrd:phpfpm" . $e . "_mchil6:AVERAGE", - "DEF:mchild" . $e . "_7=$rrd:phpfpm" . $e . "_mchil7:AVERAGE", - "CDEF:allvalues=mchild" . $e . "_0,mchild" . $e . "_1,mchild" . $e . "_2,mchild" . $e . "_3,mchild" . $e . "_4,mchild" . $e . "_5,mchild" . $e . "_6,mchild" . $e . "_7,+,+,+,+,+,+,+", + "DEF:mchild" . $n2 . "_0=$rrd:phpfpm" . $n2 . "_mchil0:AVERAGE", + "DEF:mchild" . $n2 . "_1=$rrd:phpfpm" . $n2 . "_mchil1:AVERAGE", + "DEF:mchild" . $n2 . "_2=$rrd:phpfpm" . $n2 . "_mchil2:AVERAGE", + "DEF:mchild" . $n2 . "_3=$rrd:phpfpm" . $n2 . "_mchil3:AVERAGE", + "DEF:mchild" . $n2 . "_4=$rrd:phpfpm" . $n2 . "_mchil4:AVERAGE", + "DEF:mchild" . $n2 . "_5=$rrd:phpfpm" . $n2 . "_mchil5:AVERAGE", + "DEF:mchild" . $n2 . "_6=$rrd:phpfpm" . $n2 . "_mchil6:AVERAGE", + "DEF:mchild" . $n2 . "_7=$rrd:phpfpm" . $n2 . "_mchil7:AVERAGE", + "CDEF:allvalues=mchild" . $n2 . "_0,mchild" . $n2 . "_1,mchild" . $n2 . "_2,mchild" . $n2 . "_3,mchild" . $n2 . "_4,mchild" . $n2 . "_5,mchild" . $n2 . "_6,mchild" . $n2 . "_7,+,+,+,+,+,+,+", @CDEF, @tmp); $err = RRDs::error; @@ -888,15 +896,15 @@ sub phpfpm_cgi { @{$cgi->{version12}}, @{$cgi->{version12_small}}, @{$colors->{graph_colors}}, - "DEF:mchild" . $e . "_0=$rrd:phpfpm" . $e . "_mchil0:AVERAGE", - "DEF:mchild" . $e . "_1=$rrd:phpfpm" . $e . "_mchil1:AVERAGE", - "DEF:mchild" . $e . "_2=$rrd:phpfpm" . $e . "_mchil2:AVERAGE", - "DEF:mchild" . $e . "_3=$rrd:phpfpm" . $e . "_mchil3:AVERAGE", - "DEF:mchild" . $e . "_4=$rrd:phpfpm" . $e . "_mchil4:AVERAGE", - "DEF:mchild" . $e . "_5=$rrd:phpfpm" . $e . "_mchil5:AVERAGE", - "DEF:mchild" . $e . "_6=$rrd:phpfpm" . $e . "_mchil6:AVERAGE", - "DEF:mchild" . $e . "_7=$rrd:phpfpm" . $e . "_mchil7:AVERAGE", - "CDEF:allvalues=mchild" . $e . "_0,mchild" . $e . "_1,mchild" . $e . "_2,mchild" . $e . "_3,mchild" . $e . "_4,mchild" . $e . "_5,mchild" . $e . "_6,mchild" . $e . "_7,+,+,+,+,+,+,+", + "DEF:mchild" . $n2 . "_0=$rrd:phpfpm" . $n2 . "_mchil0:AVERAGE", + "DEF:mchild" . $n2 . "_1=$rrd:phpfpm" . $n2 . "_mchil1:AVERAGE", + "DEF:mchild" . $n2 . "_2=$rrd:phpfpm" . $n2 . "_mchil2:AVERAGE", + "DEF:mchild" . $n2 . "_3=$rrd:phpfpm" . $n2 . "_mchil3:AVERAGE", + "DEF:mchild" . $n2 . "_4=$rrd:phpfpm" . $n2 . "_mchil4:AVERAGE", + "DEF:mchild" . $n2 . "_5=$rrd:phpfpm" . $n2 . "_mchil5:AVERAGE", + "DEF:mchild" . $n2 . "_6=$rrd:phpfpm" . $n2 . "_mchil6:AVERAGE", + "DEF:mchild" . $n2 . "_7=$rrd:phpfpm" . $n2 . "_mchil7:AVERAGE", + "CDEF:allvalues=mchild" . $n2 . "_0,mchild" . $n2 . "_1,mchild" . $n2 . "_2,mchild" . $n2 . "_3,mchild" . $n2 . "_4,mchild" . $n2 . "_5,mchild" . $n2 . "_6,mchild" . $n2 . "_7,+,+,+,+,+,+,+", @CDEF, @tmpz); $err = RRDs::error; @@ -930,8 +938,8 @@ sub phpfpm_cgi { $str = trim($pfl[$n]); $str = $phpfpm->{map}->{$str} ? $phpfpm->{map}->{$str} : $str; my $dstr = substr($str, 0, 25); - push(@tmp, "LINE2:slwreq" . $e . "_$n" . $LC[$n] . ":$dstr"); - push(@tmpz, "LINE2:slwreq" . $e . "_$n" . $LC[$n] . ":$str\\g"); + push(@tmp, "LINE2:slwreq" . $n2 . "_$n" . $LC[$n] . ":$dstr"); + push(@tmpz, "LINE2:slwreq" . $n2 . "_$n" . $LC[$n] . ":$str\\g"); } if(lc($config->{show_gaps}) eq "y") { push(@tmp, "AREA:wrongdata#$colors->{gap}:"); @@ -951,15 +959,15 @@ sub phpfpm_cgi { @{$cgi->{version12}}, @{$cgi->{version12_small}}, @{$colors->{graph_colors}}, - "DEF:slwreq" . $e . "_0=$rrd:phpfpm" . $e . "_slreq0:AVERAGE", - "DEF:slwreq" . $e . "_1=$rrd:phpfpm" . $e . "_slreq1:AVERAGE", - "DEF:slwreq" . $e . "_2=$rrd:phpfpm" . $e . "_slreq2:AVERAGE", - "DEF:slwreq" . $e . "_3=$rrd:phpfpm" . $e . "_slreq3:AVERAGE", - "DEF:slwreq" . $e . "_4=$rrd:phpfpm" . $e . "_slreq4:AVERAGE", - "DEF:slwreq" . $e . "_5=$rrd:phpfpm" . $e . "_slreq5:AVERAGE", - "DEF:slwreq" . $e . "_6=$rrd:phpfpm" . $e . "_slreq6:AVERAGE", - "DEF:slwreq" . $e . "_7=$rrd:phpfpm" . $e . "_slreq7:AVERAGE", - "CDEF:allvalues=slwreq" . $e . "_0,slwreq" . $e . "_1,slwreq" . $e . "_2,slwreq" . $e . "_3,slwreq" . $e . "_4,slwreq" . $e . "_5,slwreq" . $e . "_6,slwreq" . $e . "_7,+,+,+,+,+,+,+", + "DEF:slwreq" . $n2 . "_0=$rrd:phpfpm" . $n2 . "_slreq0:AVERAGE", + "DEF:slwreq" . $n2 . "_1=$rrd:phpfpm" . $n2 . "_slreq1:AVERAGE", + "DEF:slwreq" . $n2 . "_2=$rrd:phpfpm" . $n2 . "_slreq2:AVERAGE", + "DEF:slwreq" . $n2 . "_3=$rrd:phpfpm" . $n2 . "_slreq3:AVERAGE", + "DEF:slwreq" . $n2 . "_4=$rrd:phpfpm" . $n2 . "_slreq4:AVERAGE", + "DEF:slwreq" . $n2 . "_5=$rrd:phpfpm" . $n2 . "_slreq5:AVERAGE", + "DEF:slwreq" . $n2 . "_6=$rrd:phpfpm" . $n2 . "_slreq6:AVERAGE", + "DEF:slwreq" . $n2 . "_7=$rrd:phpfpm" . $n2 . "_slreq7:AVERAGE", + "CDEF:allvalues=slwreq" . $n2 . "_0,slwreq" . $n2 . "_1,slwreq" . $n2 . "_2,slwreq" . $n2 . "_3,slwreq" . $n2 . "_4,slwreq" . $n2 . "_5,slwreq" . $n2 . "_6,slwreq" . $n2 . "_7,+,+,+,+,+,+,+", @CDEF, @tmp); $err = RRDs::error; @@ -978,15 +986,15 @@ sub phpfpm_cgi { @{$cgi->{version12}}, @{$cgi->{version12_small}}, @{$colors->{graph_colors}}, - "DEF:slwreq" . $e . "_0=$rrd:phpfpm" . $e . "_slreq0:AVERAGE", - "DEF:slwreq" . $e . "_1=$rrd:phpfpm" . $e . "_slreq1:AVERAGE", - "DEF:slwreq" . $e . "_2=$rrd:phpfpm" . $e . "_slreq2:AVERAGE", - "DEF:slwreq" . $e . "_3=$rrd:phpfpm" . $e . "_slreq3:AVERAGE", - "DEF:slwreq" . $e . "_4=$rrd:phpfpm" . $e . "_slreq4:AVERAGE", - "DEF:slwreq" . $e . "_5=$rrd:phpfpm" . $e . "_slreq5:AVERAGE", - "DEF:slwreq" . $e . "_6=$rrd:phpfpm" . $e . "_slreq6:AVERAGE", - "DEF:slwreq" . $e . "_7=$rrd:phpfpm" . $e . "_slreq7:AVERAGE", - "CDEF:allvalues=slwreq" . $e . "_0,slwreq" . $e . "_1,slwreq" . $e . "_2,slwreq" . $e . "_3,slwreq" . $e . "_4,slwreq" . $e . "_5,slwreq" . $e . "_6,slwreq" . $e . "_7,+,+,+,+,+,+,+", + "DEF:slwreq" . $n2 . "_0=$rrd:phpfpm" . $n2 . "_slreq0:AVERAGE", + "DEF:slwreq" . $n2 . "_1=$rrd:phpfpm" . $n2 . "_slreq1:AVERAGE", + "DEF:slwreq" . $n2 . "_2=$rrd:phpfpm" . $n2 . "_slreq2:AVERAGE", + "DEF:slwreq" . $n2 . "_3=$rrd:phpfpm" . $n2 . "_slreq3:AVERAGE", + "DEF:slwreq" . $n2 . "_4=$rrd:phpfpm" . $n2 . "_slreq4:AVERAGE", + "DEF:slwreq" . $n2 . "_5=$rrd:phpfpm" . $n2 . "_slreq5:AVERAGE", + "DEF:slwreq" . $n2 . "_6=$rrd:phpfpm" . $n2 . "_slreq6:AVERAGE", + "DEF:slwreq" . $n2 . "_7=$rrd:phpfpm" . $n2 . "_slreq7:AVERAGE", + "CDEF:allvalues=slwreq" . $n2 . "_0,slwreq" . $n2 . "_1,slwreq" . $n2 . "_2,slwreq" . $n2 . "_3,slwreq" . $n2 . "_4,slwreq" . $n2 . "_5,slwreq" . $n2 . "_6,slwreq" . $n2 . "_7,+,+,+,+,+,+,+", @CDEF, @tmpz); $err = RRDs::error; @@ -1027,6 +1035,7 @@ sub phpfpm_cgi { push(@output, main::graph_footer()); } $e++; + $n2++; } push(@output, "
\n"); return @output; From 0619d25ec10b03a9b22f990e5a91907fb100a506 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Thu, 2 May 2019 15:46:57 +0200 Subject: [PATCH 04/32] completely rewritten the 'gensens.pm' module which includes now battery values as its third supported sensor #170 --- lib/gensens.pm | 405 ++++++++++++++++++++----------------------------- monitorix | 8 + monitorix.conf | 16 +- 3 files changed, 186 insertions(+), 243 deletions(-) diff --git a/lib/gensens.pm b/lib/gensens.pm index 8fb569d..384c867 100644 --- a/lib/gensens.pm +++ b/lib/gensens.pm @@ -35,6 +35,7 @@ sub gensens_init { my $gensens = $config->{gensens}; my $info; + my @ds; my @rra; my @tmp; my $n; @@ -47,12 +48,21 @@ sub gensens_init { if(-e $rrd) { $info = RRDs::info($rrd); for my $key (keys %$info) { + if(index($key, 'ds[') == 0) { + if(index($key, '.type') != -1) { + push(@ds, substr($key, 3, index($key, ']') - 3)); + } + } if(index($key, 'rra[') == 0) { if(index($key, '.rows') != -1) { push(@rra, substr($key, 4, index($key, ']') - 4)); } } } + if(scalar(@ds) / 9 != keys %{$gensens->{list}}) { + logger("$myself: Detected size mismatch between 'list' (" . keys(%{$gensens->{list}}) . ") and $rrd (" . scalar(@ds) / 9 . "). Resizing it accordingly. All historical data will be lost. Backup file created."); + rename($rrd, "$rrd.bak"); + } if(scalar(@rra) < 12 + (4 * $config->{max_historic_years})) { logger("$myself: Detected size mismatch between 'max_historic_years' (" . $config->{max_historic_years} . ") and $rrd (" . ((scalar(@rra) -12) / 4) . "). Resizing it accordingly. All historical data will be lost. Backup file created."); rename($rrd, "$rrd.bak"); @@ -67,27 +77,21 @@ sub gensens_init { push(@max, "RRA:MAX:0.5:1440:" . (365 * $n)); push(@last, "RRA:LAST:0.5:1440:" . (365 * $n)); } + for($n = 0; $n < keys %{$gensens->{list}}; $n++) { + push(@tmp, "DS:gensens" . $n . "_s1:GAUGE:120:0:U"); + push(@tmp, "DS:gensens" . $n . "_s2:GAUGE:120:0:U"); + push(@tmp, "DS:gensens" . $n . "_s3:GAUGE:120:0:U"); + push(@tmp, "DS:gensens" . $n . "_s4:GAUGE:120:0:U"); + push(@tmp, "DS:gensens" . $n . "_s5:GAUGE:120:0:U"); + push(@tmp, "DS:gensens" . $n . "_s6:GAUGE:120:0:U"); + push(@tmp, "DS:gensens" . $n . "_s7:GAUGE:120:0:U"); + push(@tmp, "DS:gensens" . $n . "_s8:GAUGE:120:0:U"); + push(@tmp, "DS:gensens" . $n . "_s9:GAUGE:120:0:U") + } eval { RRDs::create($rrd, "--step=60", - "DS:gensens0_s1:GAUGE:120:U:U", - "DS:gensens0_s2:GAUGE:120:U:U", - "DS:gensens0_s3:GAUGE:120:U:U", - "DS:gensens0_s4:GAUGE:120:U:U", - "DS:gensens0_s5:GAUGE:120:U:U", - "DS:gensens0_s6:GAUGE:120:U:U", - "DS:gensens0_s7:GAUGE:120:U:U", - "DS:gensens0_s8:GAUGE:120:U:U", - "DS:gensens0_s9:GAUGE:120:U:U", - "DS:gensens1_s1:GAUGE:120:U:U", - "DS:gensens1_s2:GAUGE:120:U:U", - "DS:gensens1_s3:GAUGE:120:U:U", - "DS:gensens1_s4:GAUGE:120:U:U", - "DS:gensens1_s5:GAUGE:120:U:U", - "DS:gensens1_s6:GAUGE:120:U:U", - "DS:gensens1_s7:GAUGE:120:U:U", - "DS:gensens1_s8:GAUGE:120:U:U", - "DS:gensens1_s9:GAUGE:120:U:U", + @tmp, "RRA:AVERAGE:0.5:1:1440", "RRA:AVERAGE:0.5:30:336", "RRA:AVERAGE:0.5:60:744", @@ -324,20 +328,19 @@ sub gensens_cgi { my $line3; push(@output, "
\n");
 		push(@output, "    ");
-		for($n = 0; $n < 2; $n++) {
+		foreach my $sg (sort keys %{$gensens->{list}}) {
 			$line1 = "";
-			foreach my $i (split(',', $gensens->{list}->{$n})) {
+			foreach my $i (split(',', $gensens->{list}->{$sg})) {
 				$i = trim($i);
 				$str = $i;
-				$str = sprintf("%10s", substr($str, 0, 10));
-				$line1 .= "           ";
-				$line2 .= sprintf(" %10s", $str);
-				$line3 .= "-----------";
+				$str = sprintf("%12s", substr($str, 0, 10));
+				$line1 .= "             ";
+				$line2 .= sprintf(" %12s", $str);
+				$line3 .= "-------------";
 			}
 			if($line1) {
 				my $i = length($line1);
-				$str = "_gensens" . ($n + 1);
-				push(@output, sprintf(sprintf("%${i}s", sprintf("%s", trim($config->{graphs}->{$str})))));
+				push(@output, substr(sprintf("%${i}s", sprintf("%s", trim($gensens->{title}->{$sg}))), 0, 13));
 			}
 		}
 		push(@output, "\n");
@@ -347,22 +350,22 @@ sub gensens_cgi {
 		my @row;
 		my $time;
 		my $n2;
-		my $n3;
 		my $from;
 		my $to;
 		for($n = 0, $time = $tf->{tb}; $n < ($tf->{tb} * $tf->{ts}); $n++) {
 			$line = @$data[$n];
 			$time = $time - (1 / $tf->{ts});
 			push(@output, sprintf(" %2d$tf->{tc} ", $time));
-			for($n2 = 0; $n2 < 2; $n2++) {
-				$n3 = 0;
-				foreach my $i (split(',', $gensens->{list}->{$n2})) {
-					$from = $n2 * 9 + $n3++;
+			foreach my $sg (sort keys %{$gensens->{list}}) {
+				$n2 = 0;
+				foreach my $i (split(',', $gensens->{list}->{$sg})) {
+					$from = $sg * 9 + $n2++;
 					$to = $from + 1;
 					my ($j) = @$line[$from..$to];
-					@row = ($j);
-					push(@output, sprintf("%10d ", @row));
+					@row = ($j || 0);
+					push(@output, sprintf("%12d ", @row));
 				}
+				$n2++;
 			}
 			push(@output, "\n");
 		}
@@ -399,81 +402,78 @@ sub gensens_cgi {
 		}
 	}
 
-	my (@ls, $max, @sg);
-
-	$max = max(scalar(@sg = split(',', $gensens->{list}->{0}), @sg = split(',', $gensens->{list}->{1})));
-
-	# Temperatures
-	if($title) {
-		push(@output, main::graph_header($title, 2));
-		push(@output, "    \n");
-	}
-
-	@riglim = @{setup_riglim($rigid[0], $limit[0])};
-	undef(@tmp);
-	undef(@tmpz);
-	undef(@CDEF);
-	@ls = split(',', $gensens->{list}->{0});
-	for($n = 0; $n < 9; $n++) {
-		my $str = trim($ls[$n] || "");
-		if($str) {
-			$str = $gensens->{map}->{$str} ? $gensens->{map}->{$str} : $str;
-			$str = sprintf("%-20s", substr($str, 0, 20));
-			push(@tmp, "LINE2:gsen" . $n . $LC[$n] . ":$str");
-			push(@tmp, "GPRINT:gsen" . $n . ":LAST: Cur\\:%5.1lf%s");
-			push(@tmp, "GPRINT:gsen" . $n . ":MIN: Min\\:%5.1lf%s");
-			push(@tmp, "GPRINT:gsen" . $n . ":MAX: Max\\:%5.1lf%s\\n");
-			push(@tmpz, "LINE2:gsen" . $n . $LC[$n] . ":$str");
-			next;
+	my @linpad =(0);
+	my $e = 0;
+	foreach my $sg (sort keys %{$gensens->{list}}) {
+		my @ls = split(',', $gensens->{list}->{$sg});
+		$linpad[$e] = scalar(@ls);
+		if($e && $e % 2) {
+			$linpad[$e] = max($linpad[$e - 1], $linpad[$e]);
+			$linpad[$e - 1] = $linpad[$e];
 		}
-		last;
+		$e++;
 	}
-	while($n < $max) {
-		push(@tmp, "COMMENT: \\n");
-		$n++;
-	}
-	if($title) {
-		push(@output, "    \n");
-	}
-	if(lc($config->{show_gaps}) eq "y") {
-		push(@tmp, "AREA:wrongdata#$colors->{gap}:");
-		push(@tmpz, "AREA:wrongdata#$colors->{gap}:");
-		push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF");
-	}
-	($width, $height) = split('x', $config->{graph_size}->{medium});
-	$pic = $rrd{$version}->("$IMG_DIR" . "$IMG[0]",
-		"--title=$config->{graphs}->{_gensens1}  ($tf->{nwhen}$tf->{twhen})",
-		"--start=-$tf->{nwhen}$tf->{twhen}",
-		"--imgformat=$imgfmt_uc",
-		"--vertical-label=$temp_scale",
-		"--width=$width",
-		"--height=$height",
-		@riglim,
-		$zoom,
-		@{$cgi->{version12}},
-		@{$cgi->{version12_small}},
-		@{$colors->{graph_colors}},
-		"DEF:gsen0=$rrd:gensens0_s1:AVERAGE",
-		"DEF:gsen1=$rrd:gensens0_s2:AVERAGE",
-		"DEF:gsen2=$rrd:gensens0_s3:AVERAGE",
-		"DEF:gsen3=$rrd:gensens0_s4:AVERAGE",
-		"DEF:gsen4=$rrd:gensens0_s5:AVERAGE",
-		"DEF:gsen5=$rrd:gensens0_s6:AVERAGE",
-		"DEF:gsen6=$rrd:gensens0_s7:AVERAGE",
-		"DEF:gsen7=$rrd:gensens0_s8:AVERAGE",
-		"DEF:gsen8=$rrd:gensens0_s9:AVERAGE",
-		"CDEF:allvalues=gsen0,gsen1,gsen2,gsen3,gsen4,gsen5,gsen6,gsen7,gsen8,+,+,+,+,+,+,+,+",
-		@CDEF,
-		@tmp);
-	$err = RRDs::error;
-	push(@output, "ERROR: while graphing $IMG_DIR" . "$IMG[0]: $err\n") if $err;
-	if(lc($config->{enable_zoom}) eq "y") {
-		($width, $height) = split('x', $config->{graph_size}->{zoom});
-		$picz = $rrd{$version}->("$IMG_DIR" . "$IMGz[0]",
-			"--title=$config->{graphs}->{_gensens1}  ($tf->{nwhen}$tf->{twhen})",
+
+	my $vlabel;
+	$e = 0;
+	foreach my $sg (sort keys %{$gensens->{list}}) {
+		my @ls = split(',', $gensens->{list}->{$sg});
+
+		# determine if we are dealing with a 'temp', 'cpu' or 'bat' graph
+		if(index($ls[0], "temp") == 0) {
+			$vlabel = $temp_scale;
+		} elsif(index($ls[0], "cpu") == 0) {
+			$vlabel = "Hz";
+		} elsif(index($ls[0], "bat") == 0) {
+			$vlabel = "Charge";
+		} else {
+			# not supported yet
+		}
+
+		if(!$e) {
+			if($title) {
+				push(@output, main::graph_header($title, 2));
+				push(@output, "    \n");
+			}
+		}
+
+		@riglim = @{setup_riglim($rigid[$e], $limit[$e])};
+		undef(@tmp);
+		undef(@tmpz);
+		undef(@CDEF);
+		for($n = 0; $n < 9; $n++) {
+			my $str = trim($ls[$n] || "");
+			if($str) {
+				$str = $gensens->{map}->{$str} ? $gensens->{map}->{$str} : $str;
+				$str = sprintf("%-20s", substr($str, 0, 20));
+				push(@tmp, "LINE2:gsen" . $n . $LC[$n] . ":$str");
+				push(@tmp, "GPRINT:gsen" . $n . ":LAST: Cur\\:%5.1lf%s");
+				push(@tmp, "GPRINT:gsen" . $n . ":MIN: Min\\:%5.1lf%s");
+				push(@tmp, "GPRINT:gsen" . $n . ":MAX: Max\\:%5.1lf%s\\n");
+				push(@tmpz, "LINE2:gsen" . $n . $LC[$n] . ":$str");
+				next;
+			}
+			last;
+		}
+		while($n < $linpad[$e]) {
+			push(@tmp, "COMMENT: \\n");
+			$n++;
+		}
+
+		if($title) {
+			push(@output, "    \n");
+		}
+		if(lc($config->{show_gaps}) eq "y") {
+			push(@tmp, "AREA:wrongdata#$colors->{gap}:");
+			push(@tmpz, "AREA:wrongdata#$colors->{gap}:");
+			push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF");
+		}
+		($width, $height) = split('x', $config->{graph_size}->{medium});
+		$pic = $rrd{$version}->("$IMG_DIR" . "$IMG[$e]",
+			"--title=$gensens->{title}->{$sg}  ($tf->{nwhen}$tf->{twhen})",
 			"--start=-$tf->{nwhen}$tf->{twhen}",
 			"--imgformat=$imgfmt_uc",
-			"--vertical-label=$temp_scale",
+			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
 			@riglim,
@@ -481,153 +481,80 @@ sub gensens_cgi {
 			@{$cgi->{version12}},
 			@{$cgi->{version12_small}},
 			@{$colors->{graph_colors}},
-			"DEF:gsen0=$rrd:gensens0_s1:AVERAGE",
-			"DEF:gsen1=$rrd:gensens0_s2:AVERAGE",
-			"DEF:gsen2=$rrd:gensens0_s3:AVERAGE",
-			"DEF:gsen3=$rrd:gensens0_s4:AVERAGE",
-			"DEF:gsen4=$rrd:gensens0_s5:AVERAGE",
-			"DEF:gsen5=$rrd:gensens0_s6:AVERAGE",
-			"DEF:gsen6=$rrd:gensens0_s7:AVERAGE",
-			"DEF:gsen7=$rrd:gensens0_s8:AVERAGE",
-			"DEF:gsen8=$rrd:gensens0_s9:AVERAGE",
+			"DEF:gsen0=$rrd:gensens" . $e . "_s1:AVERAGE",
+			"DEF:gsen1=$rrd:gensens" . $e . "_s2:AVERAGE",
+			"DEF:gsen2=$rrd:gensens" . $e . "_s3:AVERAGE",
+			"DEF:gsen3=$rrd:gensens" . $e . "_s4:AVERAGE",
+			"DEF:gsen4=$rrd:gensens" . $e . "_s5:AVERAGE",
+			"DEF:gsen5=$rrd:gensens" . $e . "_s6:AVERAGE",
+			"DEF:gsen6=$rrd:gensens" . $e . "_s7:AVERAGE",
+			"DEF:gsen7=$rrd:gensens" . $e . "_s8:AVERAGE",
+			"DEF:gsen8=$rrd:gensens" . $e . "_s9:AVERAGE",
 			"CDEF:allvalues=gsen0,gsen1,gsen2,gsen3,gsen4,gsen5,gsen6,gsen7,gsen8,+,+,+,+,+,+,+,+",
 			@CDEF,
-			@tmpz);
+			@tmp);
 		$err = RRDs::error;
-		push(@output, "ERROR: while graphing $IMG_DIR" . "$IMGz[0]: $err\n") if $err;
-	}
-	if($title || ($silent =~ /imagetag/ && $graph =~ /gensens0/)) {
+		push(@output, "ERROR: while graphing $IMG_DIR" . "$IMG[$e]: $err\n") if $err;
 		if(lc($config->{enable_zoom}) eq "y") {
-			if(lc($config->{disable_javascript_void}) eq "y") {
-				push(@output, "      {url} . "/" . $config->{imgs_dir} . $IMGz[0] . "\">\n");
-			} else {
-				if($version eq "new") {
-					$picz_width = $picz->{image_width} * $config->{global_zoom};
-					$picz_height = $picz->{image_height} * $config->{global_zoom};
+			($width, $height) = split('x', $config->{graph_size}->{zoom});
+			$picz = $rrd{$version}->("$IMG_DIR" . "$IMGz[$e]",
+				"--title=$gensens->{title}->{$sg}  ($tf->{nwhen}$tf->{twhen})",
+				"--start=-$tf->{nwhen}$tf->{twhen}",
+				"--imgformat=$imgfmt_uc",
+				"--vertical-label=$vlabel",
+				"--width=$width",
+				"--height=$height",
+				@riglim,
+				$zoom,
+				@{$cgi->{version12}},
+				@{$cgi->{version12_small}},
+				@{$colors->{graph_colors}},
+				"DEF:gsen0=$rrd:gensens" . $e . "_s1:AVERAGE",
+				"DEF:gsen1=$rrd:gensens" . $e . "_s2:AVERAGE",
+				"DEF:gsen2=$rrd:gensens" . $e . "_s3:AVERAGE",
+				"DEF:gsen3=$rrd:gensens" . $e . "_s4:AVERAGE",
+				"DEF:gsen4=$rrd:gensens" . $e . "_s5:AVERAGE",
+				"DEF:gsen5=$rrd:gensens" . $e . "_s6:AVERAGE",
+				"DEF:gsen6=$rrd:gensens" . $e . "_s7:AVERAGE",
+				"DEF:gsen7=$rrd:gensens" . $e . "_s8:AVERAGE",
+				"DEF:gsen8=$rrd:gensens" . $e . "_s9:AVERAGE",
+				"CDEF:allvalues=gsen0,gsen1,gsen2,gsen3,gsen4,gsen5,gsen6,gsen7,gsen8,+,+,+,+,+,+,+,+",
+				@CDEF,
+				@tmpz);
+			$err = RRDs::error;
+			push(@output, "ERROR: while graphing $IMG_DIR" . "$IMGz[$e]: $err\n") if $err;
+		}
+		if($title || ($silent =~ /imagetag/ && $graph =~ /gensens0/)) {
+			if(lc($config->{enable_zoom}) eq "y") {
+				if(lc($config->{disable_javascript_void}) eq "y") {
+					push(@output, "      {url} . "/" . $config->{imgs_dir} . $IMGz[$e] . "\">\n");
 				} else {
-					$picz_width = $width + 115;
-					$picz_height = $height + 100;
+					if($version eq "new") {
+						$picz_width = $picz->{image_width} * $config->{global_zoom};
+						$picz_height = $picz->{image_height} * $config->{global_zoom};
+					} else {
+						$picz_width = $width + 115;
+						$picz_height = $height + 100;
+					}
+					push(@output, "      {url} . "/" . $config->{imgs_dir} . $IMGz[$e] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n");
 				}
-				push(@output, "      {url} . "/" . $config->{imgs_dir} . $IMGz[0] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n");
-			}
-		} else {
-			push(@output, "      \n");
-		}
-	}
-
-	if($title) {
-		push(@output, "    \n");
-	}
-
-	# CPU frequency
-	@riglim = @{setup_riglim($rigid[1], $limit[1])};
-	undef(@tmp);
-	undef(@tmpz);
-	undef(@CDEF);
-	@ls = split(',', $gensens->{list}->{1});
-	for($n = 0; $n < 9; $n++) {
-		my $str = trim($ls[$n] || "");
-		if($str) {
-			$str = $gensens->{map}->{$str} ? $gensens->{map}->{$str} : $str;
-			$str = sprintf("%-20s", substr($str, 0, 20));
-			push(@tmp, "LINE2:gsen" . $n . $LC[$n] . ":$str");
-			push(@tmp, "GPRINT:gsen" . $n . ":LAST: Cur\\:%4.1lf%shz");
-			push(@tmp, "GPRINT:gsen" . $n . ":MIN: Min\\:%4.1lf%shz");
-			push(@tmp, "GPRINT:gsen" . $n . ":MAX: Max\\:%4.1lf%shz\\n");
-			push(@tmpz, "LINE2:gsen" . $n . $LC[$n] . ":$str");
-			next;
-		}
-		last;
-	}
-	while($n < $max) {
-		push(@tmp, "COMMENT: \\n");
-		$n++;
-	}
-	if($title) {
-		push(@output, "    \n");
-	}
-	if(lc($config->{show_gaps}) eq "y") {
-		push(@tmp, "AREA:wrongdata#$colors->{gap}:");
-		push(@tmpz, "AREA:wrongdata#$colors->{gap}:");
-		push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF");
-	}
-	($width, $height) = split('x', $config->{graph_size}->{medium});
-	$pic = $rrd{$version}->("$IMG_DIR" . "$IMG[1]",
-		"--title=$config->{graphs}->{_gensens2}  ($tf->{nwhen}$tf->{twhen})",
-		"--start=-$tf->{nwhen}$tf->{twhen}",
-		"--imgformat=$imgfmt_uc",
-		"--vertical-label=Hz",
-		"--width=$width",
-		"--height=$height",
-		@riglim,
-		$zoom,
-		@{$cgi->{version12}},
-		@{$cgi->{version12_small}},
-		@{$colors->{graph_colors}},
-		"DEF:gsen0=$rrd:gensens1_s1:AVERAGE",
-		"DEF:gsen1=$rrd:gensens1_s2:AVERAGE",
-		"DEF:gsen2=$rrd:gensens1_s3:AVERAGE",
-		"DEF:gsen3=$rrd:gensens1_s4:AVERAGE",
-		"DEF:gsen4=$rrd:gensens1_s5:AVERAGE",
-		"DEF:gsen5=$rrd:gensens1_s6:AVERAGE",
-		"DEF:gsen6=$rrd:gensens1_s7:AVERAGE",
-		"DEF:gsen7=$rrd:gensens1_s8:AVERAGE",
-		"DEF:gsen8=$rrd:gensens1_s9:AVERAGE",
-		"CDEF:allvalues=gsen0,gsen1,gsen2,gsen3,gsen4,gsen5,gsen6,gsen7,gsen8,+,+,+,+,+,+,+,+",
-		@CDEF,
-		@tmp);
-	$err = RRDs::error;
-	push(@output, "ERROR: while graphing $IMG_DIR" . "$IMG[1]: $err\n") if $err;
-	if(lc($config->{enable_zoom}) eq "y") {
-		($width, $height) = split('x', $config->{graph_size}->{zoom});
-		$picz = $rrd{$version}->("$IMG_DIR" . "$IMGz[1]",
-			"--title=$config->{graphs}->{_gensens2}  ($tf->{nwhen}$tf->{twhen})",
-			"--start=-$tf->{nwhen}$tf->{twhen}",
-			"--imgformat=$imgfmt_uc",
-			"--vertical-label=Hz",
-			"--width=$width",
-			"--height=$height",
-			@riglim,
-			$zoom,
-			@{$cgi->{version12}},
-			@{$cgi->{version12_small}},
-			@{$colors->{graph_colors}},
-			"DEF:gsen0=$rrd:gensens1_s1:AVERAGE",
-			"DEF:gsen1=$rrd:gensens1_s2:AVERAGE",
-			"DEF:gsen2=$rrd:gensens1_s3:AVERAGE",
-			"DEF:gsen3=$rrd:gensens1_s4:AVERAGE",
-			"DEF:gsen4=$rrd:gensens1_s5:AVERAGE",
-			"DEF:gsen5=$rrd:gensens1_s6:AVERAGE",
-			"DEF:gsen6=$rrd:gensens1_s7:AVERAGE",
-			"DEF:gsen7=$rrd:gensens1_s8:AVERAGE",
-			"DEF:gsen8=$rrd:gensens1_s9:AVERAGE",
-			"CDEF:allvalues=gsen0,gsen1,gsen2,gsen3,gsen4,gsen5,gsen6,gsen7,gsen8,+,+,+,+,+,+,+,+",
-			@CDEF,
-			@tmpz);
-		$err = RRDs::error;
-		push(@output, "ERROR: while graphing $IMG_DIR" . "$IMGz[1]: $err\n") if $err;
-	}
-	if($title || ($silent =~ /imagetag/ && $graph =~ /gensens1/)) {
-		if(lc($config->{enable_zoom}) eq "y") {
-			if(lc($config->{disable_javascript_void}) eq "y") {
-				push(@output, "      {url} . "/" . $config->{imgs_dir} . $IMGz[1] . "\">\n");
 			} else {
-				if($version eq "new") {
-					$picz_width = $picz->{image_width} * $config->{global_zoom};
-					$picz_height = $picz->{image_height} * $config->{global_zoom};
-				} else {
-					$picz_width = $width + 115;
-					$picz_height = $height + 100;
-				}
-				push(@output, "      {url} . "/" . $config->{imgs_dir} . $IMGz[1] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n");
+				push(@output, "      \n");
 			}
-		} else {
-			push(@output, "      \n");
+		}
+
+		if($title) {
+			push(@output, "    \n");
+		}
+
+		$e++;
+		if(!($e % 2)) {
+			push(@output, "    \n");
+			push(@output, "    \n");
 		}
 	}
 
 	if($title) {
-		push(@output, "    \n");
 		push(@output, "    \n");
 		push(@output, main::graph_footer());
 	}
diff --git a/monitorix b/monitorix
index 3aff7b3..c52b8fb 100755
--- a/monitorix
+++ b/monitorix
@@ -311,6 +311,14 @@ EOF
 				}
 				next;
 			}
+			if($g eq "gensens") {
+				foreach my $sg (sort keys %{$config{gensens}->{list}}) {
+					my $name = trim($config{gensens}->{title}->{$sg});
+					$gname = "_" . $g;
+					print(OUT "              \n");
+				}
+				next;
+			}
 			if($g eq "ipmi") {
 				for($n = 0; $n < scalar(my @ipmi_list = split(',', $config{ipmi}->{list})); $n++) {
 					my $name = trim($ipmi_list[$n]);
diff --git a/monitorix.conf b/monitorix.conf
index f775c18..8880d89 100644
--- a/monitorix.conf
+++ b/monitorix.conf
@@ -214,23 +214,32 @@ secure_log_date_format = %b %e
 	
 		0 = temp0
 		1 = cpu0
+		2 = bat0
 	
+	
+		0 = Temperatures
+		1 = CPU frequency
+		2 = Battery status
+	
 	
 		temp0 = /sys/devices/virtual/thermal/thermal_zone0/temp
 		cpu0 = /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
+		bat0 = /sys/class/power_supply/BAT0/capacity
 	
 	
 		temp0 = 1000
 		cpu0 = 0.001
+		bat0 = 1
 	
 	
 		temp0 = Temperature Zone 0
 		cpu0 = CPU0 frequency
+		bat0 = Battery 0
 	
 	
 	
-	rigid = 0, 0
-	limit = 100, 100
+	rigid = 0, 0, 2
+	limit = 100, 100, 100
 
 
 
@@ -989,8 +998,7 @@ graph_name = system, kern, proc, hptemp, lmsens, gensens, ipmi, ambsens, nvidia,
 	_lmsens3	= MB and CPU temperatures
 	_lmsens4	= Fan speeds
 	_lmsens5	= GPU temperatures
-	_gensens1	= Temperatures
-	_gensens2	= CPU frequency
+	_gensens	= Generic sensors
 	_ipmi		= IPMI sensors
 	_ambsens	= Ambient sensors
 	_nvidia1	= NVIDIA temperatures

From ad55557ef196ae90a454efd373338f0681ec8ea3 Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Fri, 3 May 2019 09:05:46 +0200
Subject: [PATCH 05/32] fixed the 'gensens' names in the right side list of the
 main page #170

---
 monitorix | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/monitorix b/monitorix
index c52b8fb..dae0fef 100755
--- a/monitorix
+++ b/monitorix
@@ -312,10 +312,10 @@ EOF
 				next;
 			}
 			if($g eq "gensens") {
-				foreach my $sg (sort keys %{$config{gensens}->{list}}) {
-					my $name = trim($config{gensens}->{title}->{$sg});
+				for($n = 0; $n < keys %{$config{gensens}->{list}}; $n++) {
+					my $name = trim($config{gensens}->{title}->{$n});
 					$gname = "_" . $g;
-					print(OUT "              \n");
+					print(OUT "              \n");
 				}
 				next;
 			}

From f8ef494e4a3891dbd705110800e473eff29c977f Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Fri, 3 May 2019 09:08:07 +0200
Subject: [PATCH 06/32] updated documentation #170

---
 man/man5/monitorix.conf.5 | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/man/man5/monitorix.conf.5 b/man/man5/monitorix.conf.5
index 91a324c..4c41d97 100644
--- a/man/man5/monitorix.conf.5
+++ b/man/man5/monitorix.conf.5
@@ -884,11 +884,11 @@ The external script will receive the following arguments:
 .P
 .RE
 .SS Generic sensors statistics (gensens.pm)
-This graph is able to monitor up to 9 temperatures and CPU frequencies which, depending of your machine, should appear in the \fI/sys/devices\fP directory.
+This graph helps to monitor up to three (so far) different sensors: temperatures, CPU frequencies and battery status which, depending of your machine, they should appear in the \fI/sys\fP directory.
 .P
 .BI list
 .RS
-This is a fixed list that can only hold two keys (0 and 1). Each key though can hold up to 9 different entries separated by comma which corresponds to the names of the sensors present in your computer. The key 0 is only for temperature sensors and the key 1 is for CPU frequencies. All this is hard-coded and a bit rigid currently but it might change in the future.
+This is a list of an unlimited number of groups to define the sensors to monitor. Each group is numbered starting from 0, and each one can hold up to 9 different entries separated by comma which corresponds to the names of the sensors present in your computer that you want to monitor. This module is capable to identify the type of the group by searching the substrings \fItemp\fP, \fIcpu\fP and \fIbat\fP, so it will put automatically the vertical label in the graph accordingly (\fICelsius\fP or \fIFahrenheit\fP, \fIHz\fP or \fICharge\fP respectively). Of course, it cannot supports mixed sensors in a same group. For example, if you need to monitor more than 9 temperature sensors just create a new group in \fBlist\fP.
 .P
 An example would be:
 .P
@@ -898,13 +898,31 @@ An example would be:
 	0 = temp0, temp1
 .br
 	1 = cpu0, cpu1, cpu2, cpu3
+.br
+	2 = bat0
 .br
 
 .RE
 .RE
+.BI title
+.RS
+In this option you must associate a title with the group number specified in \fBlist\fP. This is the title that will appear as the name of the graph. Following the settings in the example above:
+.P
+.RS
+
+.br
+	0 = Temperatures
+.br
+	1 = CPU frequency
+.br
+	2 = Battery status
+.br
+
+.RE
+.RE
 .BI desc
 .RS
-In this option you must associate the complete pathname of the file from where to get the value of each entry defined in the \fBlist\fP. Following the settings in the example above:
+In this option you must associate the complete pathname of the file from where to get the value of each entry defined in the \fBlist\fP option. Following the settings in the example above:
 .P
 .RS
 
@@ -920,13 +938,15 @@ In this option you must associate the complete pathname of the file from where t
 	cpu2 = /sys/devices/system/cpu/cpu2/cpufreq/scaling_cur_freq
 .br
 	cpu3 = /sys/devices/system/cpu/cpu3/cpufreq/scaling_cur_freq
+.br
+	bat0 = /sys/class/power_supply/BAT0/capacity
 .br
 
 .RE
 .RE
 .BI unit
 .RS
-With this option you can define the order of magnitude associated to a specific value. This is used in both temperatures and CPU frequencies, since this kind of temperature sensors tend to give the value in 1000ths of degrees Celsius. In the case of CPU frequencies the values come in Mhz which means that they need to be converted to Hz by multiplying them by 1000. Therefore you can define something like this:
+With this option you can define the order of magnitude associated to a specific value. This is used in both temperatures and CPU frequencies, since this kind of temperature sensors tend to give the value in 1000ths of degrees Celsius. In the case of CPU frequencies the values come in Mhz which means that they need to be converted to Hz by multiplying them by 1000. Since the battery value represents a percentage, it doesn't need any special calculation. Therefore you can define something like this:
 .P
 .RS
 
@@ -942,6 +962,8 @@ With this option you can define the order of magnitude associated to a specific
 	cpu2 = 0.001
 .br
 	cpu3 = 0.001
+.br
+	bat0 = 1
 .br
 
 .RE
@@ -964,6 +986,8 @@ With this option you can optionally rename any of the sensor names defined in th
 	cpu2 = CPU2 frequency
 .br
 	cpu3 = CPU3 frequency
+.br
+	bat0 = Battery 0
 .br
 
 .RE
@@ -977,7 +1001,7 @@ This optional list enables the alert capabilities for this graph and complements
 .P
 The \fItime interval\fP is the period of time (in seconds) that the \fIthreshold\fP needs to be exceeded before the external script is executed.
 .P
-The \fIthreshold\fP is the value (either temperature or HZ) that needs to be reached or exceeded within the specified time in \fItime interval\fP to execute the external script. It can be specified as a unique value or as a range of two values separated by a dash.
+The \fIthreshold\fP is the value (temperature, Hz or battery charge) that needs to be reached or exceeded within the specified time in \fItime interval\fP to execute the external script. It can be specified as a unique value or as a range of two values separated by a dash.
 .P
 The \fIscript\fP is the full path name of the script that will be executed by this alert.
 .P
@@ -1169,7 +1193,7 @@ This optional list enables the alert capabilities for this graph and complements
 .P
 The \fItime interval\fP is the period of time (in seconds) that the \fIthreshold\fP needs to be exceeded before the external script is executed.
 .P
-The \fIthreshold\fP is the value (either temperature or HZ) that needs to be reached or exceeded within the specified time in \fItime interval\fP to execute the external script. It can be specified as a unique value or as a range of two values separated by a dash.
+The \fIthreshold\fP is the value (temperature, etc.) that needs to be reached or exceeded within the specified time in \fItime interval\fP to execute the external script. It can be specified as a unique value or as a range of two values separated by a dash.
 .P
 The \fIscript\fP is the full path name of the script that will be executed by this alert.
 .P

From 61001749441238ce86a6f025a1c9a5e24a877316 Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Fri, 3 May 2019 09:08:21 +0200
Subject: [PATCH 07/32] update Changes

---
 Changes | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Changes b/Changes
index b944917..42f3283 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 3.NN.N - DD-MMM-2019
 ====================
 - Added a complete graph to support PHP-FPM statistics ('phpfpm.pm'). [#167]
+- Completely rewritten the 'gensens.pm' module which includes the battery
+  values as its third supported sensor. [#170]
 - Added a warning if a process vanished during the accouting in 'process.pm'
 - Added the ability, in the alerts of 'gensens.pm', to support a range of two
   values, separated by a dash, in the threshold. [#221]

From 98ef89190b2d78d2fe6a0e3ebc2f2b3a0ac9fbab Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Wed, 8 May 2019 12:54:03 +0200
Subject: [PATCH 08/32] added the new option 'rrdtool_extra_options' to be able
 to include RRDtool extra options on every graph

---
 Changes            |  2 ++
 lib/ambsens.pm     |  6 ++++++
 lib/apache.pm      | 18 +++++++++++++++++-
 lib/apcupsd.pm     | 18 +++++++++++++++++-
 lib/bind.pm        | 20 +++++++++++++++++++-
 lib/chrony.pm      | 18 +++++++++++++++++-
 lib/disk.pm        | 12 +++++++++++-
 lib/du.pm          |  8 +++++++-
 lib/fail2ban.pm    |  8 +++++++-
 lib/fs.pm          | 14 +++++++++++++-
 lib/ftp.pm         | 12 +++++++++++-
 lib/gensens.pm     |  6 ++++++
 lib/hptemp.pm      | 12 +++++++++++-
 lib/icecast.pm     | 10 +++++++++-
 lib/int.pm         | 12 +++++++++++-
 lib/ipmi.pm        |  6 ++++++
 lib/kern.pm        | 12 +++++++++++-
 lib/libvirt.pm     | 14 +++++++++++++-
 lib/lighttpd.pm    | 12 +++++++++++-
 lib/lmsens.pm      | 16 +++++++++++++++-
 lib/mail.pm        | 16 ++++++++++++++++
 lib/memcached.pm   | 20 +++++++++++++++++++-
 lib/mongodb.pm     | 22 +++++++++++++++++++++-
 lib/mysql.pm       | 18 +++++++++++++++++-
 lib/net.pm         | 12 +++++++++++-
 lib/netstat.pm     | 14 ++++++++++++++
 lib/nfsc.pm        | 18 +++++++++++++++++-
 lib/nfss.pm        | 24 +++++++++++++++++++++++-
 lib/nginx.pm       | 12 +++++++++++-
 lib/ntp.pm         | 12 +++++++++++-
 lib/nut.pm         | 18 +++++++++++++++++-
 lib/nvidia.pm      | 12 +++++++++++-
 lib/pagespeed.pm   | 22 +++++++++++++++++++++-
 lib/phpapc.pm      | 12 +++++++++++-
 lib/phpfpm.pm      | 16 ++++++++++++++++
 lib/port.pm        |  8 +++++++-
 lib/proc.pm        |  8 +++++++-
 lib/process.pm     | 22 +++++++++++++++++++++-
 lib/raspberrypi.pm | 12 +++++++++++-
 lib/serv.pm        | 12 +++++++++++-
 lib/squid.pm       | 24 +++++++++++++++++++++++-
 lib/system.pm      | 15 ++++++++++++++-
 lib/tc.pm          | 14 +++++++++++++-
 lib/traffacct.pm   | 10 +++++++++-
 lib/user.pm        | 12 +++++++++++-
 lib/varnish.pm     | 18 +++++++++++++++++-
 lib/verlihub.pm    | 12 +++++++++++-
 lib/wowza.pm       | 16 +++++++++++++++-
 lib/zfs.pm         | 20 +++++++++++++++++++-
 49 files changed, 645 insertions(+), 42 deletions(-)

diff --git a/Changes b/Changes
index 42f3283..28dde42 100644
--- a/Changes
+++ b/Changes
@@ -9,6 +9,8 @@
 - Added the ability, in the alerts of 'ambsens.pm', to support a range of two
   values, separated by a dash, in the threshold. [#221]
 - Added support for FreeBSD NFS Server stats. [#238]
+- Added the new option 'rrdtool_extra_options' to be able to include RRDtool
+  extra options on every graph.
 - Changed the main loop functionality using now the select() function, instead
   of the alarm()+pause() pair. This should improve the responsiveness on high
   system loads. [#230]
diff --git a/lib/ambsens.pm b/lib/ambsens.pm
index 0851ed5..7ed67ba 100644
--- a/lib/ambsens.pm
+++ b/lib/ambsens.pm
@@ -277,6 +277,7 @@ sub ambsens_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -305,6 +306,9 @@ sub ambsens_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -445,6 +449,7 @@ sub ambsens_cgi {
 				"--vertical-label=$unit",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -473,6 +478,7 @@ sub ambsens_cgi {
 					"--vertical-label=$unit",
 					"--width=$width",
 					"--height=$height",
+					@extra,
 					@riglim,
 					$zoom,
 					@{$cgi->{version12}},
diff --git a/lib/apache.pm b/lib/apache.pm
index 150ab1e..35be6ae 100644
--- a/lib/apache.pm
+++ b/lib/apache.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -733,6 +733,7 @@ sub apache_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -752,6 +753,9 @@ sub apache_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -894,6 +898,7 @@ sub apache_cgi {
 			"--vertical-label=Workers",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -918,6 +923,7 @@ sub apache_cgi {
 				"--vertical-label=Workers",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1021,6 +1027,7 @@ sub apache_cgi {
 			"--vertical-label=Workers",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1047,6 +1054,7 @@ sub apache_cgi {
 				"--vertical-label=Workers",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1117,6 +1125,7 @@ sub apache_cgi {
 			"--vertical-label=Percent (%)",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1137,6 +1146,7 @@ sub apache_cgi {
 				"--vertical-label=Percent",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1199,6 +1209,7 @@ sub apache_cgi {
 			"--vertical-label=Requests/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1219,6 +1230,7 @@ sub apache_cgi {
 				"--vertical-label=Requests/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1288,6 +1300,7 @@ sub apache_cgi {
 			"--vertical-label=Workers",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1311,6 +1324,7 @@ sub apache_cgi {
 				"--vertical-label=Workers",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1376,6 +1390,7 @@ sub apache_cgi {
 			"--vertical-label=Slots",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1396,6 +1411,7 @@ sub apache_cgi {
 				"--vertical-label=Slots",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/apcupsd.pm b/lib/apcupsd.pm
index ee8b861..89e8661 100644
--- a/lib/apcupsd.pm
+++ b/lib/apcupsd.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -278,6 +278,7 @@ sub apcupsd_cgi {
 	my $width;
 	my $height;
 	my $temp_scale = "Celsius";
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -297,6 +298,9 @@ sub apcupsd_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -492,6 +496,7 @@ sub apcupsd_cgi {
 			"--vertical-label=Volts",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -517,6 +522,7 @@ sub apcupsd_cgi {
 				"--vertical-label=Volts",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -594,6 +600,7 @@ sub apcupsd_cgi {
 			"--vertical-label=Percent (%)",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -619,6 +626,7 @@ sub apcupsd_cgi {
 				"--vertical-label=Percent (%)",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -696,6 +704,7 @@ sub apcupsd_cgi {
 			"--vertical-label=$temp_scale",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -718,6 +727,7 @@ sub apcupsd_cgi {
 				"--vertical-label=$temp_scale",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -783,6 +793,7 @@ sub apcupsd_cgi {
 			"--vertical-label=Volts",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -804,6 +815,7 @@ sub apcupsd_cgi {
 				"--vertical-label=Volts",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -868,6 +880,7 @@ sub apcupsd_cgi {
 			"--vertical-label=Minutes",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -889,6 +902,7 @@ sub apcupsd_cgi {
 				"--vertical-label=Minutes",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -950,6 +964,7 @@ sub apcupsd_cgi {
 			"--vertical-label=Hz",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -970,6 +985,7 @@ sub apcupsd_cgi {
 				"--vertical-label=Hz",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/bind.pm b/lib/bind.pm
index cbd3a20..11ee650 100644
--- a/lib/bind.pm
+++ b/lib/bind.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -561,6 +561,7 @@ sub bind_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -601,6 +602,9 @@ sub bind_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -832,6 +836,7 @@ sub bind_cgi {
 			"--vertical-label=Queries/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -870,6 +875,7 @@ sub bind_cgi {
 				"--vertical-label=Queries/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -956,6 +962,7 @@ sub bind_cgi {
 			"--vertical-label=Queries/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -994,6 +1001,7 @@ sub bind_cgi {
 				"--vertical-label=Queries/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1078,6 +1086,7 @@ sub bind_cgi {
 			"--vertical-label=Requests/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1116,6 +1125,7 @@ sub bind_cgi {
 				"--vertical-label=Requests/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1202,6 +1212,7 @@ sub bind_cgi {
 			"--vertical-label=Requests/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1240,6 +1251,7 @@ sub bind_cgi {
 				"--vertical-label=Requests/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1324,6 +1336,7 @@ sub bind_cgi {
 			"--vertical-label=RRsets",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1362,6 +1375,7 @@ sub bind_cgi {
 				"--vertical-label=RRsets",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1449,6 +1463,7 @@ sub bind_cgi {
 			"--vertical-label=bytes",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1478,6 +1493,7 @@ sub bind_cgi {
 				"--vertical-label=bytes",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1539,6 +1555,7 @@ sub bind_cgi {
 			"--vertical-label=Tasks",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1561,6 +1578,7 @@ sub bind_cgi {
 				"--vertical-label=Tasks",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/chrony.pm b/lib/chrony.pm
index 90dd951..c209968 100644
--- a/lib/chrony.pm
+++ b/lib/chrony.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -238,6 +238,7 @@ sub chrony_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -257,6 +258,9 @@ sub chrony_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -427,6 +431,7 @@ sub chrony_cgi {
 			"--vertical-label=Seconds",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -451,6 +456,7 @@ sub chrony_cgi {
 				"--vertical-label=Seconds",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -520,6 +526,7 @@ sub chrony_cgi {
 			"--vertical-label=Seconds",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -542,6 +549,7 @@ sub chrony_cgi {
 				"--vertical-label=Seconds",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -607,6 +615,7 @@ sub chrony_cgi {
 			"--vertical-label=Level",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -627,6 +636,7 @@ sub chrony_cgi {
 				"--vertical-label=Level",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -688,6 +698,7 @@ sub chrony_cgi {
 			"--vertical-label=PPM",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -709,6 +720,7 @@ sub chrony_cgi {
 				"--vertical-label=PPM",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -770,6 +782,7 @@ sub chrony_cgi {
 			"--vertical-label=PPM",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -790,6 +803,7 @@ sub chrony_cgi {
 				"--vertical-label=PPM",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -850,6 +864,7 @@ sub chrony_cgi {
 			"--vertical-label=Seconds",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -870,6 +885,7 @@ sub chrony_cgi {
 				"--vertical-label=Seconds",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/disk.pm b/lib/disk.pm
index 6c308db..700cfc3 100644
--- a/lib/disk.pm
+++ b/lib/disk.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -318,6 +318,7 @@ sub disk_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -348,6 +349,9 @@ sub disk_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -536,6 +540,7 @@ sub disk_cgi {
 			"--vertical-label=$temp_scale",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -562,6 +567,7 @@ sub disk_cgi {
 				"--vertical-label=$temp_scale",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -665,6 +671,7 @@ sub disk_cgi {
 			"--vertical-label=Sectors",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -692,6 +699,7 @@ sub disk_cgi {
 				"--vertical-label=Sectors",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -792,6 +800,7 @@ sub disk_cgi {
 			"--vertical-label=Sectors",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -819,6 +828,7 @@ sub disk_cgi {
 				"--vertical-label=Sectors",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/du.pm b/lib/du.pm
index 1f7fe49..b50c37e 100644
--- a/lib/du.pm
+++ b/lib/du.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2018 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -217,6 +217,7 @@ sub du_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -246,6 +247,9 @@ sub du_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -434,6 +438,7 @@ sub du_cgi {
 				"--vertical-label=$type_label",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -454,6 +459,7 @@ sub du_cgi {
 					"--vertical-label=$type_label",
 					"--width=$width",
 					"--height=$height",
+					@extra,
 					@riglim,
 					$zoom,
 					@{$cgi->{version12}},
diff --git a/lib/fail2ban.pm b/lib/fail2ban.pm
index 6dc3e35..d84527e 100644
--- a/lib/fail2ban.pm
+++ b/lib/fail2ban.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -227,6 +227,7 @@ sub fail2ban_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -255,6 +256,9 @@ sub fail2ban_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -396,6 +400,7 @@ sub fail2ban_cgi {
 				"--vertical-label=Bans/min",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -424,6 +429,7 @@ sub fail2ban_cgi {
 					"--vertical-label=Bans/min",
 					"--width=$width",
 					"--height=$height",
+					@extra,
 					@riglim,
 					$zoom,
 					@{$cgi->{version12}},
diff --git a/lib/fs.pm b/lib/fs.pm
index fbf1921..a56465d 100644
--- a/lib/fs.pm
+++ b/lib/fs.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -823,6 +823,7 @@ sub fs_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my $graph_title;
 	my $vlabel;
 	my @IMG;
@@ -854,6 +855,9 @@ sub fs_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -1009,6 +1013,7 @@ sub fs_cgi {
 			"--vertical-label=Percent (%)",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1035,6 +1040,7 @@ sub fs_cgi {
 				"--vertical-label=Percent (%)",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1125,6 +1131,7 @@ sub fs_cgi {
 			"--vertical-label=Reads+Writes/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1151,6 +1158,7 @@ sub fs_cgi {
 				"--vertical-label=Reads+Writes/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1238,6 +1246,7 @@ sub fs_cgi {
 			"--vertical-label=Percent (%)",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1264,6 +1273,7 @@ sub fs_cgi {
 				"--vertical-label=Percent (%)",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1389,6 +1399,7 @@ sub fs_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1423,6 +1434,7 @@ sub fs_cgi {
 				"--vertical-label=$vlabel",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/ftp.pm b/lib/ftp.pm
index 06e9c3c..f63c0bd 100644
--- a/lib/ftp.pm
+++ b/lib/ftp.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -326,6 +326,7 @@ sub ftp_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @tmp;
 	my @tmpz;
@@ -339,6 +340,9 @@ sub ftp_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -480,6 +484,7 @@ sub ftp_cgi {
 		"--vertical-label=Commands/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -505,6 +510,7 @@ sub ftp_cgi {
 			"--vertical-label=Commands/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -584,6 +590,7 @@ sub ftp_cgi {
 		"--vertical-label=Logins/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -607,6 +614,7 @@ sub ftp_cgi {
 			"--vertical-label=Logins/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -678,6 +686,7 @@ sub ftp_cgi {
 		"--vertical-label=bytes/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -699,6 +708,7 @@ sub ftp_cgi {
 			"--vertical-label=bytes/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
diff --git a/lib/gensens.pm b/lib/gensens.pm
index 384c867..e7d568a 100644
--- a/lib/gensens.pm
+++ b/lib/gensens.pm
@@ -273,6 +273,7 @@ sub gensens_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my $temp_scale = "Celsius";
 	my @IMG;
@@ -302,6 +303,9 @@ sub gensens_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -476,6 +480,7 @@ sub gensens_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -504,6 +509,7 @@ sub gensens_cgi {
 				"--vertical-label=$vlabel",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/hptemp.pm b/lib/hptemp.pm
index 4476014..efaa36f 100644
--- a/lib/hptemp.pm
+++ b/lib/hptemp.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -270,6 +270,7 @@ sub hptemp_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my $temp_scale = "Celsius";
 	my @tmp;
@@ -296,6 +297,9 @@ sub hptemp_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -479,6 +483,7 @@ sub hptemp_cgi {
 			"--vertical-label=$temp_scale",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -506,6 +511,7 @@ sub hptemp_cgi {
 				"--vertical-label=$temp_scale",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -610,6 +616,7 @@ sub hptemp_cgi {
 			"--width=$width",
 			"--height=$height",
 			"--lower-limit=0",
+			@extra,
 			$zoom,
 			@{$cgi->{version12}},
 			@{$cgi->{version12_small}},
@@ -635,6 +642,7 @@ sub hptemp_cgi {
 				"--width=$width",
 				"--height=$height",
 				"--lower-limit=0",
+				@extra,
 				$zoom,
 				@{$cgi->{version12}},
 				@{$cgi->{version12_small}},
@@ -733,6 +741,7 @@ sub hptemp_cgi {
 			"--width=$width",
 			"--height=$height",
 			"--lower-limit=0",
+			@extra,
 			$zoom,
 			@{$cgi->{version12}},
 			@{$cgi->{version12_small}},
@@ -758,6 +767,7 @@ sub hptemp_cgi {
 				"--width=$width",
 				"--height=$height",
 				"--lower-limit=0",
+				@extra,
 				$zoom,
 				@{$cgi->{version12}},
 				@{$cgi->{version12_small}},
diff --git a/lib/icecast.pm b/lib/icecast.pm
index 45807ea..7be7d6a 100644
--- a/lib/icecast.pm
+++ b/lib/icecast.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -243,6 +243,7 @@ sub icecast_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -283,6 +284,9 @@ sub icecast_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -448,6 +452,7 @@ sub icecast_cgi {
 			"--vertical-label=Listeners",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -475,6 +480,7 @@ sub icecast_cgi {
 				"--vertical-label=Listeners",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -549,6 +555,7 @@ sub icecast_cgi {
 			"--vertical-label=Bitrate",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -576,6 +583,7 @@ sub icecast_cgi {
 				"--vertical-label=Bitrate",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/int.pm b/lib/int.pm
index 87ccfe9..fa78158 100644
--- a/lib/int.pm
+++ b/lib/int.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -451,6 +451,7 @@ sub int_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @CDEF;
 	my @allvalues1;
@@ -826,6 +827,9 @@ sub int_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -1062,6 +1066,7 @@ sub int_cgi {
 		"--vertical-label=Ticks/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1081,6 +1086,7 @@ sub int_cgi {
 			"--vertical-label=Ticks/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1137,6 +1143,7 @@ sub int_cgi {
 		"--vertical-label=Ticks/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1157,6 +1164,7 @@ sub int_cgi {
 			"--vertical-label=Ticks/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1210,6 +1218,7 @@ sub int_cgi {
 			"--vertical-label=Ticks/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1230,6 +1239,7 @@ sub int_cgi {
 				"--vertical-label=Ticks/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/ipmi.pm b/lib/ipmi.pm
index c04c6c2..3e3e0a1 100644
--- a/lib/ipmi.pm
+++ b/lib/ipmi.pm
@@ -234,6 +234,7 @@ sub ipmi_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -262,6 +263,9 @@ sub ipmi_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -403,6 +407,7 @@ sub ipmi_cgi {
 				"--vertical-label=$unit",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -431,6 +436,7 @@ sub ipmi_cgi {
 					"--vertical-label=$unit",
 					"--width=$width",
 					"--height=$height",
+					@extra,
 					@riglim,
 					$zoom,
 					@{$cgi->{version12}},
diff --git a/lib/kern.pm b/lib/kern.pm
index f4592f7..a931944 100644
--- a/lib/kern.pm
+++ b/lib/kern.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -399,6 +399,7 @@ sub kern_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @tmp;
 	my @tmpz;
@@ -413,6 +414,9 @@ sub kern_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -705,6 +709,7 @@ sub kern_cgi {
 		"--vertical-label=$vlabel",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -731,6 +736,7 @@ sub kern_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -815,6 +821,7 @@ sub kern_cgi {
 		"--vertical-label=CS & forks/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -837,6 +844,7 @@ sub kern_cgi {
 			"--vertical-label=CS & forks/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -914,6 +922,7 @@ sub kern_cgi {
 		"--vertical-label=Percent (%)",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -936,6 +945,7 @@ sub kern_cgi {
 			"--vertical-label=Percent (%)",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
diff --git a/lib/libvirt.pm b/lib/libvirt.pm
index 97fc477..27cc25e 100644
--- a/lib/libvirt.pm
+++ b/lib/libvirt.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -315,6 +315,7 @@ sub libvirt_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my $graph_title;
 	my @IMG;
 	my @IMGz;
@@ -347,6 +348,9 @@ sub libvirt_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -517,6 +521,7 @@ sub libvirt_cgi {
 			"--vertical-label=Percent (%)",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -543,6 +548,7 @@ sub libvirt_cgi {
 				"--vertical-label=Percent (%)",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -628,6 +634,7 @@ sub libvirt_cgi {
 			"--vertical-label=Bytes",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -662,6 +669,7 @@ sub libvirt_cgi {
 				"--vertical-label=Bytes",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -752,6 +760,7 @@ sub libvirt_cgi {
 			"--vertical-label=bytes/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -786,6 +795,7 @@ sub libvirt_cgi {
 				"--vertical-label=bytes/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -898,6 +908,7 @@ sub libvirt_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -924,6 +935,7 @@ sub libvirt_cgi {
 				"--vertical-label=$vlabel",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/lighttpd.pm b/lib/lighttpd.pm
index 40d31ba..dcafd00 100644
--- a/lib/lighttpd.pm
+++ b/lib/lighttpd.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -223,6 +223,7 @@ sub lighttpd_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -243,6 +244,9 @@ sub lighttpd_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -388,6 +392,7 @@ sub lighttpd_cgi {
 			"--vertical-label=Workers",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -412,6 +417,7 @@ sub lighttpd_cgi {
 				"--vertical-label=Workers",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -484,6 +490,7 @@ sub lighttpd_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -504,6 +511,7 @@ sub lighttpd_cgi {
 				"--vertical-label=$vlabel",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -566,6 +574,7 @@ sub lighttpd_cgi {
 			"--vertical-label=Accesses/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -586,6 +595,7 @@ sub lighttpd_cgi {
 				"--vertical-label=Accesses/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/lmsens.pm b/lib/lmsens.pm
index a10b705..b6f69f7 100644
--- a/lib/lmsens.pm
+++ b/lib/lmsens.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -404,6 +404,7 @@ sub lmsens_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my $temp_scale = "Celsius";
 	my @tmp;
@@ -438,6 +439,9 @@ sub lmsens_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -712,6 +716,7 @@ sub lmsens_cgi {
 		"--vertical-label=$temp_scale",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -746,6 +751,7 @@ sub lmsens_cgi {
 			"--vertical-label=$temp_scale",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -905,6 +911,7 @@ sub lmsens_cgi {
 		"--vertical-label=Volts",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -935,6 +942,7 @@ sub lmsens_cgi {
 			"--vertical-label=Volts",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1046,6 +1054,7 @@ sub lmsens_cgi {
 		"--vertical-label=$temp_scale",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1072,6 +1081,7 @@ sub lmsens_cgi {
 			"--vertical-label=$temp_scale",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1172,6 +1182,7 @@ sub lmsens_cgi {
 		"--vertical-label=RPM",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1201,6 +1212,7 @@ sub lmsens_cgi {
 			"--vertical-label=RPM",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1327,6 +1339,7 @@ sub lmsens_cgi {
 		"--vertical-label=$temp_scale",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1356,6 +1369,7 @@ sub lmsens_cgi {
 			"--vertical-label=$temp_scale",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
diff --git a/lib/mail.pm b/lib/mail.pm
index 9ab45f1..0d048a5 100644
--- a/lib/mail.pm
+++ b/lib/mail.pm
@@ -733,6 +733,7 @@ sub mail_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my $T = "B";
 	my $vlabel = "bytes/s";
@@ -752,6 +753,9 @@ sub mail_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -1082,6 +1086,7 @@ sub mail_cgi {
 		"--vertical-label=$rate_label",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1117,6 +1122,7 @@ sub mail_cgi {
 			"--vertical-label=$rate_label",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1213,6 +1219,7 @@ sub mail_cgi {
 		"--vertical-label=$vlabel",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1237,6 +1244,7 @@ sub mail_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1304,6 +1312,7 @@ sub mail_cgi {
 		"--vertical-label=Messages",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1324,6 +1333,7 @@ sub mail_cgi {
 			"--vertical-label=Messages",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1385,6 +1395,7 @@ sub mail_cgi {
 		"--vertical-label=bytes",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1406,6 +1417,7 @@ sub mail_cgi {
 			"--vertical-label=bytes",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1474,6 +1486,7 @@ sub mail_cgi {
 		"--vertical-label=Messages",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1497,6 +1510,7 @@ sub mail_cgi {
 			"--vertical-label=Messages",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1585,6 +1599,7 @@ sub mail_cgi {
 		"--vertical-label=$rate_label",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1608,6 +1623,7 @@ sub mail_cgi {
 			"--vertical-label=$rate_label",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
diff --git a/lib/memcached.pm b/lib/memcached.pm
index 02069aa..b95f7e0 100644
--- a/lib/memcached.pm
+++ b/lib/memcached.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -418,6 +418,7 @@ sub memcached_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -437,6 +438,9 @@ sub memcached_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -645,6 +649,7 @@ sub memcached_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -675,6 +680,7 @@ sub memcached_cgi {
 				"--vertical-label=Values/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -778,6 +784,7 @@ sub memcached_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -809,6 +816,7 @@ sub memcached_cgi {
 				"--vertical-label=Values/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -882,6 +890,7 @@ sub memcached_cgi {
 			"--vertical-label=Megabytes",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -905,6 +914,7 @@ sub memcached_cgi {
 				"--vertical-label=Megabytes",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -965,6 +975,7 @@ sub memcached_cgi {
 			"--vertical-label=Items",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -985,6 +996,7 @@ sub memcached_cgi {
 				"--vertical-label=Items",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1051,6 +1063,7 @@ sub memcached_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1073,6 +1086,7 @@ sub memcached_cgi {
 				"--vertical-label=Values/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1141,6 +1155,7 @@ sub memcached_cgi {
 			"--vertical-label=Connections/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1163,6 +1178,7 @@ sub memcached_cgi {
 				"--vertical-label=Connections/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1234,6 +1250,7 @@ sub memcached_cgi {
 			"--vertical-label=bytes/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1255,6 +1272,7 @@ sub memcached_cgi {
 				"--vertical-label=bytes/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/mongodb.pm b/lib/mongodb.pm
index 06c7fbe..3af2526 100644
--- a/lib/mongodb.pm
+++ b/lib/mongodb.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -595,6 +595,7 @@ sub mongodb_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -616,6 +617,9 @@ sub mongodb_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -828,6 +832,7 @@ sub mongodb_cgi {
 			"--vertical-label=Operations/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -853,6 +858,7 @@ sub mongodb_cgi {
 				"--vertical-label=Operations/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -935,6 +941,7 @@ sub mongodb_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -958,6 +965,7 @@ sub mongodb_cgi {
 				"--vertical-label=Values/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1027,6 +1035,7 @@ sub mongodb_cgi {
 			"--vertical-label=ms",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1048,6 +1057,7 @@ sub mongodb_cgi {
 				"--vertical-label=ms",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1112,6 +1122,7 @@ sub mongodb_cgi {
 			"--vertical-label=Connections",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1133,6 +1144,7 @@ sub mongodb_cgi {
 				"--vertical-label=Connections",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1197,6 +1209,7 @@ sub mongodb_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1218,6 +1231,7 @@ sub mongodb_cgi {
 				"--vertical-label=Values/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1295,6 +1309,7 @@ sub mongodb_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1316,6 +1331,7 @@ sub mongodb_cgi {
 				"--vertical-label=$vlabel",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1410,6 +1426,7 @@ sub mongodb_cgi {
 				"--vertical-label=Values",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1432,6 +1449,7 @@ sub mongodb_cgi {
 					"--vertical-label=Values",
 					"--width=$width",
 					"--height=$height",
+					@extra,
 					@riglim,
 					$zoom,
 					@{$cgi->{version12}},
@@ -1505,6 +1523,7 @@ sub mongodb_cgi {
 				"--vertical-label=bytes",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1527,6 +1546,7 @@ sub mongodb_cgi {
 					"--vertical-label=bytes",
 					"--width=$width",
 					"--height=$height",
+					@extra,
 					@riglim,
 					$zoom,
 					@{$cgi->{version12}},
diff --git a/lib/mysql.pm b/lib/mysql.pm
index 43c0cf3..16a019c 100644
--- a/lib/mysql.pm
+++ b/lib/mysql.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -508,6 +508,7 @@ sub mysql_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -528,6 +529,9 @@ sub mysql_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -731,6 +735,7 @@ sub mysql_cgi {
 			"--vertical-label=Queries/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -759,6 +764,7 @@ sub mysql_cgi {
 				"--vertical-label=Queries/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -865,6 +871,7 @@ sub mysql_cgi {
 			"--vertical-label=Percent (%)",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -890,6 +897,7 @@ sub mysql_cgi {
 				"--vertical-label=Percent (%)",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -967,6 +975,7 @@ sub mysql_cgi {
 			"--vertical-label=Open & Locks/min",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -988,6 +997,7 @@ sub mysql_cgi {
 				"--vertical-label=Open & Locks/min",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1057,6 +1067,7 @@ sub mysql_cgi {
 			"--vertical-label=Queries/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1078,6 +1089,7 @@ sub mysql_cgi {
 				"--vertical-label=Queries/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1152,6 +1164,7 @@ sub mysql_cgi {
 			"--vertical-label=Connectionss/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1174,6 +1187,7 @@ sub mysql_cgi {
 				"--vertical-label=Connectionss/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1252,6 +1266,7 @@ sub mysql_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1273,6 +1288,7 @@ sub mysql_cgi {
 				"--vertical-label=$vlabel",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/net.pm b/lib/net.pm
index c165852..6362451 100644
--- a/lib/net.pm
+++ b/lib/net.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -270,6 +270,7 @@ sub net_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my $netname;
 	my @tmp;
@@ -287,6 +288,9 @@ sub net_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -463,6 +467,7 @@ sub net_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -489,6 +494,7 @@ sub net_cgi {
 				"--vertical-label=$vlabel",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -562,6 +568,7 @@ sub net_cgi {
 			"--vertical-label=Packets/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -583,6 +590,7 @@ sub net_cgi {
 				"--vertical-label=Packets/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -653,6 +661,7 @@ sub net_cgi {
 			"--vertical-label=Errors/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -674,6 +683,7 @@ sub net_cgi {
 				"--vertical-label=Errors/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/netstat.pm b/lib/netstat.pm
index bce0248..d0acc99 100644
--- a/lib/netstat.pm
+++ b/lib/netstat.pm
@@ -375,6 +375,7 @@ sub netstat_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @tmp;
 	my @tmpz;
@@ -388,6 +389,9 @@ sub netstat_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -532,6 +536,7 @@ sub netstat_cgi {
 		"--vertical-label=Connections",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -557,6 +562,7 @@ sub netstat_cgi {
 			"--vertical-label=Connections",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -657,6 +663,7 @@ sub netstat_cgi {
 		"--vertical-label=Connections",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -682,6 +689,7 @@ sub netstat_cgi {
 			"--vertical-label=Connections",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -761,6 +769,7 @@ sub netstat_cgi {
 		"--vertical-label=Connections",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -785,6 +794,7 @@ sub netstat_cgi {
 			"--vertical-label=Connections",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -864,6 +874,7 @@ sub netstat_cgi {
 		"--vertical-label=Connections",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -890,6 +901,7 @@ sub netstat_cgi {
 			"--vertical-label=Connections",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -957,6 +969,7 @@ sub netstat_cgi {
 		"--vertical-label=Listen",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -979,6 +992,7 @@ sub netstat_cgi {
 			"--vertical-label=Listen",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
diff --git a/lib/nfsc.pm b/lib/nfsc.pm
index e02465e..c3e9475 100644
--- a/lib/nfsc.pm
+++ b/lib/nfsc.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -240,6 +240,7 @@ sub nfsc_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @tmp;
 	my @tmpz;
@@ -284,6 +285,9 @@ sub nfsc_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	my @nfsv2 = ("null", "getattr", "setattr", "root", "lookup", "readlink", "read", "wrcache", "write", "create", "remove", "rename", "link", "symlink", "mkdir", "rmdir", "readdir", "fsstat");
 	my @nfsv3 = ("null", "getattr", "setattr", "lookup", "access", "readlink", "read", "write", "create", "mkdir", "symlink", "mknod", "remove", "rmdir", "rename", "link", "readdir", "readdirplus", "fsstat", "fsinfo", "pathconf", "commit");
@@ -445,6 +449,7 @@ sub nfsc_cgi {
 		"--vertical-label=Requests/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -464,6 +469,7 @@ sub nfsc_cgi {
 			"--vertical-label=Requests/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -539,6 +545,7 @@ sub nfsc_cgi {
 		"--vertical-label=Requests/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -557,6 +564,7 @@ sub nfsc_cgi {
 			"--vertical-label=Requests/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -642,6 +650,7 @@ sub nfsc_cgi {
 		"--vertical-label=Requests/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -661,6 +670,7 @@ sub nfsc_cgi {
 			"--vertical-label=Requests/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -743,6 +753,7 @@ sub nfsc_cgi {
 		"--vertical-label=Requests/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -762,6 +773,7 @@ sub nfsc_cgi {
 			"--vertical-label=Requests/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -844,6 +856,7 @@ sub nfsc_cgi {
 		"--vertical-label=Requests/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -863,6 +876,7 @@ sub nfsc_cgi {
 			"--vertical-label=Requests/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -933,6 +947,7 @@ sub nfsc_cgi {
 		"--vertical-label=Requests/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -955,6 +970,7 @@ sub nfsc_cgi {
 			"--vertical-label=Requests/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
diff --git a/lib/nfss.pm b/lib/nfss.pm
index 0ee3c10..68fb70a 100644
--- a/lib/nfss.pm
+++ b/lib/nfss.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -375,6 +375,7 @@ sub nfss_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @tmp;
 	my @tmpz;
@@ -415,6 +416,9 @@ sub nfss_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	my @nfsv2 = ("null", "getattr", "setattr", "root", "lookup", "readlink", "read", "wrcache", "write", "create", "remove", "rename", "link", "symlink", "mkdir", "rmdir", "readdir", "fsstat");
 	my @nfsv3 = ("null", "getattr", "setattr", "lookup", "access", "readlink", "read", "write", "create", "mkdir", "symlink", "mknod", "remove", "rmdir", "rename", "link", "readdir", "readdirplus", "fsstat", "fsinfo", "pathconf", "commit");
@@ -607,6 +611,7 @@ sub nfss_cgi {
 		"--vertical-label=Requests/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -626,6 +631,7 @@ sub nfss_cgi {
 			"--vertical-label=Requests/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -701,6 +707,7 @@ sub nfss_cgi {
 		"--vertical-label=Requests/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -719,6 +726,7 @@ sub nfss_cgi {
 			"--vertical-label=Requests/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -794,6 +802,7 @@ sub nfss_cgi {
 		"--vertical-label=Requests/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -812,6 +821,7 @@ sub nfss_cgi {
 			"--vertical-label=Requests/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -882,6 +892,7 @@ sub nfss_cgi {
 		"--vertical-label=bytes/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -903,6 +914,7 @@ sub nfss_cgi {
 			"--vertical-label=bytes/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -975,6 +987,7 @@ sub nfss_cgi {
 		"--vertical-label=Values/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -998,6 +1011,7 @@ sub nfss_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1072,6 +1086,7 @@ sub nfss_cgi {
 		"--vertical-label=Values/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1096,6 +1111,7 @@ sub nfss_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1189,6 +1205,7 @@ sub nfss_cgi {
 		"--vertical-label=Values/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1219,6 +1236,7 @@ sub nfss_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1300,6 +1318,7 @@ sub nfss_cgi {
 		"--vertical-label=Requests/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1322,6 +1341,7 @@ sub nfss_cgi {
 			"--vertical-label=Requests/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1395,6 +1415,7 @@ sub nfss_cgi {
 		"--vertical-label=Values/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1419,6 +1440,7 @@ sub nfss_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
diff --git a/lib/nginx.pm b/lib/nginx.pm
index 9673ca4..7d654b0 100644
--- a/lib/nginx.pm
+++ b/lib/nginx.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -269,6 +269,7 @@ sub nginx_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @warning;
 	my @tmp;
@@ -285,6 +286,9 @@ sub nginx_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -424,6 +428,7 @@ sub nginx_cgi {
 		"--vertical-label=Connections/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -447,6 +452,7 @@ sub nginx_cgi {
 			"--vertical-label=Connections/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -514,6 +520,7 @@ sub nginx_cgi {
 		"--vertical-label=Requests/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -534,6 +541,7 @@ sub nginx_cgi {
 			"--vertical-label=Requests/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -644,6 +652,7 @@ sub nginx_cgi {
 		"--vertical-label=$vlabel",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -666,6 +675,7 @@ sub nginx_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
diff --git a/lib/ntp.pm b/lib/ntp.pm
index 7d5951e..be98452 100644
--- a/lib/ntp.pm
+++ b/lib/ntp.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -216,6 +216,7 @@ sub ntp_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -247,6 +248,9 @@ sub ntp_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -405,6 +409,7 @@ sub ntp_cgi {
 			"--vertical-label=Seconds",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -430,6 +435,7 @@ sub ntp_cgi {
 				"--vertical-label=Seconds",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -493,6 +499,7 @@ sub ntp_cgi {
 			"--vertical-label=Level",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -513,6 +520,7 @@ sub ntp_cgi {
 				"--vertical-label=Level",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -579,6 +587,7 @@ sub ntp_cgi {
 			"--vertical-label=Hits",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -608,6 +617,7 @@ sub ntp_cgi {
 				"--vertical-label=Hits",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/nut.pm b/lib/nut.pm
index f389a4f..b88fa68 100644
--- a/lib/nut.pm
+++ b/lib/nut.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -266,6 +266,7 @@ sub nut_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my $temp_scale = "Celsius";
 	my @riglim;
 	my @IMG;
@@ -286,6 +287,9 @@ sub nut_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -480,6 +484,7 @@ sub nut_cgi {
 			"--vertical-label=Volts",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -505,6 +510,7 @@ sub nut_cgi {
 				"--vertical-label=Volts",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -582,6 +588,7 @@ sub nut_cgi {
 			"--vertical-label=Percent (%)",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -607,6 +614,7 @@ sub nut_cgi {
 				"--vertical-label=Percent (%)",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -684,6 +692,7 @@ sub nut_cgi {
 			"--vertical-label=$temp_scale",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -706,6 +715,7 @@ sub nut_cgi {
 				"--vertical-label=$temp_scale",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -771,6 +781,7 @@ sub nut_cgi {
 			"--vertical-label=Volts",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -792,6 +803,7 @@ sub nut_cgi {
 				"--vertical-label=Volts",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -856,6 +868,7 @@ sub nut_cgi {
 			"--vertical-label=Minutes",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -879,6 +892,7 @@ sub nut_cgi {
 				"--vertical-label=Minutes",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -942,6 +956,7 @@ sub nut_cgi {
 			"--vertical-label=Hz",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -962,6 +977,7 @@ sub nut_cgi {
 				"--vertical-label=Hz",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/nvidia.pm b/lib/nvidia.pm
index 2fbccfd..9805b34 100644
--- a/lib/nvidia.pm
+++ b/lib/nvidia.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -296,6 +296,7 @@ sub nvidia_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my $temp_scale = "Celsius";
 	my @tmp;
@@ -321,6 +322,9 @@ sub nvidia_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -477,6 +481,7 @@ sub nvidia_cgi {
 		"--vertical-label=$temp_scale",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -506,6 +511,7 @@ sub nvidia_cgi {
 			"--vertical-label=$temp_scale",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -594,6 +600,7 @@ sub nvidia_cgi {
 		"--vertical-label=Percent",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -623,6 +630,7 @@ sub nvidia_cgi {
 			"--vertical-label=Percent",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -708,6 +716,7 @@ sub nvidia_cgi {
 		"--vertical-label=Percent",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		@{$cgi->{version12}},
 		$zoom,
@@ -737,6 +746,7 @@ sub nvidia_cgi {
 			"--vertical-label=Percent",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
diff --git a/lib/pagespeed.pm b/lib/pagespeed.pm
index 65d5053..e21d789 100644
--- a/lib/pagespeed.pm
+++ b/lib/pagespeed.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -659,6 +659,7 @@ sub pagespeed_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -678,6 +679,9 @@ sub pagespeed_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -866,6 +870,7 @@ sub pagespeed_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -894,6 +899,7 @@ sub pagespeed_cgi {
 				"--vertical-label=Values/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -999,6 +1005,7 @@ sub pagespeed_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1024,6 +1031,7 @@ sub pagespeed_cgi {
 				"--vertical-label=Values/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1107,6 +1115,7 @@ sub pagespeed_cgi {
 			"--vertical-label=Percent (%)",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1133,6 +1142,7 @@ sub pagespeed_cgi {
 				"--vertical-label=Percent (%)",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1210,6 +1220,7 @@ sub pagespeed_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1235,6 +1246,7 @@ sub pagespeed_cgi {
 				"--vertical-label=Values/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1307,6 +1319,7 @@ sub pagespeed_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1332,6 +1345,7 @@ sub pagespeed_cgi {
 				"--vertical-label=Values/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1401,6 +1415,7 @@ sub pagespeed_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1425,6 +1440,7 @@ sub pagespeed_cgi {
 				"--vertical-label=Values/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1496,6 +1512,7 @@ sub pagespeed_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1521,6 +1538,7 @@ sub pagespeed_cgi {
 				"--vertical-label=Value/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1578,6 +1596,7 @@ sub pagespeed_cgi {
 			"--vertical-label=Microseconds/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1598,6 +1617,7 @@ sub pagespeed_cgi {
 				"--vertical-label=Microseconds/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/phpapc.pm b/lib/phpapc.pm
index 956028a..04823db 100644
--- a/lib/phpapc.pm
+++ b/lib/phpapc.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -219,6 +219,7 @@ sub phpapc_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -238,6 +239,9 @@ sub phpapc_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -409,6 +413,7 @@ sub phpapc_cgi {
 			"--vertical-label=Percent (%)",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -433,6 +438,7 @@ sub phpapc_cgi {
 				"--vertical-label=Percent (%)",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -505,6 +511,7 @@ sub phpapc_cgi {
 			"--vertical-label=Percent (%)",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -526,6 +533,7 @@ sub phpapc_cgi {
 				"--vertical-label=Percent (%)",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -589,6 +597,7 @@ sub phpapc_cgi {
 			"--vertical-label=Cached files/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -611,6 +620,7 @@ sub phpapc_cgi {
 				"--vertical-label=Cached files/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/phpfpm.pm b/lib/phpfpm.pm
index b72e82d..0bee2cd 100644
--- a/lib/phpfpm.pm
+++ b/lib/phpfpm.pm
@@ -257,6 +257,7 @@ sub phpfpm_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -287,6 +288,9 @@ sub phpfpm_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -463,6 +467,7 @@ sub phpfpm_cgi {
 			"--vertical-label=Connections/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -490,6 +495,7 @@ sub phpfpm_cgi {
 				"--vertical-label=Connections/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -559,6 +565,7 @@ sub phpfpm_cgi {
 			"--vertical-label=Processes",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -585,6 +592,7 @@ sub phpfpm_cgi {
 				"--vertical-label=Processes",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -652,6 +660,7 @@ sub phpfpm_cgi {
 			"--vertical-label=Listening",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -679,6 +688,7 @@ sub phpfpm_cgi {
 				"--vertical-label=Listening",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -742,6 +752,7 @@ sub phpfpm_cgi {
 			"--vertical-label=Processes",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -785,6 +796,7 @@ sub phpfpm_cgi {
 				"--vertical-label=Processes",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -864,6 +876,7 @@ sub phpfpm_cgi {
 			"--vertical-label=Children",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -891,6 +904,7 @@ sub phpfpm_cgi {
 				"--vertical-label=Children",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -954,6 +968,7 @@ sub phpfpm_cgi {
 			"--vertical-label=Requests",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -981,6 +996,7 @@ sub phpfpm_cgi {
 				"--vertical-label=Requests",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/port.pm b/lib/port.pm
index cbf66f9..cfd243a 100644
--- a/lib/port.pm
+++ b/lib/port.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -345,6 +345,7 @@ sub port_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @warning;
 	my @IMG;
@@ -367,6 +368,9 @@ sub port_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -627,6 +631,7 @@ sub port_cgi {
 				"--vertical-label=$vlabel",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -651,6 +656,7 @@ sub port_cgi {
 					"--vertical-label=$vlabel",
 					"--width=$width",
 					"--height=$height",
+					@extra,
 					@riglim,
 					$zoom,
 					@{$cgi->{version12}},
diff --git a/lib/proc.pm b/lib/proc.pm
index 462667f..c05f989 100644
--- a/lib/proc.pm
+++ b/lib/proc.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -268,6 +268,7 @@ sub proc_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -287,6 +288,9 @@ sub proc_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -622,6 +626,7 @@ sub proc_cgi {
 				"--vertical-label=$vlabel",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -649,6 +654,7 @@ sub proc_cgi {
 					"--vertical-label=$vlabel",
 					"--width=$width",
 					"--height=$height",
+					@extra,
 					@riglim,
 					$zoom,
 					@{$cgi->{version12}},
diff --git a/lib/process.pm b/lib/process.pm
index e3af6d8..0979a06 100644
--- a/lib/process.pm
+++ b/lib/process.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -334,6 +334,7 @@ sub process_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my $graph_title;
 	my @IMG;
 	my @IMGz;
@@ -368,6 +369,9 @@ sub process_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -529,6 +533,7 @@ sub process_cgi {
 			"--vertical-label=Percent (%)",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -557,6 +562,7 @@ sub process_cgi {
 				"--vertical-label=Percent (%)",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -640,6 +646,7 @@ sub process_cgi {
 			"--vertical-label=bytes",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -678,6 +685,7 @@ sub process_cgi {
 				"--vertical-label=bytes",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -768,6 +776,7 @@ sub process_cgi {
 			"--vertical-label=bytes/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -806,6 +815,7 @@ sub process_cgi {
 				"--vertical-label=bytes/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -922,6 +932,7 @@ sub process_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -950,6 +961,7 @@ sub process_cgi {
 				"--vertical-label=$vlabel",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1030,6 +1042,7 @@ sub process_cgi {
 			"--vertical-label=Files",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1058,6 +1071,7 @@ sub process_cgi {
 				"--vertical-label=Files",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1141,6 +1155,7 @@ sub process_cgi {
 			"--vertical-label=Threads",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1169,6 +1184,7 @@ sub process_cgi {
 				"--vertical-label=Threads",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1254,6 +1270,7 @@ sub process_cgi {
 			"--vertical-label=Nonvoluntary + voluntary/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1313,6 +1330,7 @@ sub process_cgi {
 				"--vertical-label=Nonvoluntary + voluntary/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1427,6 +1445,7 @@ sub process_cgi {
 			"--vertical-label=Processes",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1455,6 +1474,7 @@ sub process_cgi {
 				"--vertical-label=Processes",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/raspberrypi.pm b/lib/raspberrypi.pm
index 9948a89..b44ffd1 100644
--- a/lib/raspberrypi.pm
+++ b/lib/raspberrypi.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -227,6 +227,7 @@ sub raspberrypi_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my $temp_scale = "Celsius";
 	my @riglim;
 	my @tmp;
@@ -252,6 +253,9 @@ sub raspberrypi_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -411,6 +415,7 @@ sub raspberrypi_cgi {
 		"--vertical-label=Hz",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -438,6 +443,7 @@ sub raspberrypi_cgi {
 			"--vertical-label=Hz",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -514,6 +520,7 @@ sub raspberrypi_cgi {
 		"--vertical-label=$temp_scale",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -534,6 +541,7 @@ sub raspberrypi_cgi {
 			"--vertical-label=$temp_scale",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -602,6 +610,7 @@ sub raspberrypi_cgi {
 		"--vertical-label=Volts",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -625,6 +634,7 @@ sub raspberrypi_cgi {
 			"--vertical-label=Volts",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
diff --git a/lib/serv.pm b/lib/serv.pm
index 4669641..f131acb 100644
--- a/lib/serv.pm
+++ b/lib/serv.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -652,6 +652,7 @@ sub serv_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my $vlabel;
 	my @tmp;
@@ -667,6 +668,9 @@ sub serv_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -899,6 +903,7 @@ sub serv_cgi {
 		"--vertical-label=$vlabel",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -933,6 +938,7 @@ sub serv_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1032,6 +1038,7 @@ sub serv_cgi {
 		"--vertical-label=$vlabel",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1055,6 +1062,7 @@ sub serv_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1151,6 +1159,7 @@ sub serv_cgi {
 		"--vertical-label=$vlabel",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1177,6 +1186,7 @@ sub serv_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
diff --git a/lib/squid.pm b/lib/squid.pm
index d5e5b0a..a46fa4a 100644
--- a/lib/squid.pm
+++ b/lib/squid.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -481,6 +481,7 @@ sub squid_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @tmp;
 	my @tmpz;
@@ -525,6 +526,9 @@ sub squid_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -772,6 +776,7 @@ sub squid_cgi {
 		"--vertical-label=Values/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -790,6 +795,7 @@ sub squid_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -866,6 +872,7 @@ sub squid_cgi {
 		"--vertical-label=Values/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -884,6 +891,7 @@ sub squid_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -985,6 +993,7 @@ sub squid_cgi {
 		"--vertical-label=Values/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1012,6 +1021,7 @@ sub squid_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1088,6 +1098,7 @@ sub squid_cgi {
 		"--vertical-label=Megabytes",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1112,6 +1123,7 @@ sub squid_cgi {
 			"--vertical-label=Megabytes",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1181,6 +1193,7 @@ sub squid_cgi {
 		"--vertical-label=Megabytes",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1205,6 +1218,7 @@ sub squid_cgi {
 			"--vertical-label=Megabytes",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1280,6 +1294,7 @@ sub squid_cgi {
 		"--vertical-label=Values/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1302,6 +1317,7 @@ sub squid_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1380,6 +1396,7 @@ sub squid_cgi {
 		"--vertical-label=Reads/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1403,6 +1420,7 @@ sub squid_cgi {
 			"--vertical-label=Reads/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1481,6 +1499,7 @@ sub squid_cgi {
 		"--vertical-label=$vlabel",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1502,6 +1521,7 @@ sub squid_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1578,6 +1598,7 @@ sub squid_cgi {
 		"--vertical-label=$vlabel",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1599,6 +1620,7 @@ sub squid_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
diff --git a/lib/system.pm b/lib/system.pm
index abb350e..873c392 100644
--- a/lib/system.pm
+++ b/lib/system.pm
@@ -448,6 +448,7 @@ sub system_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @tmp;
 	my @tmpz;
@@ -461,7 +462,9 @@ sub system_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
-
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -615,6 +618,7 @@ sub system_cgi {
 		"--vertical-label=Load average",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -638,6 +642,7 @@ sub system_cgi {
 			"--vertical-label=Load average",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -712,6 +717,7 @@ sub system_cgi {
 		"--lower-limit=0",
 		"--rigid",
 		"--base=1024",
+		@extra,
 		$zoom,
 		@{$cgi->{version12}},
 		@{$cgi->{version12_small}},
@@ -747,6 +753,7 @@ sub system_cgi {
 			"--lower-limit=0",
 			"--rigid",
 			"--base=1024",
+			@extra,
 			$zoom,
 			@{$cgi->{version12}},
 			@{$cgi->{version12_small}},
@@ -851,6 +858,7 @@ sub system_cgi {
 		"--vertical-label=Processes",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -877,6 +885,7 @@ sub system_cgi {
 			"--vertical-label=Processes",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -940,6 +949,7 @@ sub system_cgi {
 		"--vertical-label=Size",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -960,6 +970,7 @@ sub system_cgi {
 			"--vertical-label=Size",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1017,6 +1028,7 @@ sub system_cgi {
 		"--vertical-label=Days",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1038,6 +1050,7 @@ sub system_cgi {
 			"--vertical-label=Days",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
diff --git a/lib/tc.pm b/lib/tc.pm
index 6873309..11e0c07 100644
--- a/lib/tc.pm
+++ b/lib/tc.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -315,6 +315,7 @@ sub tc_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -348,6 +349,9 @@ sub tc_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -527,6 +531,7 @@ sub tc_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -554,6 +559,7 @@ sub tc_cgi {
 				"--vertical-label=$vlabel",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -637,6 +643,7 @@ sub tc_cgi {
 			"--vertical-label=Packets/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -664,6 +671,7 @@ sub tc_cgi {
 				"--vertical-label=Packets/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -744,6 +752,7 @@ sub tc_cgi {
 			"--vertical-label=Packets/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -771,6 +780,7 @@ sub tc_cgi {
 				"--vertical-label=Packets/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -853,6 +863,7 @@ sub tc_cgi {
 			"--vertical-label=Packets/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -880,6 +891,7 @@ sub tc_cgi {
 				"--vertical-label=Packets/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/traffacct.pm b/lib/traffacct.pm
index b2e9be6..4cf8914 100644
--- a/lib/traffacct.pm
+++ b/lib/traffacct.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -445,6 +445,7 @@ sub traffacct_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -464,6 +465,9 @@ sub traffacct_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	if(lc($config->{netstats_in_bps}) eq "y") {
 		$T = "b";
@@ -550,6 +554,7 @@ sub traffacct_cgi {
 					"--vertical-label=$vlabel",
 					"--width=$width",
 					"--height=$height",
+					@extra,
 					@riglim,
 					$zoom,
 					@{$cgi->{version12}},
@@ -571,6 +576,7 @@ sub traffacct_cgi {
 						"--vertical-label=$vlabel",
 						"--width=$width",
 						"--height=$height",
+						@extra,
 						@riglim,
 						$zoom,
 						@{$cgi->{version12}},
@@ -663,6 +669,7 @@ sub traffacct_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -685,6 +692,7 @@ sub traffacct_cgi {
 				"--vertical-label=$vlabel",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/user.pm b/lib/user.pm
index 8bbd82b..a0dacad 100644
--- a/lib/user.pm
+++ b/lib/user.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -184,6 +184,7 @@ sub user_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @tmp;
 	my @tmpz;
@@ -197,6 +198,9 @@ sub user_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -299,6 +303,7 @@ sub user_cgi {
 		"--vertical-label=Users",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -322,6 +327,7 @@ sub user_cgi {
 			"--vertical-label=Users",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -386,6 +392,7 @@ sub user_cgi {
 		"--vertical-label=Users",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -406,6 +413,7 @@ sub user_cgi {
 			"--vertical-label=Users",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -467,6 +475,7 @@ sub user_cgi {
 		"--vertical-label=Users",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -487,6 +496,7 @@ sub user_cgi {
 			"--vertical-label=Users",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
diff --git a/lib/varnish.pm b/lib/varnish.pm
index 01c7c29..cf8ab91 100644
--- a/lib/varnish.pm
+++ b/lib/varnish.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -394,6 +394,7 @@ sub varnish_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @tmp;
 	my @tmpz;
@@ -407,6 +408,9 @@ sub varnish_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -578,6 +582,7 @@ sub varnish_cgi {
 		"--vertical-label=Values/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -605,6 +610,7 @@ sub varnish_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -711,6 +717,7 @@ sub varnish_cgi {
 		"--vertical-label=Values/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -737,6 +744,7 @@ sub varnish_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -813,6 +821,7 @@ sub varnish_cgi {
 		"--vertical-label=Connections/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -835,6 +844,7 @@ sub varnish_cgi {
 			"--vertical-label=Connections/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -902,6 +912,7 @@ sub varnish_cgi {
 		"--vertical-label=Values/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -924,6 +935,7 @@ sub varnish_cgi {
 			"--vertical-label=Values/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -994,6 +1006,7 @@ sub varnish_cgi {
 		"--vertical-label=Objects",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1017,6 +1030,7 @@ sub varnish_cgi {
 			"--vertical-label=Objects",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1088,6 +1102,7 @@ sub varnish_cgi {
 		"--vertical-label=bytes/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1109,6 +1124,7 @@ sub varnish_cgi {
 			"--vertical-label=bytes/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
diff --git a/lib/verlihub.pm b/lib/verlihub.pm
index faf7398..595f195 100644
--- a/lib/verlihub.pm
+++ b/lib/verlihub.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -185,6 +185,7 @@ sub verlihub_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @tmp;
 	my @tmpz;
@@ -198,6 +199,9 @@ sub verlihub_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -298,6 +302,7 @@ sub verlihub_cgi {
 		"--vertical-label=Users",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -321,6 +326,7 @@ sub verlihub_cgi {
 			"--vertical-label=Users",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -388,6 +394,7 @@ sub verlihub_cgi {
 		"--width=$width",
 		"--height=$height",
 		"--units-exponent=0",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -409,6 +416,7 @@ sub verlihub_cgi {
 			"--width=$width",
 			"--height=$height",
 			"--units-exponent=0",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -471,6 +479,7 @@ sub verlihub_cgi {
 		"--width=$width",
 		"--height=$height",
 		"--units-exponent=0",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -492,6 +501,7 @@ sub verlihub_cgi {
 			"--width=$width",
 			"--height=$height",
 			"--units-exponent=0",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
diff --git a/lib/wowza.pm b/lib/wowza.pm
index a710131..811d752 100644
--- a/lib/wowza.pm
+++ b/lib/wowza.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -408,6 +408,7 @@ sub wowza_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -451,6 +452,9 @@ sub wowza_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -617,6 +621,7 @@ sub wowza_cgi {
 			"--vertical-label=Connections",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -645,6 +650,7 @@ sub wowza_cgi {
 				"--vertical-label=Connections",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -720,6 +726,7 @@ sub wowza_cgi {
 			"--vertical-label=$vlabel",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -754,6 +761,7 @@ sub wowza_cgi {
 				"--vertical-label=$vlabel",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -831,6 +839,7 @@ sub wowza_cgi {
 			"--vertical-label=Connections/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -858,6 +867,7 @@ sub wowza_cgi {
 				"--vertical-label=Connections/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -923,6 +933,7 @@ sub wowza_cgi {
 			"--vertical-label=Connections/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -950,6 +961,7 @@ sub wowza_cgi {
 				"--vertical-label=Connections/s",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
@@ -1015,6 +1027,7 @@ sub wowza_cgi {
 			"--vertical-label=Sessions",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1042,6 +1055,7 @@ sub wowza_cgi {
 				"--vertical-label=Sessions",
 				"--width=$width",
 				"--height=$height",
+				@extra,
 				@riglim,
 				$zoom,
 				@{$cgi->{version12}},
diff --git a/lib/zfs.pm b/lib/zfs.pm
index d0132b6..df86925 100644
--- a/lib/zfs.pm
+++ b/lib/zfs.pm
@@ -1,7 +1,7 @@
 #
 # Monitorix - A lightweight system monitoring tool.
 #
-# Copyright (C) 2005-2017 by Jordi Sanfeliu 
+# Copyright (C) 2005-2019 by Jordi Sanfeliu 
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -320,6 +320,7 @@ sub zfs_cgi {
 	my $u = "";
 	my $width;
 	my $height;
+	my @extra;
 	my @riglim;
 	my @IMG;
 	my @IMGz;
@@ -337,6 +338,9 @@ sub zfs_cgi {
 	my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
 	my $imgfmt_uc = uc($config->{image_format});
 	my $imgfmt_lc = lc($config->{image_format});
+	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
+		push(@extra, trim($i)) if trim($i);
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -511,6 +515,7 @@ sub zfs_cgi {
 		"--vertical-label=bytes",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -537,6 +542,7 @@ sub zfs_cgi {
 			"--vertical-label=bytes",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -611,6 +617,7 @@ sub zfs_cgi {
 		"--vertical-label=Reads/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -633,6 +640,7 @@ sub zfs_cgi {
 			"--vertical-label=Reads/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -697,6 +705,7 @@ sub zfs_cgi {
 		"--vertical-label=Reads/s",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -718,6 +727,7 @@ sub zfs_cgi {
 			"--vertical-label=Reads/s",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -794,6 +804,7 @@ sub zfs_cgi {
 		"--vertical-label=bytes",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -816,6 +827,7 @@ sub zfs_cgi {
 			"--vertical-label=bytes",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -881,6 +893,7 @@ sub zfs_cgi {
 		"--vertical-label=Percent (%)",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -902,6 +915,7 @@ sub zfs_cgi {
 			"--vertical-label=Percent (%)",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -970,6 +984,7 @@ sub zfs_cgi {
 		"--vertical-label=Number",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -992,6 +1007,7 @@ sub zfs_cgi {
 			"--vertical-label=Number",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},
@@ -1057,6 +1073,7 @@ sub zfs_cgi {
 		"--vertical-label=bytes",
 		"--width=$width",
 		"--height=$height",
+		@extra,
 		@riglim,
 		$zoom,
 		@{$cgi->{version12}},
@@ -1081,6 +1098,7 @@ sub zfs_cgi {
 			"--vertical-label=bytes",
 			"--width=$width",
 			"--height=$height",
+			@extra,
 			@riglim,
 			$zoom,
 			@{$cgi->{version12}},

From ddfb3791572c9213c768f1642a27ac051dc6c667 Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Wed, 8 May 2019 15:27:58 +0200
Subject: [PATCH 09/32] updated documentation to include the new option
 'rrdtool_extra_options'

---
 man/man5/monitorix.conf.5 | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/man/man5/monitorix.conf.5 b/man/man5/monitorix.conf.5
index 4c41d97..810daff 100644
--- a/man/man5/monitorix.conf.5
+++ b/man/man5/monitorix.conf.5
@@ -218,6 +218,16 @@ It will show a back arrow in the upper-left corner and it is specially useful fo
 Default value: \fIn\fP
 .RE
 .P
+.BI rrdtool_extra_options
+.RS
+This option permits create a comma-separated list of RRDtool options that will be included in all graphs. This is specially useful if you want to take advantage of an specific RRDtool graphics option.
+.P
+An example would be:
+.P
+.br
+	rrdtool_extra_options = "--grid-dash=1:0, --no-legend"
+.RE
+.P
 .BI base_dir
 .RS
 This is the absolute path to the directory where all the web elements are located:

From 28ed22b31152e1dc0caab0fdb019e854cd886425 Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Tue, 14 May 2019 13:16:50 +0200
Subject: [PATCH 10/32] Changed how the values in 'fail2ban.pm' are shown.

With the new option 'graph_mode' the values are, by default, shown with
absolute values. This new option permits switching between 'absolute' and
'rate'. #241
---
 Changes                   |   4 ++
 lib/fail2ban.pm           | 111 +++++++++++++++++++++++---------------
 man/man5/monitorix.conf.5 |   9 +++-
 3 files changed, 80 insertions(+), 44 deletions(-)

diff --git a/Changes b/Changes
index 28dde42..de53e50 100644
--- a/Changes
+++ b/Changes
@@ -11,9 +11,13 @@
 - Added support for FreeBSD NFS Server stats. [#238]
 - Added the new option 'rrdtool_extra_options' to be able to include RRDtool
   extra options on every graph.
+  	(suggested by Greg Ogonowski, greg AT indexcom.com)
 - Changed the main loop functionality using now the select() function, instead
   of the alarm()+pause() pair. This should improve the responsiveness on high
   system loads. [#230]
+- Changed how the values in 'fail2ban.pm' are shown. Now it shows the Bans as
+  absolute values. The new option 'graph_mode' permits switching between
+  'absolute' (default) and 'rate'. [#241]
 - Fixed the copyright year in 'monitorix.cgi'.
 - Fixed in 'mail.pm to use the option 'mail_log' instead the hard coded path I
   forgot to remove when adding the Exim support.
diff --git a/lib/fail2ban.pm b/lib/fail2ban.pm
index d84527e..f76bf1f 100644
--- a/lib/fail2ban.pm
+++ b/lib/fail2ban.pm
@@ -142,48 +142,70 @@ sub fail2ban_update {
 	my $str;
 	my $rrdata = "N";
 
-	if(! -r $config->{fail2ban_log}) {
-		logger("Couldn't find file '$config->{fail2ban_log}': $!");
-		return;
-	}
-
-	$seek_pos = $config->{fail2ban_hist} || 0;
-	$seek_pos = defined($seek_pos) ? int($seek_pos) : 0;
-	open(IN, $config->{fail2ban_log});
-	if(!seek(IN, 0, 2)) {
-		logger("Couldn't seek to the end of '$config->{fail2ban_log}': $!");
-		return;
-	}
-	$logsize = tell(IN);
-	if($logsize < $seek_pos) {
-		$seek_pos = 0;
-	}
-	if(!seek(IN, $seek_pos, 0)) {
-		logger("Couldn't seek to $seek_pos in '$config->{fail2ban_log}': $!");
-		return;
-	}
-	if($config->{fail2ban_hist} > 0) {	# avoids initial peak
-		my $date = strftime("%Y-%m-%d", localtime);
-		while() {
-			if(/^$date/) {
-				my $e = 0;
-				while($e < scalar(my @fl = split(',', $fail2ban->{list}))) {
-					my $e2 = 0;
-					foreach my $i (split(',', $fail2ban->{desc}->{$e})) {
-						($str = trim($i)) =~ s/\[/\\[/;
-						$str =~ s/\]/\\]/;
-						$jails[$e][$e2] = 0 unless defined $jails[$e][$e2];
-						if(/ $str Ban /) {
-							$jails[$e][$e2]++;
+	if(lc($fail2ban->{graph_mode} || "") ne "rate") {
+		my $e = 0;
+		while($e < scalar(my @fl = split(',', $fail2ban->{list}))) {
+			my $e2 = 0;
+			foreach my $i (split(',', $fail2ban->{desc}->{$e})) {
+				($str = trim($i)) =~ s/\[//;
+				$str =~ s/\]//;
+				$jails[$e][$e2] = 0 unless defined $jails[$e][$e2];
+				if(open(IN, "fail2ban-client status $str |")) {
+					while() {
+						if(/- Currently banned:\s+(\d+)$/) {
+							$jails[$e][$e2] = $1;
 						}
-						$e2++;
 					}
-					$e++;
+					close(IN);
+				}
+				$e2++;
+			}
+			$e++;
+		}
+	} else {
+		if(! -r $config->{fail2ban_log}) {
+			logger("Couldn't find file '$config->{fail2ban_log}': $!");
+			return;
+		}
+
+		$seek_pos = $config->{fail2ban_hist} || 0;
+		$seek_pos = defined($seek_pos) ? int($seek_pos) : 0;
+		open(IN, $config->{fail2ban_log});
+		if(!seek(IN, 0, 2)) {
+			logger("Couldn't seek to the end of '$config->{fail2ban_log}': $!");
+			return;
+		}
+		$logsize = tell(IN);
+		if($logsize < $seek_pos) {
+			$seek_pos = 0;
+		}
+		if(!seek(IN, $seek_pos, 0)) {
+			logger("Couldn't seek to $seek_pos in '$config->{fail2ban_log}': $!");
+			return;
+		}
+		if($config->{fail2ban_hist} > 0) {	# avoids initial peak
+			my $date = strftime("%Y-%m-%d", localtime);
+			while() {
+				if(/^$date/) {
+					my $e = 0;
+					while($e < scalar(my @fl = split(',', $fail2ban->{list}))) {
+						my $e2 = 0;
+						foreach my $i (split(',', $fail2ban->{desc}->{$e})) {
+							($str = trim($i)) =~ s/\[/\\[/;
+							$str =~ s/\]/\\]/;
+							$jails[$e][$e2] = 0 unless defined $jails[$e][$e2];
+							if(/ $str Ban /) {
+								$jails[$e][$e2]++;
+							}
+							$e2++;
+						}
+						$e++;
+					}
 				}
 			}
 		}
+		close(IN);
 	}
-	close(IN);
 
 	my $e = 0;
 	while($e < scalar(my @fl = split(',', $fail2ban->{list}))) {
@@ -234,6 +256,7 @@ sub fail2ban_cgi {
 	my @tmp;
 	my @tmpz;
 	my @CDEF;
+	my $vlabel = "Bans";
 	my $n;
 	my $n2;
 	my $str;
@@ -259,6 +282,9 @@ sub fail2ban_cgi {
 	foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
 		push(@extra, trim($i)) if trim($i);
 	}
+	if(lc($fail2ban->{graph_mode} || "") eq "rate") {
+		$vlabel = "Bans/min";
+	}
 
 	$title = !$silent ? $title : "";
 
@@ -374,11 +400,10 @@ sub fail2ban_cgi {
 			my $e = 0;
 			foreach my $i (split(',', $fail2ban->{desc}->{$n})) {
 				$str = sprintf("%-25s", substr(trim($i), 0, 25));
-				push(@tmp, "LINE1:j" . ($e + 1) . $LC[$e] . ":$str");
-				push(@tmp, "GPRINT:j" . ($e + 1) . ":LAST: Cur\\:%2.0lf\\g");
-				push(@tmp, "GPRINT:j" . ($e + 1) . ":AVERAGE:   Avg\\:%2.0lf\\g");
-				push(@tmp, "GPRINT:j" . ($e + 1) . ":MIN:   Min\\:%2.0lf\\g");
-				push(@tmp, "GPRINT:j" . ($e + 1) . ":MAX:   Max\\:%2.0lf\\n");
+				push(@tmp, "LINE2:j" . ($e + 1) . $LC[$e] . ":$str");
+				push(@tmp, "GPRINT:j" . ($e + 1) . ":LAST: Cur\\:%3.0lf\\g");
+				push(@tmp, "GPRINT:j" . ($e + 1) . ":AVERAGE:     Avg\\:%3.0lf\\g");
+				push(@tmp, "GPRINT:j" . ($e + 1) . ":MAX:     Max\\:%3.0lf\\n");
 				push(@tmpz, "LINE2:j" . ($e + 1) . $LC[$e] . ":$str");
 				$e++;
 			}
@@ -397,7 +422,7 @@ sub fail2ban_cgi {
 				"--title=$str  ($tf->{nwhen}$tf->{twhen})",
 				"--start=-$tf->{nwhen}$tf->{twhen}",
 				"--imgformat=$imgfmt_uc",
-				"--vertical-label=Bans/min",
+				"--vertical-label=$vlabel",
 				"--width=$width",
 				"--height=$height",
 				@extra,
@@ -426,7 +451,7 @@ sub fail2ban_cgi {
 					"--title=$str  ($tf->{nwhen}$tf->{twhen})",
 					"--start=-$tf->{nwhen}$tf->{twhen}",
 					"--imgformat=$imgfmt_uc",
-					"--vertical-label=Bans/min",
+					"--vertical-label=$vlabel",
 					"--width=$width",
 					"--height=$height",
 					@extra,
diff --git a/man/man5/monitorix.conf.5 b/man/man5/monitorix.conf.5
index 810daff..97d66d6 100644
--- a/man/man5/monitorix.conf.5
+++ b/man/man5/monitorix.conf.5
@@ -452,7 +452,7 @@ Default value: \fI/var/log/proftpd/access.log\fP
 .P
 .BI fail2ban_log
 .RS
-This is the path to the Fail2ban log file. Monitorix uses this file to report IP addresses banned.
+This is the path to the Fail2ban log file. Monitorix uses this file only if the option \fBgraph_mode\fP has the value \fIrate\fP.
 .P
 Default value: \fI/var/log/fail2ban.log\fP
 .RE
@@ -2642,6 +2642,13 @@ This is the number of fail2ban graphs that will be put in a row.
 .P
 Default value: \fI2\fP
 .RE
+.P
+.BI graph_mode 
+.RS
+This option changes how the values are represented in the graph. It has two possible values: \fIabsolute\fP which is the default, and \fIrate\fP. The former takes the values directly from the command \fIfail2ban-client status \fP and so the values in the graph will appear as absolute. The later option shows the values in a rating format per minute.
+.P
+Default value: \fIabsolute\fP
+.RE
 .SS Icecast Streaming Media Server (icecast.pm)
 This graph is able to monitor an unlimited number of Icecast servers.
 .P

From 3c1b2602a368edd25920ca0cc3622d2ddf461e58 Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Wed, 15 May 2019 10:51:00 +0200
Subject: [PATCH 11/32] changed the way how 'ztool iostat' command get the
 read/write values of the   Operations/Bandwidth graphs #242

---
 Changes    |  2 ++
 lib/zfs.pm | 10 ++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Changes b/Changes
index de53e50..53141c3 100644
--- a/Changes
+++ b/Changes
@@ -18,6 +18,8 @@
 - Changed how the values in 'fail2ban.pm' are shown. Now it shows the Bans as
   absolute values. The new option 'graph_mode' permits switching between
   'absolute' (default) and 'rate'. [#241]
+- Changed the way how 'ztool iostat' command get the read/write values of the
+  Operations/Bandwidth graphs. [#242]
 - Fixed the copyright year in 'monitorix.cgi'.
 - Fixed in 'mail.pm to use the option 'mail_log' instead the hard coded path I
   forgot to remove when adding the Exim support.
diff --git a/lib/zfs.pm b/lib/zfs.pm
index df86925..c90ea06 100644
--- a/lib/zfs.pm
+++ b/lib/zfs.pm
@@ -267,6 +267,7 @@ sub zfs_update {
 		my $pool = (split(',', $zfs->{list}))[$n] || "";
 		if($pool) {
 			my @zpool;
+			my @data;
 
 			$free = trim(`zfs get -Hp -o value available $pool`);
 			$udata = trim(`zfs get -Hp -o value used $pool`);
@@ -282,8 +283,13 @@ sub zfs_update {
 			}
 			$cap =~ s/%//;
 			$fra =~ s/[%-]//g; $fra = $fra || 0;
-			@zpool = split(' ', `zpool iostat -Hp $pool` || "");
-			(undef, undef, undef, $oper, $opew, $banr, $banw) = @zpool;
+
+			open(IN, "zpool iostat -Hp $pool 5 2 |");
+			while() {
+				push(@data, $_);
+			}
+			close(IN);
+			(undef, undef, undef, $oper, $opew, $banr, $banw) = split(' ', $data[1]);
 		}
 
 		$rrdata .= ":$free:$udata:$usnap:$cap:$fra:$oper:$opew:$banr:$banw:0";

From 252a843ca6c2744d9a8411bf6468a257819b4a13 Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Fri, 17 May 2019 12:13:19 +0200
Subject: [PATCH 12/32] added the new option 'subject_prefix' in
 'emailreports.pm' to be able to set a customized prefix in the Subject of the
 emails that will be sent

---
 Changes                   | 2 ++
 lib/emailreports.pm       | 5 ++++-
 man/man5/monitorix.conf.5 | 7 +++++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/Changes b/Changes
index 53141c3..19922e3 100644
--- a/Changes
+++ b/Changes
@@ -12,6 +12,8 @@
 - Added the new option 'rrdtool_extra_options' to be able to include RRDtool
   extra options on every graph.
   	(suggested by Greg Ogonowski, greg AT indexcom.com)
+- Added the new option 'subject_prefix' in 'emailreports.pm' to be able to
+  set a customized prefix in the Subject of the emails that will be sent.
 - Changed the main loop functionality using now the select() function, instead
   of the alarm()+pause() pair. This should improve the responsiveness on high
   system loads. [#230]
diff --git a/lib/emailreports.pm b/lib/emailreports.pm
index 33ae8f9..7757840 100644
--- a/lib/emailreports.pm
+++ b/lib/emailreports.pm
@@ -38,6 +38,7 @@ sub emailreports_send {
 	my $imgs_dir = $config->{imgs_dir};
 	my $images;
 	my $mime;
+	my $subject;
 	
 	logger("$myself: sending $report reports.");
 
@@ -175,6 +176,8 @@ EOF
 
 	$html .= $html_footer;
 
+	$subject = $emailreports->{subject_prefix} || "Monitorix:";
+
 	# create the multipart container and add attachments
 	foreach (split(',', $emailreports->{$report}->{to})) {
 		my $to = trim($_);
@@ -182,7 +185,7 @@ EOF
 		my $msg = new MIME::Lite(
 			From		=> $emailreports->{from_address},
 			To		=> $to,
-			Subject		=> "Monitorix: '$report' Report",
+			Subject		=> "$subject '$report' Report",
 			Type		=> "multipart/related",
 			Organization	=> "Monitorix",
 		);
diff --git a/man/man5/monitorix.conf.5 b/man/man5/monitorix.conf.5
index 97d66d6..07e066e 100644
--- a/man/man5/monitorix.conf.5
+++ b/man/man5/monitorix.conf.5
@@ -3117,6 +3117,13 @@ This is the address that will be used as remitent for all the monthly report ema
 Default value: \fInoreply@example.com\fP
 .RE
 .P
+.BI subject_prefix
+.RS
+This is a string that will be prefixed in the Subject of all emails that will be sent.
+.P
+Default value: \fIMonitorix:\fP
+.RE
+.P
 .BI hour
 .RS
 This is the hour (in 24h format) when the email reports will be sent.

From a442f2bed26691e1c4b0f5551a473a3db927c105 Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Wed, 22 May 2019 08:23:55 +0200
Subject: [PATCH 13/32] small adjustment in the values alignment

---
 lib/fail2ban.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/fail2ban.pm b/lib/fail2ban.pm
index f76bf1f..767e77b 100644
--- a/lib/fail2ban.pm
+++ b/lib/fail2ban.pm
@@ -401,9 +401,9 @@ sub fail2ban_cgi {
 			foreach my $i (split(',', $fail2ban->{desc}->{$n})) {
 				$str = sprintf("%-25s", substr(trim($i), 0, 25));
 				push(@tmp, "LINE2:j" . ($e + 1) . $LC[$e] . ":$str");
-				push(@tmp, "GPRINT:j" . ($e + 1) . ":LAST: Cur\\:%3.0lf\\g");
-				push(@tmp, "GPRINT:j" . ($e + 1) . ":AVERAGE:     Avg\\:%3.0lf\\g");
-				push(@tmp, "GPRINT:j" . ($e + 1) . ":MAX:     Max\\:%3.0lf\\n");
+				push(@tmp, "GPRINT:j" . ($e + 1) . ":LAST:Cur\\:%4.0lf\\g");
+				push(@tmp, "GPRINT:j" . ($e + 1) . ":AVERAGE:    Avg\\:%4.0lf\\g");
+				push(@tmp, "GPRINT:j" . ($e + 1) . ":MAX:    Max\\:%4.0lf\\n");
 				push(@tmpz, "LINE2:j" . ($e + 1) . $LC[$e] . ":$str");
 				$e++;
 			}

From ac2826805c90aee640fb5db9764dbae6b8acee61 Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Fri, 24 May 2019 07:55:50 +0200
Subject: [PATCH 14/32] added support for port range #172

---
 lib/port.pm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/port.pm b/lib/port.pm
index cfd243a..41c1f78 100644
--- a/lib/port.pm
+++ b/lib/port.pm
@@ -143,6 +143,10 @@ sub port_init {
 				logger("$myself: port number '$np' listed but not defined.");
 				next;
 			}
+			# support for port range (i.e: 49152:65534)
+			if(index($pl[$n], ":") != -1) {
+				($np) = ($pl[$n] =~ m/^(\d+:\d+).*?/);
+			}
 			if($pl[$n] && $np) {
 				my $p = trim(lc((split(',', $port->{desc}->{$pl[$n]}))[1])) || "";
 				if(! grep {$_ eq $p} ("tcp", "udp", "tcp6", "udp6")) {

From 09f5365bf25ae3d035032844e758f23df890a33e Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Fri, 24 May 2019 10:25:23 +0200
Subject: [PATCH 15/32] updated documentation #172

---
 man/man5/monitorix.conf.5 | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/man/man5/monitorix.conf.5 b/man/man5/monitorix.conf.5
index 07e066e..854ebd4 100644
--- a/man/man5/monitorix.conf.5
+++ b/man/man5/monitorix.conf.5
@@ -2018,9 +2018,9 @@ Default value: \fI24000\fP
 .P
 .BI list
 .RS
-You may define here up to \fBmax\fP network port numbers. If you need to monitor the same network port with TCP and UDP protocols, you can add your own suffix to the port number (e.g: 443t and 443u) in order to distinguish it from the double definition in the  block.
+You may define here up to \fBmax\fP network port numbers. If you need to monitor the same network port with TCP and UDP protocols, you can add your own suffix to the port number (e.g: 443t and 443u) in order to distinguish it from the double definition in the  block. It also support port ranges (e.g: 49152:65534) to be able to monitor the traffic of a number of consecutive ports summarized on a unique graph.
 .P
-If you see a red color in the background of a network port graph, it means that there is not a daemon listening on that port. This can be useful to know if some service gone down unexpectedly.
+If you see a red color in the background of a network port graph, it means that there is not a daemon listening on that port. This can be useful to know if some service gone down unexpectedly. Of course, this is only valid on a single port, not ranged ports.
 .RE
 .P
 .BI desc
@@ -2037,24 +2037,28 @@ This is the option where each network port specified in \fBlist\fP is described.
 .br
 - the limit value.
 .br
-- the \fIL\fP optional option which specifies that this port should be listening and Monitorix will advice it, by changing the background color of the graph to red, if finds it down.
+- the \fIL\fP optional option which specifies that this port should be listening and Monitorix will advice it, by changing the background color of the graph to red, if finds it down. This option has no effect on ranged ports.
 .RE
 .P
 There is also support (Linux only) for IPv6 network ports activity by using protocol names as \fItcp6\fP or \fIudp6\fP.
 .P
 An example would be:
 .RS
-list = 25, 25ip6, 80, 53
+list = 25, 25ip6, 80, 53t, 53u, 49152:65534
 .br
 
 .br
-	25 =    SMTP, tcp,  in/out, 0, 1000, L
+	25          = SMTP, tcp,  in/out, 0, 1000, L
 .br
-	25ip6 = SMTP, tcp6, in/out, 0, 1000, L
+	25ip6       = SMTP, tcp6, in/out, 0, 1000, L
 .br
-	80 =    HTTP, tcp,  in,     0, 1000, L
+	80          = HTTP, tcp,  in,     0, 1000, L
 .br
-	53 =    DNS,  udp,  in,     0, 1000, L
+	53t         = DNS,  tcp,  in,     0, 1000, L
+.br
+	53u         = DNS,  udp,  in,     0, 1000, L
+.br
+	49152:65534 = FTP_PSV, tcp, in,   0, 1000
 .br
 
 .RE

From 5decd7e8d72d7f8d298ecb3e1fa3177007ae7771 Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Mon, 27 May 2019 12:48:17 +0200
Subject: [PATCH 16/32] update Changes #172

---
 Changes | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changes b/Changes
index 19922e3..fcac682 100644
--- a/Changes
+++ b/Changes
@@ -14,6 +14,7 @@
   	(suggested by Greg Ogonowski, greg AT indexcom.com)
 - Added the new option 'subject_prefix' in 'emailreports.pm' to be able to
   set a customized prefix in the Subject of the emails that will be sent.
+- Added the ability to support port ranges in 'port.pm'. [#172]
 - Changed the main loop functionality using now the select() function, instead
   of the alarm()+pause() pair. This should improve the responsiveness on high
   system loads. [#230]

From dcb4eeef099827db2a025d341a6190b0475d90f5 Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Thu, 20 Jun 2019 17:18:43 +0200
Subject: [PATCH 17/32] included support for version ZFS 0.8.1 #245

---
 lib/zfs.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/zfs.pm b/lib/zfs.pm
index c90ea06..2da4e9f 100644
--- a/lib/zfs.pm
+++ b/lib/zfs.pm
@@ -274,7 +274,10 @@ sub zfs_update {
 			$usnap = eval join('+',`zfs get -rHp -o value usedbysnapshots -tfilesystem $pool`);
 			@zpool = split(' ', `zpool list -H $pool` || "");
 
-			if(scalar(@zpool) == 10) {	# ZFS version 0.6.4+
+			if(scalar(@zpool) > 10) {	# ZFS version 0.8.0+
+				$cap = trim($zpool[7]);
+				$fra = trim($zpool[6]);
+			} elsif(scalar(@zpool) == 10) {	# ZFS version 0.6.4+
 				$cap = trim($zpool[6]);
 				$fra = trim($zpool[5]);
 			} elsif(scalar(@zpool) == 8) {	# ZFS version 0.6.3- (?)

From 66c5c25b3290013d4f1e154c6bb015ab6107ad26 Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Fri, 21 Jun 2019 08:53:00 +0200
Subject: [PATCH 18/32] update Changes

---
 Changes | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changes b/Changes
index fcac682..ce4f4d2 100644
--- a/Changes
+++ b/Changes
@@ -32,6 +32,7 @@
 - Fixed to ensure that the 'L' option in port.pm is optional.
 - Fixed to make sure that a maximum of 9 values is accepted in the 'graph_0'
   and 'graph_1' options of 'squid.pm'; warn user otherwise. [#235]
+- Fixed to include support for ZFS version 0.8.1+ in 'zfs.pm'. [#245]
 
 
 3.11.0 - 14-Mar-2019

From 417cb9a39dab9128c5f859e48d8f246b0bd28e39 Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Tue, 25 Jun 2019 08:03:21 +0200
Subject: [PATCH 19/32] honored the environment variable $OPTIONS during the
 execution

---
 docs/monitorix.service | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/monitorix.service b/docs/monitorix.service
index cb04ded..05be596 100644
--- a/docs/monitorix.service
+++ b/docs/monitorix.service
@@ -7,7 +7,7 @@ After=multi-user.target
 [Service]
 Type=forking
 EnvironmentFile=-/etc/sysconfig/monitorix
-ExecStart=/usr/bin/monitorix -c /etc/monitorix/monitorix.conf -p /run/monitorix.pid
+ExecStart=/usr/bin/monitorix -c /etc/monitorix/monitorix.conf -p /run/monitorix.pid $OPTIONS
 PIDFile=/run/monitorix.pid
 
 [Install]

From e4cb9b936d7f7c3af0e816e46c538c037019c3b7 Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Tue, 25 Jun 2019 08:19:21 +0200
Subject: [PATCH 20/32] rewritten the 'bind.pm' module to use XML::LibXML
 instead of XML::Simple, fixing a number of long standing bugs. #181

---
 lib/bind.pm | 273 ++++++++++++++++++++++++++++------------------------
 1 file changed, 149 insertions(+), 124 deletions(-)

diff --git a/lib/bind.pm b/lib/bind.pm
index 11ee650..0168da2 100644
--- a/lib/bind.pm
+++ b/lib/bind.pm
@@ -25,7 +25,7 @@ use warnings;
 use Monitorix;
 use RRDs;
 use LWP::UserAgent;
-use XML::Simple;
+use XML::LibXML;
 use Exporter 'import';
 our @EXPORT = qw(bind_init bind_update bind_cgi);
 
@@ -305,14 +305,14 @@ sub bind_update {
 		my $ua = LWP::UserAgent->new(timeout => 30, $ssl);
 		$ua->agent($config->{user_agent_id}) if $config->{user_agent_id} || "";
 		my $response = $ua->request(HTTP::Request->new('GET', $l));
-		my $data = XMLin($response->content);
+		my $data = XML::LibXML->new->load_xml(string => $response->content);
 		my $value;
 
 		# BIND v9.9+ has different statistics layout than BIND v9.5+.
 		# we attempt first to get stats from a BIND v9.5+
-		if(!($value = $data->{bind}->{statistics}->{version})) {
+		if(!($value = $data->findnodes('/isc/bind/statistics/@version'))) {
 			# otherwise attempt it on a BIND v9.9+
-			$value = $data->{version};
+			$value = $data->findnodes('/statistics/@version');
 		}
 		my ($major, $minor) = split('\.', $value);
 		$minor =~ m/^(\d+)/;
@@ -321,12 +321,17 @@ sub bind_update {
 			logger("$myself: BIND stats version '$version' unsupported.");
 		}
 
-
 		if($major eq "2") {
-			$value = $data->{bind}->{statistics}->{server}->{requests}->{opcode}->{counter};
+			foreach my $counters ($data->findnodes('/isc/bind/statistics/server/requests/opcode')) {
+				foreach my $c ($counters) {
+					my $name = $c->findvalue('name');
+					my $counter = $c->findvalue('counter');
+					$value = $counter if $name eq "QUERY";
+				}
+			}
 		}
 		if($major eq "3") {
-			$value = $data->{server}->{counters}->[0]->{counter}->{QUERY}->{content};
+			$value = $data->findnodes('/statistics/server/counters/counter[@name="QUERY"]');
 		}
 		$str = $n . "totalinq";
 		$value = $value || 0;
@@ -335,130 +340,136 @@ sub bind_update {
 		$totalinq /= 60;
 		$config->{bind_hist}->{$str} = $value;
 
-
 		if($major eq "2") {
-			$value = $data->{bind}->{statistics}->{server}->{'queries-in'}->{rdtype};
-
-			# converts BIND's output when there is only one hit
-			if($value->{name}) {
-				my $name = $value->{name};
-				my $counter = $value->{counter};
-
-				delete($value->{name});
-				delete($value->{counter});
-				$value->{$name}->{'counter'} = $counter;
-			}
-
-			foreach(keys %{$value}) {
-				$str = $n . "inq_$_";
-				$inq{$str} = $value->{$_}->{counter} - ($config->{bind_hist}->{$str} || 0);
-				$inq{$str} = 0 unless $inq{$str} != $value->{$_}->{counter};
-				$inq{$str} /= 60;
-				$config->{bind_hist}->{$str} = $value->{$_}->{counter};
+			foreach my $counters ($data->findnodes('/isc/bind/statistics/server/queries-in/*')) {
+				foreach my $c ($counters) {
+					my $name = $c->findvalue('name');
+					my $counter = $c->findvalue('counter');
+					$str = $n . "inq_$name";
+					$inq{$str} = $counter - ($config->{bind_hist}->{$str} || 0);
+					$inq{$str} = 0 unless $inq{$str} != $counter;
+					$inq{$str} /= 60;
+					$config->{bind_hist}->{$str} = $counter;
+				}
 			}
 		}
 		if($major eq "3") {
-			$value = $data->{server}->{counters}->[1]->{counter} ;
-			foreach(keys %{$value}) {
-				$str = $n . "inq_$_";
-				$inq{$str} = $value->{$_}->{content} - ($config->{bind_hist}->{$str} || 0);
-				$inq{$str} = 0 unless $inq{$str} != $value->{$_}->{content};
-				$inq{$str} /= 60;
-				$config->{bind_hist}->{$str} = $value->{$_}->{content};
+			foreach my $counters ($data->findnodes('/statistics/server/counters[@type="qtype"]/*')) {
+				foreach my $c ($counters) {
+					my $name = $c->findvalue('@name');
+					my $counter = $c->textContent();
+					$str = $n . "inq_$name";
+					$inq{$str} = $counter - ($config->{bind_hist}->{$str} || 0);
+					$inq{$str} = 0 unless $inq{$str} != $counter;
+					$inq{$str} /= 60;
+					$config->{bind_hist}->{$str} = $counter;
+				}
 			}
 		}
 
-
-		my $views_default;
 		if($major eq "2") {
-			$views_default = $data->{bind}->{statistics}->{views}->{view}->{_default};
-			$value = $views_default->{rdtype};
-			foreach(keys %{$value}) {
-				$str = $n . "ouq_$_";
-				$ouq{$str} = $value->{$_}->{counter} - ($config->{bind_hist}->{$str} || 0);
-				$ouq{$str} = 0 unless $ouq{$str} != $value->{$_}->{counter};
-				$ouq{$str} /= 60;
-				$config->{bind_hist}->{$str} = $value->{$_}->{counter};
+			foreach my $counters ($data->findnodes('/isc/bind/statistics/views/view/rdtype')) {
+				foreach my $c ($counters) {
+					my $name = $c->findvalue('name');
+					my $counter = $c->findvalue('counter');
+					$str = $n . "ouq_$name";
+					$ouq{$str} = $counter - ($config->{bind_hist}->{$str} || 0);
+					$ouq{$str} = 0 unless $ouq{$str} != $counter;
+					$ouq{$str} /= 60;
+					$config->{bind_hist}->{$str} = $counter;
+				}
 			}
 		}
 		if($major eq "3") {
-			$views_default = $data->{views}->{view}->{_default}->{counters};
-			$value = $views_default->[0]->{counter};
-			foreach(keys %{$value}) {
-				$str = $n . "ouq_$_";
-				$ouq{$str} = $value->{$_}->{content} - ($config->{bind_hist}->{$str} || 0);
-				$ouq{$str} = 0 unless $ouq{$str} != $value->{$_}->{content};
-				$ouq{$str} /= 60;
-				$config->{bind_hist}->{$str} = $value->{$_}->{content};
+			foreach my $counters ($data->findnodes('/statistics/views/view[@name="_default"]/counters[@type="resqtype"]/*')) {
+				foreach my $c ($counters) {
+					my $name = $c->findvalue('@name');
+					my $counter = $c->textContent();
+					$str = $n . "ouq_$name";
+					$ouq{$str} = $counter - ($config->{bind_hist}->{$str} || 0);
+					$ouq{$str} = 0 unless $ouq{$str} != $counter;
+					$ouq{$str} /= 60;
+					$config->{bind_hist}->{$str} = $counter;
+				}
 			}
 		}
 
-
 		if($major eq "2") {
-			$value = $data->{bind}->{statistics}->{server}->{nsstat};
-			foreach(keys %{$value}) {
-				$str = $n . "ss_$_";
-				$ss{$str} = $value->{$_}->{counter} - ($config->{bind_hist}->{$str} || 0);
-				$ss{$str} = 0 unless $ss{$str} != $value->{$_}->{counter};
-				$ss{$str} /= 60;
-				$config->{bind_hist}->{$str} = $value->{$_}->{counter};
+			foreach my $counters ($data->findnodes('/isc/bind/statistics/server/nsstat')) {
+				foreach my $c ($counters) {
+					my $name = $c->findvalue('name');
+					my $counter = $c->findvalue('counter');
+					$str = $n . "ss_$name";
+					$ss{$str} = $counter - ($config->{bind_hist}->{$str} || 0);
+					$ss{$str} = 0 unless $ss{$str} != $counter;
+					$ss{$str} /= 60;
+					$config->{bind_hist}->{$str} = $counter;
+				}
 			}
 		}
 		if($major eq "3") {
-			$value = $data->{server}->{counters}->[2]->{counter};
-			foreach(keys %{$value}) {
-				$str = $n . "ss_$_";
-				$ss{$str} = $value->{$_}->{content} - ($config->{bind_hist}->{$str} || 0);
-				$ss{$str} = 0 unless $ss{$str} != $value->{$_}->{content};
-				$ss{$str} /= 60;
-				$config->{bind_hist}->{$str} = $value->{$_}->{content};
+			foreach my $counters ($data->findnodes('/statistics/server/counters[@type="nsstat"]/*')) {
+				foreach my $c ($counters) {
+					my $name = $c->findvalue('@name');
+					my $counter = $c->textContent();
+					$str = $n . "ss_$name";
+					$ss{$str} = $counter - ($config->{bind_hist}->{$str} || 0);
+					$ss{$str} = 0 unless $ss{$str} != $counter;
+					$ss{$str} /= 60;
+					$config->{bind_hist}->{$str} = $counter;
+				}
 			}
 		}
 
-
 		if($major eq "2") {
-			$value = $views_default->{resstat};
-			foreach(keys %{$value}) {
-				$str = $n . "rs_$_";
-				$rs{$str} = $value->{$_}->{counter} - ($config->{bind_hist}->{$str} || 0);
-				$rs{$str} = 0 unless $rs{$str} != $value->{$_}->{counter};
-				$rs{$str} /= 60;
-				$config->{bind_hist}->{$str} = $value->{$_}->{counter};
+			LOOP:
+			foreach my $counters ($data->findnodes('/isc/bind/statistics/views/view/resstat')) {
+				foreach my $c ($counters) {
+					my $name = $c->findvalue('name');
+					my $counter = $c->findvalue('counter');
+					last LOOP if $name eq "Queryv4" && defined($rs{$str});
+					$str = $n . "rs_$name";
+					$rs{$str} = $counter - ($config->{bind_hist}->{$str} || 0);
+					$rs{$str} = 0 unless $rs{$str} != $counter;
+					$rs{$str} /= 60;
+					$config->{bind_hist}->{$str} = $counter;
+				}
 			}
 		}
 		if($major eq "3") {
-			$value = $views_default->[1]->{counter};
-			foreach(keys %{$value}) {
-				$str = $n . "rs_$_";
-				$rs{$str} = $value->{$_}->{content} - ($config->{bind_hist}->{$str} || 0);
-				$rs{$str} = 0 unless $rs{$str} != $value->{$_}->{content};
-				$rs{$str} /= 60;
-				$config->{bind_hist}->{$str} = $value->{$_}->{content};
+			foreach my $counters ($data->findnodes('/statistics/views/view[@name="_default"]/counters[@type="resstats"]/*')) {
+				foreach my $c ($counters) {
+					my $name = $c->findvalue('@name');
+					my $counter = $c->textContent();
+					$str = $n . "rs_$name";
+					$rs{$str} = $counter - ($config->{bind_hist}->{$str} || 0);
+					$rs{$str} = 0 unless $rs{$str} != $counter;
+					$rs{$str} /= 60;
+					$config->{bind_hist}->{$str} = $counter;
+				}
 			}
 		}
 
-
 		if($major eq "2") {
-			$value = $views_default->{cache}->{rrset};
+			foreach my $counters ($data->findnodes('/isc/bind/statistics/views/view/cache[@name="_default"]/rrset')) {
+				foreach my $c ($counters) {
+					my $name = $c->findvalue('name');
+					my $counter = $c->findvalue('counter');
+					$str = $n . "crr_$name";
+					$crr{$str} = $counter;
+				}
+			}
 		}
 		if($major eq "3") {
-			$value = $data->{views}->{view}->{_default}->{cache}->{rrset};
+			foreach my $counters ($data->findnodes('/statistics/views/view[@name="_default"]/cache[@name="_default"]/*')) {
+				foreach my $c ($counters) {
+					my $name = $c->findvalue('name');
+					my $counter = $c->findvalue('counter');
+					$str = $n . "crr_$name";
+					$crr{$str} = $counter;
+				}
+			}
 		}
-		foreach(keys %{$value}) {
-			$str = $n . "crr_$_";
-			$crr{$str} = $value->{$_}->{counter};
-		}
-
-
-#		Socket I/O Statistics
-#		$value = $data->{bind}->{statistics}->{server}->{sockstat};
-#		foreach(keys %{$value}) {
-#			$str = $n . "sio_$_";
-#			$sio{$str} = $value->{$_}->{counter} - ($config->{bind_hist}->{$str} || 0);
-#			$sio{$str} = 0 unless $sio{$str} != $value->{$_}->{counter};
-#			$sio{$str} /= 60;
-#			$config->{bind_hist}->{$str} = $value->{$_}->{counter};
-#		}
 
 		$rrdata .= ":$totalinq";
 		my @i;
@@ -497,37 +508,51 @@ sub bind_update {
 			$rrdata .= ":";
 			$rrdata .= defined($crr{$str}) ? $crr{$str} : 0;
 		}
-#		@i = split(',', $bind->{sio_stats_list}->{$l});
-		for($n2 = 0; $n2 < 20; $n2++) {
-			my $j = "";	#trim($i[$n2]);
-			$str = $n . "sio_$j";
-			$rrdata .= ":";
-			$rrdata .= defined($sio{$str}) ? $sio{$str} : 0;
+#		@i = split(',', $bind->{sio_stats_list}->{$l});                                
+		for($n2 = 0; $n2 < 20; $n2++) {                                                
+			my $j = "";     #trim($i[$n2]);
+			$str = $n . "sio_$j";                                                  
+			$rrdata .= ":";                                                        
+			$rrdata .= defined($sio{$str}) ? $sio{$str} : 0;                       
+		}                                                                        
+
+		if($major eq "2") {
+			foreach my $counters ($data->findnodes('/isc/bind/statistics/memory/summary')) {
+				$rrdata .= ":" . $counters->findvalue('./TotalUse');
+				$rrdata .= ":" . $counters->findvalue('./InUse');
+				$rrdata .= ":" . $counters->findvalue('./BlockSize');
+				$rrdata .= ":" . $counters->findvalue('./ContextSize');
+				$rrdata .= ":" . $counters->findvalue('./Lost');
+			}
+			$rrdata .= ":0:0:0";
+		}
+		if($major eq "3") {
+			foreach my $counters ($data->findnodes('/statistics/memory/summary')) {
+				$rrdata .= ":" . $counters->findvalue('./TotalUse');
+				$rrdata .= ":" . $counters->findvalue('./InUse');
+				$rrdata .= ":" . $counters->findvalue('./BlockSize');
+				$rrdata .= ":" . $counters->findvalue('./ContextSize');
+				$rrdata .= ":" . $counters->findvalue('./Lost');
+			}
+			$rrdata .= ":0:0:0";
 		}
 
 		if($major eq "2") {
-			$value = $data->{bind}->{statistics}->{memory};
+			foreach my $counters ($data->findnodes('/isc/bind/statistics/taskmgr/thread-model')) {
+				$rrdata .= ":" . $counters->findvalue('./worker-threads');
+				$rrdata .= ":" . $counters->findvalue('./default-quantum');
+				$rrdata .= ":" . $counters->findvalue('./tasks-running');
+			}
+			$rrdata .= ":0:0:0";
 		}
 		if($major eq "3") {
-			$value = $data->{memory};
+			foreach my $counters ($data->findnodes('/statistics/taskmgr/thread-model')) {
+				$rrdata .= ":" . $counters->findvalue('./worker-threads');
+				$rrdata .= ":" . $counters->findvalue('./default-quantum');
+				$rrdata .= ":" . $counters->findvalue('./tasks-running');
+			}
+			$rrdata .= ":0:0:0";
 		}
-		$rrdata .= ":" . $value->{summary}->{TotalUse};
-		$rrdata .= ":" . $value->{summary}->{InUse};
-		$rrdata .= ":" . $value->{summary}->{BlockSize};
-		$rrdata .= ":" . $value->{summary}->{ContextSize};
-		$rrdata .= ":" . $value->{summary}->{Lost};
-		$rrdata .= ":0:0:0";
-
-		if($major eq "2") {
-			$value = $data->{bind}->{statistics}->{taskmgr};
-		}
-		if($major eq "3") {
-			$value = $data->{taskmgr};
-		}
-		$rrdata .= ":" . ($value->{'thread-model'}->{'worker-threads'} || 0);
-		$rrdata .= ":" . $value->{'thread-model'}->{'default-quantum'};
-		$rrdata .= ":" . $value->{'thread-model'}->{'tasks-running'};
-		$rrdata .= ":0:0:0";
 	}
 
 	RRDs::update($rrd, $rrdata);

From 9fe82ff9e7c5baea7fca2395e2ffbf19ba4df5d1 Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Tue, 25 Jun 2019 08:19:37 +0200
Subject: [PATCH 21/32] update Changes

---
 Changes | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Changes b/Changes
index ce4f4d2..43daa71 100644
--- a/Changes
+++ b/Changes
@@ -3,6 +3,8 @@
 - Added a complete graph to support PHP-FPM statistics ('phpfpm.pm'). [#167]
 - Completely rewritten the 'gensens.pm' module which includes the battery
   values as its third supported sensor. [#170]
+- Rewritten the 'bind.pm' module to use XML::LibXML instead of XML::Simple,
+  fixing a number of long standing bugs. [#181] [#244]
 - Added a warning if a process vanished during the accouting in 'process.pm'
 - Added the ability, in the alerts of 'gensens.pm', to support a range of two
   values, separated by a dash, in the threshold. [#221]
@@ -33,6 +35,7 @@
 - Fixed to make sure that a maximum of 9 values is accepted in the 'graph_0'
   and 'graph_1' options of 'squid.pm'; warn user otherwise. [#235]
 - Fixed to include support for ZFS version 0.8.1+ in 'zfs.pm'. [#245]
+- Fixed to honor the environment variable $OPTIONS during the execution.
 
 
 3.11.0 - 14-Mar-2019

From 6ff982c0de2e4f7bff73408a7b09df4a3fc7d587 Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Tue, 25 Jun 2019 12:34:27 +0200
Subject: [PATCH 22/32] small fix in the way how $totalinq value is retrieved

---
 lib/bind.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bind.pm b/lib/bind.pm
index 0168da2..254aad4 100644
--- a/lib/bind.pm
+++ b/lib/bind.pm
@@ -331,7 +331,7 @@ sub bind_update {
 			}
 		}
 		if($major eq "3") {
-			$value = $data->findnodes('/statistics/server/counters/counter[@name="QUERY"]');
+			$value = $data->findvalue('/statistics/server/counters/counter[@name="QUERY"]');
 		}
 		$str = $n . "totalinq";
 		$value = $value || 0;

From 39a5a6be73572911526a99633af46ef26b2036db Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Thu, 27 Jun 2019 08:45:33 +0200
Subject: [PATCH 23/32] make sure to initialize all 20 values of every option.
 #244

---
 lib/bind.pm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/bind.pm b/lib/bind.pm
index 254aad4..a2642a6 100644
--- a/lib/bind.pm
+++ b/lib/bind.pm
@@ -475,42 +475,42 @@ sub bind_update {
 		my @i;
 		@i = split(',', $bind->{in_queries_list}->{$l});
 		for($n2 = 0; $n2 < 20; $n2++) {
-			my $j = trim($i[$n2]);
+			my $j = trim($i[$n2] || 0);
 			$str = $n . "inq_$j";
 			$rrdata .= ":";
 			$rrdata .= defined($inq{$str}) ? $inq{$str} : 0;
 		}
 		@i = split(',', $bind->{out_queries_list}->{$l});
 		for($n2 = 0; $n2 < 20; $n2++) {
-			my $j = trim($i[$n2]);
+			my $j = trim($i[$n2] || 0);
 			$str = $n . "ouq_$j";
 			$rrdata .= ":";
 			$rrdata .= defined($ouq{$str}) ? $ouq{$str} : 0;
 		}
 		@i = split(',', $bind->{server_stats_list}->{$l});
 		for($n2 = 0; $n2 < 20; $n2++) {
-			my $j = trim($i[$n2]);
+			my $j = trim($i[$n2] || 0);
 			$str = $n . "ss_$j";
 			$rrdata .= ":";
 			$rrdata .= defined($ss{$str}) ? $ss{$str} : 0;
 		}
 		@i = split(',', $bind->{resolver_stats_list}->{$l});
 		for($n2 = 0; $n2 < 20; $n2++) {
-			my $j = trim($i[$n2]);
+			my $j = trim($i[$n2] || 0);
 			$str = $n . "rs_$j";
 			$rrdata .= ":";
 			$rrdata .= defined($rs{$str}) ? $rs{$str} : 0;
 		}
 		@i = split(',', $bind->{cache_rrsets_list}->{$l});
 		for($n2 = 0; $n2 < 20; $n2++) {
-			my $j = trim($i[$n2]);
+			my $j = trim($i[$n2] || 0);
 			$str = $n . "crr_$j";
 			$rrdata .= ":";
 			$rrdata .= defined($crr{$str}) ? $crr{$str} : 0;
 		}
 #		@i = split(',', $bind->{sio_stats_list}->{$l});                                
 		for($n2 = 0; $n2 < 20; $n2++) {                                                
-			my $j = "";     #trim($i[$n2]);
+			my $j = "";     #trim($i[$n2] || 0);
 			$str = $n . "sio_$j";                                                  
 			$rrdata .= ":";                                                        
 			$rrdata .= defined($sio{$str}) ? $sio{$str} : 0;                       

From 54360ed54de66b45076dbe1223ccea79c00f12db Mon Sep 17 00:00:00 2001
From: Attila <1230402+borzaka@users.noreply.github.com>
Date: Tue, 13 Aug 2019 20:16:03 +0200
Subject: [PATCH 24/32] fail2ban ssh filter is called sshd

---
 monitorix.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitorix.conf b/monitorix.conf
index 8880d89..776fd93 100644
--- a/monitorix.conf
+++ b/monitorix.conf
@@ -671,7 +671,7 @@ secure_log_date_format = %b %e
 
 	list = Security, Overload / Abuse
 	
-		0 = [apache], [apache-mod-security], [apache-overflows], [courierauth], [ssh], [pam-generic], [php-url-fopen], [vsftpd]
+		0 = [apache], [apache-mod-security], [apache-overflows], [courierauth], [sshd], [pam-generic], [php-url-fopen], [vsftpd]
 		1 = [apache-evasive], [apache-badbots], [named-refused-udp], [named-refused-tcp]
 	
 	graphs_per_row = 2

From 6ee6eabb0387bfe1a0435f587bd2a86f6833519c Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Tue, 27 Aug 2019 17:10:29 +0200
Subject: [PATCH 25/32] do not auto-restart the built-in HTTP server if it
 returned '401 Access Denied' #249

---
 monitorix | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/monitorix b/monitorix
index dae0fef..31b0360 100755
--- a/monitorix
+++ b/monitorix
@@ -861,10 +861,12 @@ while(1) {
 				if(!$pid) {
 					my $url = "http://localhost:" . $config{httpd_builtin}->{port} . $config{base_url};
 					my $ua = LWP::UserAgent->new(timeout => 30);
-					my $response = $ua->request(HTTP::Request->new('GET', $url));
+					my $response = $ua->get($url);
 					if(!$response->is_success) {
-						logger("WARNING: HTTP built-in server not responding at '$url'.");
-						exit(1);
+						if($response->status_line ne "401 Access Denied") {
+							logger("WARNING: HTTP built-in server not responding at '$url'.");
+							exit(1);
+						}
 					}
 					exit(0);
 				}

From ad2b7eee37be40568e15ee304de501d346014fee Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Tue, 27 Aug 2019 17:15:15 +0200
Subject: [PATCH 26/32] returns an original line #249

---
 monitorix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitorix b/monitorix
index 31b0360..5179163 100755
--- a/monitorix
+++ b/monitorix
@@ -861,7 +861,7 @@ while(1) {
 				if(!$pid) {
 					my $url = "http://localhost:" . $config{httpd_builtin}->{port} . $config{base_url};
 					my $ua = LWP::UserAgent->new(timeout => 30);
-					my $response = $ua->get($url);
+					my $response = $ua->request(HTTP::Request->new('GET', $url));
 					if(!$response->is_success) {
 						if($response->status_line ne "401 Access Denied") {
 							logger("WARNING: HTTP built-in server not responding at '$url'.");

From 0a64f94d1aa768458650910dc4b007e361d25f02 Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Wed, 28 Aug 2019 08:02:20 +0200
Subject: [PATCH 27/32] update Changes

---
 Changes | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Changes b/Changes
index 43daa71..2c0b1c9 100644
--- a/Changes
+++ b/Changes
@@ -36,6 +36,8 @@
   and 'graph_1' options of 'squid.pm'; warn user otherwise. [#235]
 - Fixed to include support for ZFS version 0.8.1+ in 'zfs.pm'. [#245]
 - Fixed to honor the environment variable $OPTIONS during the execution.
+- Fixed to not auto-restart the built-in HTTP server if it returned the message
+  "401 Access Denied" which happens when Basic Authentication is enabled. [#249]
 
 
 3.11.0 - 14-Mar-2019

From 45571642dbcff76fea2bcca080833fe3b1ac1bbf Mon Sep 17 00:00:00 2001
From: Jordi Sanfeliu 
Date: Fri, 30 Aug 2019 20:06:34 +0200
Subject: [PATCH 28/32] added the option 'enable_parallelizing' to the
 documentation

---
 man/man5/monitorix.conf.5 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/man/man5/monitorix.conf.5 b/man/man5/monitorix.conf.5
index 854ebd4..fb2c60b 100644
--- a/man/man5/monitorix.conf.5
+++ b/man/man5/monitorix.conf.5
@@ -155,6 +155,13 @@ This is the format of each generated graph. There are only two possible values:
 Default value: \fIPNG\fP
 .RE
 .P
+.BI enable_parallelizing
+.RS
+This option will fork an independent process for each graph in order to speed up graph generation in multi-core systems. It's best to keep it disabled on unicore processors.
+.P
+Default value: \fIy\fP
+.RE
+.P
 .BI include_dir
 .RS
 The main configuration file is usually called \fImonitorix.conf\fP and its location is provided as part of the command line arguments. In addition, other configuration files may be loaded placing them in the directory pointed by this option. The names must end with .conf to be included.

From 7ac91303f39816b4c87cf4e0cd0893f4a7e6a673 Mon Sep 17 00:00:00 2001
From: Attila <1230402+borzaka@users.noreply.github.com>
Date: Sun, 1 Sep 2019 23:25:06 +0200
Subject: [PATCH 29/32] Update debian.conf with corrent mysqld socket path

Checked on Debian 9 and 10 with this command: sudo find / -type s
---
 docs/debian.conf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/debian.conf b/docs/debian.conf
index bb576b2..42e1caa 100644
--- a/docs/debian.conf
+++ b/docs/debian.conf
@@ -8,9 +8,9 @@
 
 
 	conn_type = socket
-	list = /var/run/mysqld/mysqld.sock
+	list = /run/mysqld/mysqld.sock
 	
-		/var/run/mysqld/mysqld.sock = 3306, user, secret
+		/run/mysqld/mysqld.sock = 3306, user, secret
 	
 
 

From b0c90681380769bca0a838d2380c9a79cf09b4f6 Mon Sep 17 00:00:00 2001
From: Attila <1230402+borzaka@users.noreply.github.com>
Date: Thu, 19 Sep 2019 12:18:33 +0200
Subject: [PATCH 30/32] Add note to the ProFTPD ftp_log to use ExtendedLog

For best results with the ProFTPD server add this line to its configuration file:
ExtendedLog /var/log/proftpd/access.log AUTH,DIRS,READ,WRITE
---
 monitorix.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitorix.conf b/monitorix.conf
index 776fd93..377de30 100644
--- a/monitorix.conf
+++ b/monitorix.conf
@@ -52,7 +52,7 @@ milter_gl	= /var/milter-greylist/greylist.db
 imap_log	= /var/log/imap
 hylafax_log	= /var/spool/hylafax/etc/xferfaxlog
 cups_log	= /var/log/cups/page_log
-ftp_log		= /var/log/proftpd/access.log
+ftp_log		= /var/log/proftpd/access.log # To make this work add this line to the ProFTPDs configuration file: ExtendedLog /var/log/proftpd/access.log AUTH,DIRS,READ,WRITE
 fail2ban_log	= /var/log/fail2ban.log
 spamassassin_log	= /var/log/maillog
 clamav_log	= /var/log/clamav/clamav.log

From 17ae7af58a70284bcbb591120798b3ccf8834e69 Mon Sep 17 00:00:00 2001
From: Attila <1230402+borzaka@users.noreply.github.com>
Date: Wed, 9 Oct 2019 12:59:23 +0200
Subject: [PATCH 31/32] Add a shorter note to the ProFTPD ftp_log

A shorter note to read the manual, because you have to edit your ProFTPD config to make this setting work.
---
 monitorix.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitorix.conf b/monitorix.conf
index 377de30..6c54f18 100644
--- a/monitorix.conf
+++ b/monitorix.conf
@@ -52,7 +52,7 @@ milter_gl	= /var/milter-greylist/greylist.db
 imap_log	= /var/log/imap
 hylafax_log	= /var/spool/hylafax/etc/xferfaxlog
 cups_log	= /var/log/cups/page_log
-ftp_log		= /var/log/proftpd/access.log # To make this work add this line to the ProFTPDs configuration file: ExtendedLog /var/log/proftpd/access.log AUTH,DIRS,READ,WRITE
+ftp_log		= /var/log/proftpd/access.log # Check monitorix.conf(5) manpage how to edit your ProFTPD server.
 fail2ban_log	= /var/log/fail2ban.log
 spamassassin_log	= /var/log/maillog
 clamav_log	= /var/log/clamav/clamav.log

From be8a6ddb2e4fc64e7641c33d6e075ba9901805b3 Mon Sep 17 00:00:00 2001
From: NAJIYASIGEEF <56391491+NAJIYASIGEEF@users.noreply.github.com>
Date: Fri, 18 Oct 2019 20:25:29 +0530
Subject: [PATCH 32/32] Update README.md

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index cb7a418..7606b8f 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 Monitorix
 =========
-Monitorix is a free, open source, lightweight system monitoring tool designed to monitor as many services and system resources as possible.
+Monitorix is a free, open-source, lightweight system monitoring tool designed to monitor as many services and system resources as possible.
 
 Community
 ---------