Add use_nan_for_missing_data option to nut.pm

This commit is contained in:
Andreas Bachlechner 2022-02-24 10:04:13 +01:00
parent f4dda71be8
commit c6447adc80
2 changed files with 32 additions and 21 deletions

View File

@ -147,29 +147,33 @@ sub nut_update {
my $n;
my $rrdata = "N";
my $use_nan_for_missing_data = lc($nut->{use_nan_for_missing_data} || "") eq "y" ? 1 : 0;
my $e = 0;
foreach my $ups (my @nl = split(',', $nut->{list})) {
my $ltran = 0;
my $htran = 0;
my $ivolt = 0;
my $ovolt = 0;
my $bchar = 0;
my $loadc = 0;
my $mbatc = 0;
my $nxfer = 0;
my $atemp = 0;
my $itemp = 0;
my $humid = 0;
my $battv = 0;
my $nomba = 0;
my $timel = 0;
my $minti = 0;
my $linef = 0;
my $val01 = 0;
my $val02 = 0;
my $val03 = 0;
my $val04 = 0;
my $val05 = 0;
my $default_value = $use_nan_for_missing_data ? (0+"nan") : 0;
my $ltran = $default_value;
my $htran = $default_value;
my $ivolt = $default_value;
my $ovolt = $default_value;
my $bchar = $default_value;
my $loadc = $default_value;
my $mbatc = $default_value;
my $nxfer = $default_value;
my $atemp = $default_value;
my $itemp = $default_value;
my $humid = $default_value;
my $battv = $default_value;
my $nomba = $default_value;
my $timel = $default_value;
my $minti = $default_value;
my $linef = $default_value;
my $val01 = $default_value;
my $val02 = $default_value;
my $val03 = $default_value;
my $val04 = $default_value;
my $val05 = $default_value;
my $data;
if(open(PIPE, "upsc $ups |")) {

View File

@ -4199,6 +4199,13 @@ WARNING: Every time the number of entries in this option changes, Monitorix will
.P
Default value: \fIups@localhost\fP
.RE
.P
.BI use_nan_for_missing_data
.RS
This option, when enabled via \fIy\fP, shows \fInan\fP values for missing data instead of \fI0\fP. This is useful when \fI0\fP could be mistaken for valid data.
.P
Default value: \fIn\fP
.RE
.SS Wowza Media Server (wowza.pm)
This graph is able to monitor an unlimited number of Wowza servers.
.P