naglio-plugins icon indicating copy to clipboard operation
naglio-plugins copied to clipboard

Checking if nagios strips single quote in perfdata doesn't work in check_netint.pl

Open ntokos opened this issue 6 years ago • 0 comments

Per the plugin use notes:

If you're using -P option to pass performance data back to plugin then # you may (depending on version of nagios) also need to modify nagios.cfg # and remove ' from illegal_macro_output_chars=`~$&|'"<> line, i.e. change to # illegal_macro_output_chars=`~$&|"<>

Despite that, there is provision in the code (in sub prev_perf) to handle the case that nagios did strip the single quote char. Since I'm using this plugin with Icinga2 (where there's no illegal_macro_output_chars or similar variable/constant), the above provision in the plugin code would help deal with the single quote char problem. But it doesn't work. The reason is an error in the pattern match inside the sub prev_perf (line 1081 in check_netint.pl):

if ($name =~ /^'(.*)`$/) {

It should be replaced with:

if ($name =~ /^'(.*)'$/) {

that is, replace the back-quote char with the single quote char

ntokos avatar Oct 17 '18 08:10 ntokos