Page 1 of 1

Nagios custom check_http plugin

Posted: Mon Feb 01, 2016 3:13 pm
by tezarin
Hi all,

I would like to use the check_http plugin to check on the status of a website and if the get request returns anything but 415, I get a critical. So 415 is the OK status for that server.

Will that be something that I can use Nagios's default check_http plugin or I should use a custom made perl plugin like this? https://exchange.nagios.org/directory/P ... pt/details

All I would like to do is for Nagios to make a get request to that webservice (-H the host's IP and -p 80) and if it gets a 415 response then that shows my service is up and running. Anything else, would mean that the service has stopped.

Or can I just use check_tcp? If I get a connection refused, will Nagios send a notification?

Thanks in advance

Re: Nagios custom check_http plugin

Posted: Mon Feb 01, 2016 3:21 pm
by rkennedy
Check_http should work fine for this. You'll want to use the -e flag. Here's an example of it -

Code: Select all

[root@suse11 libexec]# ./check_http -H nagios.com -e 301
HTTP OK: Status line output matched "301" - 522 bytes in 0.089 second response time |time=0.089382s;;;0.000000 size=522B;;;0
Does that answer your question?

Re: Nagios custom check_http plugin

Posted: Mon Feb 01, 2016 3:41 pm
by bwallace
Just wanted to add that you can take a look at what flags/options are available for a plugin via cli.

For Nagios Core go to:

Code: Select all

/usr/local/nagios/libexec
From libexec, run:
./plugin-name -h

...to get the help info about the plugin.

Re: Nagios custom check_http plugin

Posted: Mon Feb 01, 2016 5:08 pm
by tezarin
rkennedy wrote:Check_http should work fine for this. You'll want to use the -e flag. Here's an example of it -

Code: Select all

[root@suse11 libexec]# ./check_http -H nagios.com -e 301
HTTP OK: Status line output matched "301" - 522 bytes in 0.089 second response time |time=0.089382s;;;0.000000 size=522B;;;0
Does that answer your question?
PERFECT! thanks much! This was exactly what I was looking for.

bwallace,
Thanks for your reply, let me try that out then.

Re: Nagios custom check_http plugin

Posted: Tue Feb 02, 2016 9:59 am
by rkennedy
Good to hear! I'll close this thread out now, if you need any assistance in the future feel free to open a new one.