Page 2 of 2
Re: Executing POST statement
Posted: Mon Apr 01, 2013 4:10 pm
by stecino
I ran it, it's asking for a password. Which I don't remember. May I ask what will this give me?
Re: Executing POST statement
Posted: Mon Apr 01, 2013 4:21 pm
by abrist
Did you replace "testdude" and "password" in
abrist wrote:'username=testdude&password=password'
with your username and password (for the post)? If so, then something you trying to do requires root or elevated privileges to run as it worked when you ran it from the cli as the "root" user. Lets check the permissions on "check_http":
Code: Select all
ls -la /path/to/plugins/check_http
Re: Executing POST statement
Posted: Mon Apr 01, 2013 4:35 pm
by stecino
Here is what I have
[nagios@stageutil01 libexec]$ ls -al | grep http
-rwxr-xr-x 1 nagios nagios 321432 May 12 2010 check_http
The username and password is used as part of the POST data that's passed into the applications API
Re: Executing POST statement
Posted: Mon Apr 01, 2013 4:38 pm
by abrist
Alright. So if you run the command as "root" it works, but if you run it as "nagios" is fails waiting for login credentials? I ask because most service check plugins in nagios run as the "nagios" user, not "root".
Re: Executing POST statement
Posted: Mon Apr 01, 2013 4:41 pm
by stecino
I was able to switch to nagios
-bash-3.00$ ./check_http -H stageweb01 -w 2 -c 4 -u /fans/rs/login? -p 8088 -P 'username=testdude&password=password'
HTTP OK: HTTP/1.1 200 OK - 1590 bytes in 0.120 second response time |time=0.120300s;2.000000;4.000000;0.000000 size=1590B;;;0
-bash-3.00$ id
uid=10003(nagios) gid=888(nagios)
It works as well
Re: Executing POST statement
Posted: Mon Apr 01, 2013 4:49 pm
by abrist
Does you check work without the "?" at the end of the uri option? I ask because it was missing earlier in your config post.
Code: Select all
define service{
use generic-service
hostgroup_name stage_webservers
service_description Web_sso2_8088_login
check_command check_http!2!4!/fans/rs/login?!8088!'username=testdude&password=password'
notifications_enabled 1
}
Re: Executing POST statement
Posted: Mon Apr 01, 2013 5:51 pm
by stecino
I updated my command definition, it fails both with ? and without ?
Re: Executing POST statement
Posted: Tue Apr 02, 2013 10:07 am
by abrist
Can you post the command definition for "check_http" from your commands.cfg file?
Re: Executing POST statement
Posted: Wed Apr 10, 2013 1:22 pm
by stecino
I ended up creating a separate command definition called check_http_POST and changed my service definition to reference this command and it worked.