Add gap_on_all_nan config option to fs.pm module.

This commit is contained in:
Andreas Bachlechner 2022-03-22 08:06:54 +01:00
parent 931e315f79
commit 9489cda265
2 changed files with 20 additions and 9 deletions

View File

@ -890,7 +890,7 @@ sub fs_cgi {
} }
$title = !$silent ? $title : ""; $title = !$silent ? $title : "";
my $gap_on_all_nan = lc($fs->{gap_on_all_nan} || "") eq "y" ? 1 : 0;
# text mode # text mode
# #
@ -1036,6 +1036,7 @@ sub fs_cgi {
($width, $height) = split('x', $config->{graph_size}->{main}) if $silent eq "imagetagbig"; ($width, $height) = split('x', $config->{graph_size}->{main}) if $silent eq "imagetagbig";
@tmp = @tmpz; @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]", $pic = $rrd{$version}->("$IMG_DIR" . "$IMG[$e * 4]",
"--title=$config->{graphs}->{_fs1} ($tf->{nwhen}$tf->{twhen})", "--title=$config->{graphs}->{_fs1} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}", "--start=-$tf->{nwhen}$tf->{twhen}",
@ -1056,7 +1057,7 @@ sub fs_cgi {
"DEF:fs5=$rrd:fs" . $e . "_use5:AVERAGE", "DEF:fs5=$rrd:fs" . $e . "_use5:AVERAGE",
"DEF:fs6=$rrd:fs" . $e . "_use6:AVERAGE", "DEF:fs6=$rrd:fs" . $e . "_use6:AVERAGE",
"DEF:fs7=$rrd:fs" . $e . "_use7:AVERAGE", "DEF:fs7=$rrd:fs" . $e . "_use7:AVERAGE",
"CDEF:allvalues=fs0,fs1,fs2,fs3,fs4,fs5,fs6,fs7,+,+,+,+,+,+,+", $cdef_allvalues_fs,
@CDEF, @CDEF,
@tmp); @tmp);
$err = RRDs::error; $err = RRDs::error;
@ -1084,7 +1085,7 @@ sub fs_cgi {
"DEF:fs5=$rrd:fs" . $e . "_use5:AVERAGE", "DEF:fs5=$rrd:fs" . $e . "_use5:AVERAGE",
"DEF:fs6=$rrd:fs" . $e . "_use6:AVERAGE", "DEF:fs6=$rrd:fs" . $e . "_use6:AVERAGE",
"DEF:fs7=$rrd:fs" . $e . "_use7:AVERAGE", "DEF:fs7=$rrd:fs" . $e . "_use7:AVERAGE",
"CDEF:allvalues=fs0,fs1,fs2,fs3,fs4,fs5,fs6,fs7,+,+,+,+,+,+,+", $cdef_allvalues_fs,
@CDEF, @CDEF,
@tmpz); @tmpz);
$err = RRDs::error; $err = RRDs::error;
@ -1155,6 +1156,7 @@ sub fs_cgi {
push(@tmp, "COMMENT: \\n"); push(@tmp, "COMMENT: \\n");
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]", $pic = $rrd{$version}->("$IMG_DIR" . "$IMG[$e * 4 + 1]",
"--title=$config->{graphs}->{_fs2} ($tf->{nwhen}$tf->{twhen})", "--title=$config->{graphs}->{_fs2} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}", "--start=-$tf->{nwhen}$tf->{twhen}",
@ -1175,7 +1177,7 @@ sub fs_cgi {
"DEF:ioa5=$rrd:fs" . $e . "_ioa5:AVERAGE", "DEF:ioa5=$rrd:fs" . $e . "_ioa5:AVERAGE",
"DEF:ioa6=$rrd:fs" . $e . "_ioa6:AVERAGE", "DEF:ioa6=$rrd:fs" . $e . "_ioa6:AVERAGE",
"DEF:ioa7=$rrd:fs" . $e . "_ioa7:AVERAGE", "DEF:ioa7=$rrd:fs" . $e . "_ioa7:AVERAGE",
"CDEF:allvalues=ioa0,ioa1,ioa2,ioa3,ioa4,ioa5,ioa6,ioa7,+,+,+,+,+,+,+", $cdef_allvalues_ioa,
@CDEF, @CDEF,
@tmp); @tmp);
$err = RRDs::error; $err = RRDs::error;
@ -1203,7 +1205,7 @@ sub fs_cgi {
"DEF:ioa5=$rrd:fs" . $e . "_ioa5:AVERAGE", "DEF:ioa5=$rrd:fs" . $e . "_ioa5:AVERAGE",
"DEF:ioa6=$rrd:fs" . $e . "_ioa6:AVERAGE", "DEF:ioa6=$rrd:fs" . $e . "_ioa6:AVERAGE",
"DEF:ioa7=$rrd:fs" . $e . "_ioa7:AVERAGE", "DEF:ioa7=$rrd:fs" . $e . "_ioa7:AVERAGE",
"CDEF:allvalues=ioa0,ioa1,ioa2,ioa3,ioa4,ioa5,ioa6,ioa7,+,+,+,+,+,+,+", $cdef_allvalues_ioa,
@CDEF, @CDEF,
@tmpz); @tmpz);
$err = RRDs::error; $err = RRDs::error;
@ -1271,6 +1273,7 @@ sub fs_cgi {
($width, $height) = split('x', $config->{graph_size}->{main}) if $silent eq "imagetagbig"; ($width, $height) = split('x', $config->{graph_size}->{main}) if $silent eq "imagetagbig";
@tmp = @tmpz; @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]", $pic = $rrd{$version}->("$IMG_DIR" . "$IMG[$e * 4 + 2]",
"--title=$config->{graphs}->{_fs3} ($tf->{nwhen}$tf->{twhen})", "--title=$config->{graphs}->{_fs3} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}", "--start=-$tf->{nwhen}$tf->{twhen}",
@ -1291,7 +1294,7 @@ sub fs_cgi {
"DEF:fs5=$rrd:fs" . $e . "_ino5:AVERAGE", "DEF:fs5=$rrd:fs" . $e . "_ino5:AVERAGE",
"DEF:fs6=$rrd:fs" . $e . "_ino6:AVERAGE", "DEF:fs6=$rrd:fs" . $e . "_ino6:AVERAGE",
"DEF:fs7=$rrd:fs" . $e . "_ino7:AVERAGE", "DEF:fs7=$rrd:fs" . $e . "_ino7:AVERAGE",
"CDEF:allvalues=fs0,fs1,fs2,fs3,fs4,fs5,fs6,fs7,+,+,+,+,+,+,+", $cdef_allvalues_ino,
@CDEF, @CDEF,
@tmp); @tmp);
$err = RRDs::error; $err = RRDs::error;
@ -1319,7 +1322,7 @@ sub fs_cgi {
"DEF:fs5=$rrd:fs" . $e . "_ino5:AVERAGE", "DEF:fs5=$rrd:fs" . $e . "_ino5:AVERAGE",
"DEF:fs6=$rrd:fs" . $e . "_ino6:AVERAGE", "DEF:fs6=$rrd:fs" . $e . "_ino6:AVERAGE",
"DEF:fs7=$rrd:fs" . $e . "_ino7:AVERAGE", "DEF:fs7=$rrd:fs" . $e . "_ino7:AVERAGE",
"CDEF:allvalues=fs0,fs1,fs2,fs3,fs4,fs5,fs6,fs7,+,+,+,+,+,+,+", $cdef_allvalues_ino,
@CDEF, @CDEF,
@tmpz); @tmpz);
$err = RRDs::error; $err = RRDs::error;
@ -1425,6 +1428,7 @@ sub fs_cgi {
push(@tmp, "COMMENT: \\n"); push(@tmp, "COMMENT: \\n");
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]", $pic = $rrd{$version}->("$IMG_DIR" . "$IMG[$e * 4 + 3]",
"--title=$graph_title", "--title=$graph_title",
"--start=-$tf->{nwhen}$tf->{twhen}", "--start=-$tf->{nwhen}$tf->{twhen}",
@ -1445,7 +1449,7 @@ sub fs_cgi {
"DEF:tim5=$rrd:fs" . $e . "_tim5:AVERAGE", "DEF:tim5=$rrd:fs" . $e . "_tim5:AVERAGE",
"DEF:tim6=$rrd:fs" . $e . "_tim6:AVERAGE", "DEF:tim6=$rrd:fs" . $e . "_tim6:AVERAGE",
"DEF:tim7=$rrd:fs" . $e . "_tim7: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:stim0=tim0,1000,/",
"CDEF:stim1=tim1,1000,/", "CDEF:stim1=tim1,1000,/",
"CDEF:stim2=tim2,1000,/", "CDEF:stim2=tim2,1000,/",
@ -1481,7 +1485,7 @@ sub fs_cgi {
"DEF:tim5=$rrd:fs" . $e . "_tim5:AVERAGE", "DEF:tim5=$rrd:fs" . $e . "_tim5:AVERAGE",
"DEF:tim6=$rrd:fs" . $e . "_tim6:AVERAGE", "DEF:tim6=$rrd:fs" . $e . "_tim6:AVERAGE",
"DEF:tim7=$rrd:fs" . $e . "_tim7: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:stim0=tim0,1000,/",
"CDEF:stim1=tim1,1000,/", "CDEF:stim1=tim1,1000,/",
"CDEF:stim2=tim2,1000,/", "CDEF:stim2=tim2,1000,/",

View File

@ -2706,6 +2706,13 @@ This option, when enabled via \fIy\fP, shows \fInan\fP values for missing data i
.P .P
Default value: \fIn\fP Default value: \fIn\fP
.RE .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) .SS ZFS statistics (zfs.pm)
This graph is able to monitor an unlimited number of pools. This graph is able to monitor an unlimited number of pools.
.P .P