summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordaku3649 <daku8938@gmx.de>2015-12-03 12:35:19 +0100
committerdaku3649 <daku8938@gmx.de>2015-12-03 12:35:19 +0100
commit4434110d88683681655b4609782d317504a3f662 (patch)
treee7196a87348cdf0afeb5ab4a481685038c63d216 /lib
parent865f5e1e8940a9e24feb5c48075c76c6a75e6faf (diff)
downloadmonitoring-plugin-perl-4434110d88683681655b4609782d317504a3f662.tar.gz
output empty values as "U"
output empty performance data value as value "U" to "indicate that the actual value couldn't be determined" (defined in https://nagios-plugins.org/doc/guidelines.html#AEN200) and do valid output
Diffstat (limited to 'lib')
-rw-r--r--lib/Monitoring/Plugin/Performance.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Monitoring/Plugin/Performance.pm b/lib/Monitoring/Plugin/Performance.pm
index f1e7a16..0871042 100644
--- a/lib/Monitoring/Plugin/Performance.pm
+++ b/lib/Monitoring/Plugin/Performance.pm
@@ -64,9 +64,16 @@ sub perfoutput {
64 if ($label =~ / /) { 64 if ($label =~ / /) {
65 $label = "'$label'"; 65 $label = "'$label'";
66 } 66 }
67
68 my $value = $self->value;
69 # To prevent invalid output, we change empty value to value "U"
70 if ($value eq '') {
71 $value = 'U';
72 }
73
67 my $out = sprintf "%s=%s%s;%s;%s;%s;%s", 74 my $out = sprintf "%s=%s%s;%s;%s;%s;%s",
68 $label, 75 $label,
69 $self->value, 76 $value,
70 $self->_nvl($self->uom), 77 $self->_nvl($self->uom),
71 $self->_nvl($self->warning), 78 $self->_nvl($self->warning),
72 $self->_nvl($self->critical), 79 $self->_nvl($self->critical),