Nagios custom check_http plugin

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
tezarin
Posts: 32
Joined: Tue Apr 07, 2015 8:03 am

Nagios custom check_http plugin

Post 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
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Nagios custom check_http plugin

Post 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?
Former Nagios Employee
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Nagios custom check_http plugin

Post 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.
Be sure to check out the Knowledgebase for helpful articles and solutions!
tezarin
Posts: 32
Joined: Tue Apr 07, 2015 8:03 am

Re: Nagios custom check_http plugin

Post 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.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Nagios custom check_http plugin

Post 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.
Former Nagios Employee
Locked