Nagios check_http plugin
-
lord_hypnos
- Posts: 13
- Joined: Thu Aug 01, 2013 8:52 am
Nagios check_http plugin
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!
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!
Re: Nagios check_http plugin
lord_hypnos,
http://nagiosplugins.org/man/check_http
It looks like both options are supported in the documentation....
-Yancy
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.
-Yancy
-
lord_hypnos
- Posts: 13
- Joined: Thu Aug 01, 2013 8:52 am
Re: Nagios check_http plugin
Thank u for answer!yancy wrote:lord_hypnos,
http://nagiosplugins.org/man/check_http
It looks like both options are supported in the documentation....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.
-Yancy
-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?
Re: Nagios check_http plugin
lord_hypnos,
-Yancy
can you post the error you're getting when running from the command line-j is not supported because i have error when i use it on my test Nagios XI version
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-T allows You set content-type for sending POST data. When u POSTIing something to server. Or I wrong understood this parameter?
-Yancy
-
lord_hypnos
- Posts: 13
- Joined: Thu Aug 01, 2013 8:52 am
Re: Nagios check_http plugin
I send POST action to WS with one param and using basic authentication
-j param is not on list
Ok now check that response is JPEG:
Nagios check and it's ok, BUT when i change -T to "image/jpeg222" nagios still say: "OK"
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 ]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 60Re: Nagios check_http plugin
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.
"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
Any suggestions?abrist wrote:I did some testing, and it seems the -T switch is not acting as expected. I will do some more testing tomorrow.
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
By adding the -P you will be posting.lord_hypnos wrote: 1) How change HTTP method for HTTP Request?
his particular pligin does not test the Content-Type, the -T is for specifying the content type when postinglord_hypnos wrote:2) How check Content-Type for HTTP response?
I am not aware of a plugin that checks the return Content-Type so you will likely have to write your ownlord_hypnos wrote:Is possible to do in Nagios or i should write my own plugin???
-
lord_hypnos
- Posts: 13
- Joined: Thu Aug 01, 2013 8:52 am
Re: Nagios check_http plugin
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?
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?
Re: Nagios check_http plugin
It really was not on the roadmap, though you are welcome to open up a feature request at the nagios-plugins sourceforge website.lord_hypnos wrote:Will be add this feature in the future to Nagios XI?
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.