check_http perl script not working with SSL ?
-
reinaldo.gomes
- Posts: 59
- Joined: Wed Apr 02, 2014 9:29 am
check_http perl script not working with SSL ?
I've been using default check_http for a while and it's been working fine:
./check_http -H myserver.com -u /myfolder/mydll.dll -S
Except for the fact that it's returning critical alarm upon socket timeouts, which causes me some trouble. So I tried to switch to an alternative perl script check_http:
./check_http.pl -H myserver.com -u /myfolder/mydll.dll -s
I got 3 distinct situations:
1 - It works fine with the http pages (without the -s option)
2 - It returns "500 read timeout" when I try to check https pages with TLSv1.0
3 - It returns "500 Server closed connection without sending any data back" when I try to check https pages with TLSv1.2
However, the exact same comand lines work with the default check_http, and also I can open such pages on my browser, by typing -H and -u's content. So I think it's not a typo issue.
Anyone out there successfully using check_http perl script with -s option? What is the main difference between these checks regarding the SSL option, that makes them work differently?
./check_http -H myserver.com -u /myfolder/mydll.dll -S
Except for the fact that it's returning critical alarm upon socket timeouts, which causes me some trouble. So I tried to switch to an alternative perl script check_http:
./check_http.pl -H myserver.com -u /myfolder/mydll.dll -s
I got 3 distinct situations:
1 - It works fine with the http pages (without the -s option)
2 - It returns "500 read timeout" when I try to check https pages with TLSv1.0
3 - It returns "500 Server closed connection without sending any data back" when I try to check https pages with TLSv1.2
However, the exact same comand lines work with the default check_http, and also I can open such pages on my browser, by typing -H and -u's content. So I think it's not a typo issue.
Anyone out there successfully using check_http perl script with -s option? What is the main difference between these checks regarding the SSL option, that makes them work differently?
Last edited by reinaldo.gomes on Mon Jul 07, 2014 4:22 pm, edited 1 time in total.
Re: check_http perl script not working with SSL ?
Well, the default check_http plugin with nagios plugins is a c file, not a perl script, so I would presume that your plugin is either very, very old, or in fact not a default nagios_plugins plugin. Could you post a link to this plugin script?
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.
"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.
-
reinaldo.gomes
- Posts: 59
- Joined: Wed Apr 02, 2014 9:29 am
Re: check_http perl script not working with SSL ?
Obviously, I should have posted it before. Sorry about that.
http://exchange.nagios.org/directory/Pl ... pt/details
http://exchange.nagios.org/directory/Pl ... pt/details
Re: check_http perl script not working with SSL ?
I just took a look at the script. It is not very robust. Is there a reason why you are using this over the nagios-plugins check_http plugin?
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.
"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.
-
reinaldo.gomes
- Posts: 59
- Joined: Wed Apr 02, 2014 9:29 am
Re: check_http perl script not working with SSL ?
As I stated before, my only issue with the check_http plugin is that it returns Critical state upon socket timeout error. If there was a way to turn it into Unknown state, such as nrpe's -u option or something, I'd be fine with it.
Re: check_http perl script not working with SSL ?
Two suggestions:
1.) Take a look at this: http://stackoverflow.com/questions/7871 ... 10-seconds
2.) Build a wrapper script that exits UNKNOWN if check_http outputs "Socket timeout"
1.) Take a look at this: http://stackoverflow.com/questions/7871 ... 10-seconds
2.) Build a wrapper script that exits UNKNOWN if check_http outputs "Socket timeout"
Former Nagios employee
-
reinaldo.gomes
- Posts: 59
- Joined: Wed Apr 02, 2014 9:29 am
Re: check_http perl script not working with SSL ?
I found a sample on the forum, but I cant test it until thursday:
I know I have to make changes according to my needs, but does it replace the Critical state with the Unknown one, while retaining the original message (socket timeout) in the output as it is now?
Also, could this wrapper affect check_http negatively in any way?
Code: Select all
#!/bin/bash
HOST=$1
TIMEOUT=$2
COMMAND=$3
OUTPUT=$(/usr/local/nagios/libexec/check_by_ssh -H "$HOST" -t $TIMEOUT -C "$COMMAND")
EXIT=$(echo $?)
if $(echo "$OUTPUT" | grep -q "CRITICAL - Plugin timed out after");then
OUTPUT=$(echo "$OUTPUT" | sed 's/CRITICAL/UNKNOWN/g')
echo "$OUTPUT"
exit 3
else
echo "$OUTPUT"
exit $EXIT
fiAlso, could this wrapper affect check_http negatively in any way?
Re: check_http perl script not working with SSL ?
There in fact is a branch of the nagios-plugins source on github that includes the ability to set the timeout state in the check, by using new timeout switch syntax:reinaldo.gomes wrote:As I stated before, my only issue with the check_http plugin is that it returns Critical state upon socket timeout error. If there was a way to turn it into Unknown state, such as nrpe's -u option or something, I'd be fine with it.
Code: Select all
./check_http <yada yada yada> -t :unknownMore explanation in the commit message at: https://github.com/nagios-plugins/nagio ... 7f1bed42fc
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.
"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.
-
reinaldo.gomes
- Posts: 59
- Joined: Wed Apr 02, 2014 9:29 am
Re: check_http perl script not working with SSL ?
I made some changes to the wrapper and I got it working:
I tried the GitHub's code, but I couldn't compile it. Gcc shows tens of errors when executed.
Code: Select all
#!/bin/bash
HOST=$1
URI=$2
OUTPUT=$(/usr/local/nagios/libexec/check_http -H "$HOST" -u "$URI" -s "__OK__" -S)
EXIT=$(echo $?)
if $(echo "$OUTPUT" | grep -q "CRITICAL - Socket timeout after");then
OUTPUT=$(echo "$OUTPUT" | sed 's/CRITICAL/UNKNOWN/g')
echo "$OUTPUT"
exit 3
else
echo "$OUTPUT"
exit $EXIT
fiRe: check_http perl script not working with SSL ?
Glad to see the wrapper script works. What errors did GCC throw, and what OS and version are you on?
Former Nagios employee