TECHZEN Zenoss User Community ARCHIVE  

[RESOLVED] How to create a simple HTTP (GET 200) check in Zenoss

Subject: [RESOLVED] How to create a simple HTTP (GET 200) check in Zenoss
Author: [Not Specified]
Posted: 2014-03-31 05:11

Hi!

I would like to create a check and an alarm for a simple http GET on an url, and an alarm if I don't get a HTTP 200 response.
How would I go about this

It is quite urgent, so any help is appreciated!!

Edit: perhaps I should be clear as well, the built in HTTP Monitor that gives the Get Time and Page Size is not good enough since we want to monitor two services behind a proxy and the proxy will still respond with a time and a size even if both backend nodes are down.

Hence I want to explicitly watch for the 200 return code. I am working on a command monitor with wget, but there has to be an easier way to do this in Zenoss(!)

Cheers,
/Stefan



Subject: I suspect that the quickest
Author: [Not Specified]
Posted: 2014-03-31 09:42

I suspect that the quickest way to monitor this with Zenoss, for that configuration, would be a custom script or a "command" data source.

I would start with an external script, since it's urgent, and create a info event based on it being up or a critical event if it's down.

Hydruid



Subject: Thanks Hydruid for your reply
Author: [Not Specified]
Posted: 2014-04-01 01:43

Thanks Hydruid for your reply. I was hoping for a built in way to do this since it must be a very common test. But I was at the same time prepared for the worst. So I prepared a small script based on wget to return the HTTP return code.

But I am uncertain on how the complete reply of such a script should lool and how to create a COMMAND data source. Could anyone please point me to the correct updated documentation

Thanks!



Subject: Got a great reply on IRC as
Author: [Not Specified]
Posted: 2014-04-01 02:26

Got a great reply on IRC as well, to use a Nagios check_http script.

< boman> shoepower: Create a command datasource with /usr/lib64/nagios/plugins/check_http ${dev/manageIp} -u /path/to/page -e 200
< boman> Where /usr/lib64/... is the path to check_http, ${dev/manageIp} is the IP address that Zenoss got (you could change this to a hostname if needed) and -u /path/to/page is the path to your specific page that you want to
check. Set the severity to whatever you like, the cycle time to whatever you like and you should be done.

Will try this first.



Subject: Howto
Author: [Not Specified]
Posted: 2014-04-07 05:35

OK, so the thing here is to create a Datasource as boman suggests. And set it as CMD/Ok (Fail is default). Also add -S for SSL and -p for the port to be monitored.

My solution that's been running for a few days now looks like this:

/usr/lib64/nagios/plugins/check_http hostname.com -p 4444 -S -u /path/ -e 200



Subject: Hi,
Author: [Not Specified]
Posted: 2014-12-05 04:17

Hi,

I'm working on the same issue. I followed your instructions and created a command data source as you recommended.
My concern is, should I execute this command from the localhost, or from the proxy server .
Also I always get this two messages in the CMD/OK class:

- CRITICAL - Socket timeout after 10 seconds
- Datasource command timed out

for the 2 URLs i'm testing.
But, when I test it for some non-existing URL/some IP I can't ping from localhost, I get:

- Name or service not known HTTP CRITICAL - Unable to open TCP socket /
- No route to host HTTP CRITICAL - Unable to open TCP socket

still in CMD/OK class. Wasn't it supposed to come to CMD/Fail class
What alarm, in which class, should be generated if the URL returns other code than 200

Thnx,
Irba



Subject: Hi Irba,
Author: [Not Specified]
Posted: 2014-12-05 05:34

Hi Irba,

Sorry for the super late reply here. I'm not an expert on Zenoss myself, perhaps someone else could shed some light on this.
I can however answer the "Datasource command timed out" part of your problem - I do get this as well every now and then. If I run the command again it works perfectly. So what I did was add a delay to the command with "-t 20" added to the cmdline above. And then it works 100% of the time for me.

Hope it helps. As to the CMD/OK problem I'm sorry but I have no resolution for you. Please let us know if you solved it yourself.



< Previous
Zenoss Email Event Acknowledgement
  Next
After enable watchdog, cannot see "Performing periodic maintenance"
>