problem check_http_content

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
midou
Posts: 11
Joined: Thu Nov 28, 2013 9:45 am

problem check_http_content

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: problem check_http_content

Post 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?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
midou
Posts: 11
Joined: Thu Nov 28, 2013 9:45 am

Re: problem check_http_content

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: problem check_http_content

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked