<p>I use check_squid.pl developed by Cyril Feraudet in Version 1.1</p>
<p>That uses package Nagios::Plugin which is version 0.36</p>
<p>The script gives out invalid performance data because value is sometimes empty and that is not handleded correctly and leads to invalid performance data output.</p>
<p>check_squid.pl creates a new Nagios::Plugin object and then adds the performance value with method add_perfdata </p>
<p>pnp4nagios claims invalid performance data, which is true, because after the = sign comes directly the UOM:</p>
<pre><code>`2015-11-27 11:45:06 [2996] [1] Found Performance Data for MYHOST / Squid_Cache ('Requests Hit Ratio 5min'=0.0%;; 'Requests Hit Ratio 60min'=0.2%;; 'Byte Hit Ratio 5min'=%;; 'Byte Hit Ratio 60min'=%;;)
2015-11-27 11:45:06 [2996] [1] Invalid Perfdata detected`
</code></pre>
<p>I did a workaround for this in Performance.pm perfoutput method like so:</p>
<pre><code>sub perfoutput {
my $self = shift;
# Add quotes if label contains a space character
my $label = $self->label;
if ($label =~ / /) {
$label = "'$label'";
}
my $value = $self->value;
if ($value eq '') {
$value = 'U';
}
my $out = sprintf "%s=%s%s;%s;%s;%s;%s",
$label,
$value,
$self->_nvl($self->uom),
$self->_nvl($self->warning),
$self->_nvl($self->critical),
$self->_nvl($self->min),
$self->_nvl($self->max);
# Previous implementation omitted trailing ;; - do we need this?
$out =~ s/;;$//;
return $out;
}
</code></pre>
<p>So if value is empty, it is changed to value "U" which means that the value could not have been determined, according to Nagios Plugin development guidelines, section Performance data.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br><a href="https://github.com/monitoring-plugins/monitoring-plugin-perl/issues/4">Reply to this email on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFQl2U_02W9a_dTRLdjwtc7aH-NBOQdOks5pL-vDgaJpZM4GtyLl.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/monitoring-plugins/monitoring-plugin-perl/issues/4"></link>
<meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>