nagios_parser
nagios_parser copied to clipboard
Values containing \n (two characters: slash and 'n') break the status parser
Nagios status files could contain '\n' in long_plugin_output field. Those values are interpreted as line breaks by the status parser, which leads to plugin output info after '\n' to being processed by the parser as key=value data and all kinds of weird errors being thrown.
Example status:
servicestatus {
long_plugin_output=foo\nbar\n
}
Throws an exception:
/usr/lib64/ruby/1.9.1/racc/parser.rb:351:in `on_error': (Racc::ParseError)
parse error on value "bar" (VALUE)
from (eval):3:in `_racc_do_parse_c'
from (eval):3:in `do_parse'
from parser.y:78:in `parse'
from parser.y:72:in `parse'
from ./nagios-status-failure.rb:13:in `<main>'