Executing POST statement
Executing POST statement
Hi everyone,
Is there a way for me to run POST with nagios, other than a curl command embedded in bash script?
Is there a way for me to run POST with nagios, other than a curl command embedded in bash script?
Re: Executing POST statement
I have the following setup
in nrpe.cfg
command[check_http]=/usr/local/nagios/libexec/check_http -w $ARG1$ -c $ARG2$ -u $ARG3$ -p $ARG4$ -P $ARGS5$
Nagios service definition
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
}
Running on my nagios server from command line:
root@stageutil01 libexec]# ./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.197 second response time |time=0.197171s;2.000000;4.000000;0.000000 size=1590B;;;0
On nagios GUI:
Current Status:
WARNING
(for 0d 0h 8m 36s)
Status Information: HTTP WARNING: HTTP/1.1 405 Method Not Allowed - 1328 bytes in 0.020 second response time
Performance Data: time=0.020231s;2.000000;4.000000;0.000000 size=1328B;;;0
in nrpe.cfg
command[check_http]=/usr/local/nagios/libexec/check_http -w $ARG1$ -c $ARG2$ -u $ARG3$ -p $ARG4$ -P $ARGS5$
Nagios service definition
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
}
Running on my nagios server from command line:
root@stageutil01 libexec]# ./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.197 second response time |time=0.197171s;2.000000;4.000000;0.000000 size=1590B;;;0
On nagios GUI:
Current Status:
WARNING
(for 0d 0h 8m 36s)
Status Information: HTTP WARNING: HTTP/1.1 405 Method Not Allowed - 1328 bytes in 0.020 second response time
Performance Data: time=0.020231s;2.000000;4.000000;0.000000 size=1328B;;;0
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Executing POST statement
missing quotes
change this
to this
change this
change this
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
}
change this
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
I added the single quotes, but it didn't change
Re: Executing POST statement
Try url-encoding the ampersand:
Code: Select all
check_command check_http!2!4!/fans/rs/login!8088!username=testdude%26password=password
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.
Re: Executing POST statement
Tried that, "No Bueno"
Re: Executing POST statement
Is there any reason why you are running this check through nrpe?
Have you tried running the command from the cli as user nagios?
Have you tried running the command from the cli as user nagios?
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.
Re: Executing POST statement
What command are you referring to?
I'm running this from command line interface to verify
[root@stageutil01 libexec]# ./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.118 second response time |time=0.117990s;2.000000;4.000000;0.000000 size=1590B;;;0
I'm running this from command line interface to verify
[root@stageutil01 libexec]# ./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.118 second response time |time=0.117990s;2.000000;4.000000;0.000000 size=1590B;;;0
Re: Executing POST statement
I have bash script that uses curl to execute, but I don't know how to configure it within Nagios
Re: Executing POST statement
I was confused by the following:
Could you do me a favor and try running the check from the cli as the nagios user?
But it looks like you have the check setup in core without "check_nrpe" (so ignore).stecino wrote:I have the following setup
in nrpe.cfg
command[check_http]=/usr/local/nagios/libexec/check_http -w $ARG1$ -c $ARG2$ -u $ARG3$ -p $ARG4$ -P $ARGS5$
Could you do me a favor and try running the check from the cli as the nagios user?
Code: Select all
su nagios
./check_http -H stageweb01 -w 2 -c 4 -u /fans/rs/login -p 8088 -P 'username=testdude&password=password'
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.