Closed jkroepke closed 9 years ago
To remove the first warnings you can assign a critical and warning thresolds with options -w and -c. But the script should manage better this case (no thresolds + debug).
Now the undefined $webcontent
is very strange.
You have $response->is_success
, $response->status_line
and $response->header('Content-Type')
but $response->decoded_content
is null
...
it comes from:
my $webcontent = undef;
if ($response->is_success) {
$webcontent=$response->decoded_content;
if (defined ($o_debug)) {
print "\nDEBUG: HTTP response:";
print $response->status_line;
print "\n".$response->header('Content-Type');
print "\n";
print $webcontent;
}
Looking at the documentation here: http://search.cpan.org/~ether/HTTP-Message-6.10/lib/HTTP/Message.pm#mess for 'decoded_content', it seems that the return may be undef if aContent-Encoding or charset is not supported.
Could you try with :
$webcontent=$response->decoded_content( charset_strict=>1, raise_error => TRUE);
or:
$webcontent=$response->decoded_content( charset_strict=>1, raise_error => TRUE, alt_charset => none);
There's certainly somethig strange in your HTTP response, and we could use it to make the script more robust to strange things.
Hi,
the Problem ist this:
Content-Type: text/plain;charset=-1
I have a installed nginx. nginx overrides now the header with text/plain;charset=utf8 and it works perfertly, but it is just a workaround.
php5-fpm looks like to send this invalid? Content-Type ..
About your changes:
I removed the workaround on my nginx to test the changes, here are the results:
./check_phpfpm_status
Bareword "TRUE" not allowed while "strict subs" in use at ./check_phpfpm_status line 286.
Bareword "none" not allowed while "strict subs" in use at ./check_phpfpm_status line 286.
When I remove the "use strict;" line, got this error(first change):
Unknown encoding '-1' at /usr/share/perl5/HTTP/Message.pm line 377.
...propagated at /usr/share/perl5/HTTP/Message.pm line 392.
at ./check_phpfpm_status line 286.
Second change works great!
Unquoted string "none" may clash with future reserved word at ./check_phpfpm_status line 286.
PHP-FPM OK - php, 0.056 sec. response time, Busy/Idle 1/7, (max: 8, reached: 0), ReqPerSec 0.0, Queue 0 (len: 0, reached: 0)|Idle=7 Busy=1 MaxProcesses=8 MaxProcessesReach=0 Queue=0 MaxQueueReach=0 QueueLen=0 ReqPerSec=0.000000
Ok, it seems we should use the alt_charset keyword, I'm not a PERL expert, seems that my example code was pretty wrong, try with quotes around none
and TRUE
.
So this should be the right code, isn'it ?
$webcontent=$response->decoded_content( charset_strict=>1, raise_error => 1, alt_charset => 'none' );
I have no knowledge about perl. What about the strict subs error?
The warnings are because the quotes are required. I committed a change, can you tests withthis version?
Works perfectly now,
Thank you.
Thanks for testing.
Hi!
I got this error on execute this check:
This php-fpm status side work with curl:
I'm using Ubuntu 14.04 LTS and php5-fpm 5.5.9.