diff options
author | Sven Nierlein <sven@nierlein.org> | 2015-12-03 12:37:13 +0100 |
---|---|---|
committer | Sven Nierlein <sven@nierlein.org> | 2015-12-03 12:37:13 +0100 |
commit | 049e72d923cf9b68c1c1adc9db5d7c4d4fc3d49e (patch) | |
tree | e7196a87348cdf0afeb5ab4a481685038c63d216 | |
parent | 865f5e1e8940a9e24feb5c48075c76c6a75e6faf (diff) | |
parent | 4434110d88683681655b4609782d317504a3f662 (diff) | |
download | monitoring-plugin-perl-049e72d.tar.gz |
Merge pull request #5 from daku3649/patch-1
output empty values as "U"
-rw-r--r-- | lib/Monitoring/Plugin/Performance.pm | 9 |
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), |