[monitoring-plugin-perl] output empty values as "U"
daku3649
git at monitoring-plugins.org
Thu Dec 3 12:40:04 CET 2015
Module: monitoring-plugin-perl
Branch: master
Commit: 4434110d88683681655b4609782d317504a3f662
Author: daku3649 <daku8938 at gmx.de>
Date: Thu Dec 3 12:35:19 2015 +0100
URL: https://www.monitoring-plugins.org/repositories/monitoring-plugin-perl/commit/?id=4434110
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
---
lib/Monitoring/Plugin/Performance.pm | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
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 {
if ($label =~ / /) {
$label = "'$label'";
}
+
+ my $value = $self->value;
+ # To prevent invalid output, we change empty value to value "U"
+ if ($value eq '') {
+ $value = 'U';
+ }
+
my $out = sprintf "%s=%s%s;%s;%s;%s;%s",
$label,
- $self->value,
+ $value,
$self->_nvl($self->uom),
$self->_nvl($self->warning),
$self->_nvl($self->critical),
More information about the Commits
mailing list