chef-monitor icon indicating copy to clipboard operation
chef-monitor copied to clipboard

nagios_perfdata.rb should be robust against checks that are not reporting performance data

Open cruschke opened this issue 10 years ago • 0 comments

A failing check command like check_http (in case of port to be checked is not listening) does not necessarily have performance data appended. This results in sensu-server.log filling up with

... "extension":{"type":"extension","name":"nagios_perfdata"},"output":"undefined method `strip' for nil:NilClass","status":2}

Checking for a | in check[:output] before trying to split solves the problem

check  = event[:check]
output = check[:output]

        # https://www.nagios-plugins.org/doc/guidelines.html#AEN200
        if output.include? '|'
          perfdata = output.split('|').last.strip

...
       end

cruschke avatar May 30 '14 11:05 cruschke