Page 1 of 1

problem check_http_content

Posted: Thu Nov 28, 2013 9:54 am
by midou
Hi all,

I need help please
When i launch command from putty on nagios : ./check_http_content -U http://my-url -m my-search-string i have this rsult : CONTENT OK

but on the monitoring page I have an UNKNOWN status : Status Information: ERROR: CANNOT RETRIEVE URL: Creative 500 Parsing of undecoded UTF-8 will give garbage when decoding entities

Could someone help me to resolve this issue please.

Thank you

Re: problem check_http_content

Posted: Sat Nov 30, 2013 11:54 am
by sreinhardt
Could you post a link to the check_http_content plugin you are using please? Also just to be sure could you post the service and command definitions related to this?

Re: problem check_http_content

Posted: Mon Dec 09, 2013 8:27 am
by midou
hi
Sorry for my late response:
I recently upadted the plugin and now I have this version : https://github.com/vahidhedayati/check_ ... tp_content

When I launch this cammand :
./check_http_content -U http://my-url -m my-search-string
I get this result:

CONTENT OK: EXPR my-search-string FOUND onhttp://my-url |time=0.189565896987915s;;;0.000000 size=78077B;;;0

but I get " ERROR: CANNOT RETRIEVE URL: my-search-string 500 Parsing of undecoded UTF-8 will give garbage when decoding entities " from Nagios alert system

Thanks

Re: problem check_http_content

Posted: Mon Dec 09, 2013 12:24 pm
by abrist
There is a good chance that the script does not support utf-8 correctly. See: http://search.cpan.org/dist/HTML-Parser/Parser.pm
Parsing of undecoded UTF-8 will give garbage when decoding entities

(W) The first chunk parsed appears to contain undecoded UTF-8 and one or more argspecs that decode entities are used for the callback handlers.

The result of decoding will be a mix of encoded and decoded characters for any entities that expand to characters with code above 127. This is not a good thing.

The recommened solution is to apply Encode::decode_utf8() on the data before feeding it to the $p->parse(). For $p->parse_file() pass a file that has been opened in ":utf8" mode.

The alternative solution is to enable the utf8_mode and not decode before passing strings to $p->parse(). The parser can process raw undecoded UTF-8 sanely if the utf8_mode is enabled, or if the "attr", "@attr" or "dtext" argspecs are avoided.