Nagios check_http plugin

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
lord_hypnos
Posts: 13
Joined: Thu Aug 01, 2013 8:52 am

Nagios check_http plugin

Post by lord_hypnos »

Hi,
I have 2 simple(hope:P) questions:
1) How to chceck Content-Type in server response header. Parameter -e check only 1st line of header
2) How to set HTTP Method in request (DELETE, PUT etc. ). Parameter -j is not support now.

Thank you for help!
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: Nagios check_http plugin

Post by yancy »

lord_hypnos,

http://nagiosplugins.org/man/check_http

Code: Select all

 -T, --content-type=STRING
    specify Content-Type header media type when POSTing

 -j, --method=STRING  (for example: HEAD, OPTIONS, TRACE, PUT, DELETE)
    Set HTTP method.
It looks like both options are supported in the documentation....

-Yancy
lord_hypnos
Posts: 13
Joined: Thu Aug 01, 2013 8:52 am

Re: Nagios check_http plugin

Post by lord_hypnos »

yancy wrote:lord_hypnos,

http://nagiosplugins.org/man/check_http

Code: Select all

 -T, --content-type=STRING
    specify Content-Type header media type when POSTing

 -j, --method=STRING  (for example: HEAD, OPTIONS, TRACE, PUT, DELETE)
    Set HTTP method.
It looks like both options are supported in the documentation....

-Yancy
Thank u for answer!
-j is not supported because i have error when i use it on my test Nagios XI version
-T allows You set content-type for sending POST data. When u POSTIing something to server. Or I wrong understood this parameter?
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: Nagios check_http plugin

Post by yancy »

lord_hypnos,
-j is not supported because i have error when i use it on my test Nagios XI version
can you post the error you're getting when running from the command line
-T allows You set content-type for sending POST data. When u POSTIing something to server. Or I wrong understood this parameter?
yes I _think_ this option controls the content type (get or post) controlled by http header. Give it a test and let us know if you run into issues

-Yancy
lord_hypnos
Posts: 13
Joined: Thu Aug 01, 2013 8:52 am

Re: Nagios check_http plugin

Post by lord_hypnos »

I send POST action to WS with one param and using basic authentication

Code: Select all

COMMAND: /usr/local/nagios/libexec/check_http -I xxx.xxx.xx  -f ok -I xxx.xxx.x.xxx  -u "/XXX/Login" -p 443 -j "POST" -s "Login successful"  -P "xxxx=xxx" -S  -a "XYZ:XYZ" -t 60
OUTPUT: Usage: check_http -H  | -I  [-u ] [-p ]
       [-w ] [-c ] [-t ] [-L]
       [-a auth] [-f ] [-e ]
       [-s string] [-l] [-r  | -R ] [-P string]
       [-m :] [-4|-6] [-N] [-M ] [-A string]
       [-k string] [-S] [-C ] [-T ]
-j param is not on list

Ok now check that response is JPEG:

Code: Select all

-f ok -I XXX.XXX.X.XXX -u "/XXX/File?xxx.xxx=XXX&XXXr.XXX=XXX" -S -p 443 -a "XXX:XXX" -T "image/jpeg"-t 60
Nagios check and it's ok, BUT when i change -T to "image/jpeg222" nagios still say: "OK"
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios check_http plugin

Post by abrist »

I did some testing, and it seems the -T switch is not acting as expected. I will do some more testing tomorrow.
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.
lord_hypnos
Posts: 13
Joined: Thu Aug 01, 2013 8:52 am

Re: Nagios check_http plugin

Post by lord_hypnos »

abrist wrote:I did some testing, and it seems the -T switch is not acting as expected. I will do some more testing tomorrow.
Any suggestions?

Can someone ask me for two simple questions:

1) How change HTTP method for HTTP Request?
2) How check Content-Type for HTTP response?

Is possible to do in Nagios or i should write my own plugin???
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios check_http plugin

Post by scottwilkerson »

lord_hypnos wrote: 1) How change HTTP method for HTTP Request?
By adding the -P you will be posting.
lord_hypnos wrote:2) How check Content-Type for HTTP response?
his particular pligin does not test the Content-Type, the -T is for specifying the content type when posting
lord_hypnos wrote:Is possible to do in Nagios or i should write my own plugin???
I am not aware of a plugin that checks the return Content-Type so you will likely have to write your own
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
lord_hypnos
Posts: 13
Joined: Thu Aug 01, 2013 8:52 am

Re: Nagios check_http plugin

Post by lord_hypnos »

Thank You for answer.

Is possible to send DELETE Request? Not only POST? Why -j parameter was delete ?

Send various type of http request(POST,DELETE,PUT) will be very helpful. Also possible to check content-type. Will be add this feature in the future to Nagios XI?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios check_http plugin

Post by abrist »

lord_hypnos wrote:Will be add this feature in the future to Nagios XI?
It really was not on the roadmap, though you are welcome to open up a feature request at the nagios-plugins sourceforge website.
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