From 9489cda2650d24d9609ca73e3c962e58945171be Mon Sep 17 00:00:00 2001 From: Andreas Bachlechner <62039342+bachandi@users.noreply.github.com> Date: Tue, 22 Mar 2022 08:06:54 +0100 Subject: [PATCH] Add gap_on_all_nan config option to fs.pm module. --- lib/fs.pm | 22 +++++++++++++--------- man/man5/monitorix.conf.5 | 7 +++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/fs.pm b/lib/fs.pm index eadf496..c496085 100644 --- a/lib/fs.pm +++ b/lib/fs.pm @@ -890,7 +890,7 @@ sub fs_cgi { } $title = !$silent ? $title : ""; - + my $gap_on_all_nan = lc($fs->{gap_on_all_nan} || "") eq "y" ? 1 : 0; # text mode # @@ -1036,6 +1036,7 @@ sub fs_cgi { ($width, $height) = split('x', $config->{graph_size}->{main}) if $silent eq "imagetagbig"; @tmp = @tmpz; } + my $cdef_allvalues_fs = $gap_on_all_nan ? "CDEF:allvalues=fs0,UN,0,1,IF,fs1,UN,0,1,IF,fs2,UN,0,1,IF,fs3,UN,0,1,IF,fs4,UN,0,1,IF,fs5,UN,0,1,IF,fs6,UN,0,1,IF,fs7,UN,0,1,IF,+,+,+,+,+,+,+,0,GT,1,UNKN,IF" : "CDEF:allvalues=fs0,fs1,fs2,fs3,fs4,fs5,fs6,fs7,+,+,+,+,+,+,+"; $pic = $rrd{$version}->("$IMG_DIR" . "$IMG[$e * 4]", "--title=$config->{graphs}->{_fs1} ($tf->{nwhen}$tf->{twhen})", "--start=-$tf->{nwhen}$tf->{twhen}", @@ -1056,7 +1057,7 @@ sub fs_cgi { "DEF:fs5=$rrd:fs" . $e . "_use5:AVERAGE", "DEF:fs6=$rrd:fs" . $e . "_use6:AVERAGE", "DEF:fs7=$rrd:fs" . $e . "_use7:AVERAGE", - "CDEF:allvalues=fs0,fs1,fs2,fs3,fs4,fs5,fs6,fs7,+,+,+,+,+,+,+", + $cdef_allvalues_fs, @CDEF, @tmp); $err = RRDs::error; @@ -1084,7 +1085,7 @@ sub fs_cgi { "DEF:fs5=$rrd:fs" . $e . "_use5:AVERAGE", "DEF:fs6=$rrd:fs" . $e . "_use6:AVERAGE", "DEF:fs7=$rrd:fs" . $e . "_use7:AVERAGE", - "CDEF:allvalues=fs0,fs1,fs2,fs3,fs4,fs5,fs6,fs7,+,+,+,+,+,+,+", + $cdef_allvalues_fs, @CDEF, @tmpz); $err = RRDs::error; @@ -1155,6 +1156,7 @@ sub fs_cgi { push(@tmp, "COMMENT: \\n"); push(@tmp, "COMMENT: \\n"); } + my $cdef_allvalues_ioa = $gap_on_all_nan ? "CDEF:allvalues=ioa0,UN,0,1,IF,ioa1,UN,0,1,IF,ioa2,UN,0,1,IF,ioa3,UN,0,1,IF,ioa4,UN,0,1,IF,ioa5,UN,0,1,IF,ioa6,UN,0,1,IF,ioa7,UN,0,1,IF,+,+,+,+,+,+,+,0,GT,1,UNKN,IF" : "CDEF:allvalues=ioa0,ioa1,ioa2,ioa3,ioa4,ioa5,ioa6,ioa7,+,+,+,+,+,+,+"; $pic = $rrd{$version}->("$IMG_DIR" . "$IMG[$e * 4 + 1]", "--title=$config->{graphs}->{_fs2} ($tf->{nwhen}$tf->{twhen})", "--start=-$tf->{nwhen}$tf->{twhen}", @@ -1175,7 +1177,7 @@ sub fs_cgi { "DEF:ioa5=$rrd:fs" . $e . "_ioa5:AVERAGE", "DEF:ioa6=$rrd:fs" . $e . "_ioa6:AVERAGE", "DEF:ioa7=$rrd:fs" . $e . "_ioa7:AVERAGE", - "CDEF:allvalues=ioa0,ioa1,ioa2,ioa3,ioa4,ioa5,ioa6,ioa7,+,+,+,+,+,+,+", + $cdef_allvalues_ioa, @CDEF, @tmp); $err = RRDs::error; @@ -1203,7 +1205,7 @@ sub fs_cgi { "DEF:ioa5=$rrd:fs" . $e . "_ioa5:AVERAGE", "DEF:ioa6=$rrd:fs" . $e . "_ioa6:AVERAGE", "DEF:ioa7=$rrd:fs" . $e . "_ioa7:AVERAGE", - "CDEF:allvalues=ioa0,ioa1,ioa2,ioa3,ioa4,ioa5,ioa6,ioa7,+,+,+,+,+,+,+", + $cdef_allvalues_ioa, @CDEF, @tmpz); $err = RRDs::error; @@ -1271,6 +1273,7 @@ sub fs_cgi { ($width, $height) = split('x', $config->{graph_size}->{main}) if $silent eq "imagetagbig"; @tmp = @tmpz; } + my $cdef_allvalues_ino = $gap_on_all_nan ? "CDEF:allvalues=fs0,UN,0,1,IF,fs1,UN,0,1,IF,fs2,UN,0,1,IF,fs3,UN,0,1,IF,fs4,UN,0,1,IF,fs5,UN,0,1,IF,fs6,UN,0,1,IF,fs7,UN,0,1,IF,+,+,+,+,+,+,+,0,GT,1,UNKN,IF" : "CDEF:allvalues=fs0,fs1,fs2,fs3,fs4,fs5,fs6,fs7,+,+,+,+,+,+,+"; $pic = $rrd{$version}->("$IMG_DIR" . "$IMG[$e * 4 + 2]", "--title=$config->{graphs}->{_fs3} ($tf->{nwhen}$tf->{twhen})", "--start=-$tf->{nwhen}$tf->{twhen}", @@ -1291,7 +1294,7 @@ sub fs_cgi { "DEF:fs5=$rrd:fs" . $e . "_ino5:AVERAGE", "DEF:fs6=$rrd:fs" . $e . "_ino6:AVERAGE", "DEF:fs7=$rrd:fs" . $e . "_ino7:AVERAGE", - "CDEF:allvalues=fs0,fs1,fs2,fs3,fs4,fs5,fs6,fs7,+,+,+,+,+,+,+", + $cdef_allvalues_ino, @CDEF, @tmp); $err = RRDs::error; @@ -1319,7 +1322,7 @@ sub fs_cgi { "DEF:fs5=$rrd:fs" . $e . "_ino5:AVERAGE", "DEF:fs6=$rrd:fs" . $e . "_ino6:AVERAGE", "DEF:fs7=$rrd:fs" . $e . "_ino7:AVERAGE", - "CDEF:allvalues=fs0,fs1,fs2,fs3,fs4,fs5,fs6,fs7,+,+,+,+,+,+,+", + $cdef_allvalues_ino, @CDEF, @tmpz); $err = RRDs::error; @@ -1425,6 +1428,7 @@ sub fs_cgi { push(@tmp, "COMMENT: \\n"); push(@tmp, "COMMENT: \\n"); } + my $cdef_allvalues_tim = $gap_on_all_nan ? "CDEF:allvalues=tim0,UN,0,1,IF,tim1,UN,0,1,IF,tim2,UN,0,1,IF,tim3,UN,0,1,IF,tim4,UN,0,1,IF,tim5,UN,0,1,IF,tim6,UN,0,1,IF,tim7,UN,0,1,IF,+,+,+,+,+,+,+,0,GT,1,UNKN,IF" : "CDEF:allvalues=tim0,tim1,tim2,tim3,tim4,tim5,tim6,tim7,+,+,+,+,+,+,+"; $pic = $rrd{$version}->("$IMG_DIR" . "$IMG[$e * 4 + 3]", "--title=$graph_title", "--start=-$tf->{nwhen}$tf->{twhen}", @@ -1445,7 +1449,7 @@ sub fs_cgi { "DEF:tim5=$rrd:fs" . $e . "_tim5:AVERAGE", "DEF:tim6=$rrd:fs" . $e . "_tim6:AVERAGE", "DEF:tim7=$rrd:fs" . $e . "_tim7:AVERAGE", - "CDEF:allvalues=tim0,tim1,tim2,tim3,tim4,tim5,tim6,tim7,+,+,+,+,+,+,+", + $cdef_allvalues_tim, "CDEF:stim0=tim0,1000,/", "CDEF:stim1=tim1,1000,/", "CDEF:stim2=tim2,1000,/", @@ -1481,7 +1485,7 @@ sub fs_cgi { "DEF:tim5=$rrd:fs" . $e . "_tim5:AVERAGE", "DEF:tim6=$rrd:fs" . $e . "_tim6:AVERAGE", "DEF:tim7=$rrd:fs" . $e . "_tim7:AVERAGE", - "CDEF:allvalues=tim0,tim1,tim2,tim3,tim4,tim5,tim6,tim7,+,+,+,+,+,+,+", + $cdef_allvalues_tim, "CDEF:stim0=tim0,1000,/", "CDEF:stim1=tim1,1000,/", "CDEF:stim2=tim2,1000,/", diff --git a/man/man5/monitorix.conf.5 b/man/man5/monitorix.conf.5 index fd10069..482a663 100644 --- a/man/man5/monitorix.conf.5 +++ b/man/man5/monitorix.conf.5 @@ -2706,6 +2706,13 @@ This option, when enabled via \fIy\fP, shows \fInan\fP values for missing data i .P Default value: \fIn\fP .RE +.P +.BI gap_on_all_nan +.RS +This option, when enabled via \fIy\fP, combined with the \fIshow_gaps\fP option shows gaps only if all data points are \fInan\fP instead of requiring only one to be \fInan\fP for a gap. This can be useful if not all sensor data are required for normal operation. +.P +Default value: \fIn\fP +.RE .SS ZFS statistics (zfs.pm) This graph is able to monitor an unlimited number of pools. .P