You are here

How do I set the same service check on the same host with multiple different attributes

3 posts / 0 new
Last post
ejortegau
ejortegau's picture
How do I set the same service check on the same host with multiple different attributes

Hi:

I have created a service check based on check_http with the following arguments:

-H $HOSTADDRESS$ -w 10 -c 10 -p %HTTP_CUSTOM_PORT% -s %HTTP_CUSTOM_RESPONSE_TEXT% -u "%HTTP_CUSTOM_REQUEST_URL:1%"

So that I can define attributes for port, URL and response to see if a given site on the host is up or not. THe thing is, I have a single server with two HTTP ports on it, two URLs to be checked (one on each port) and two different reponses. So it goes something like:

http://myhostname:8080/MyApp/default/login.jsf

and

http://myhostname:8280/OtherApp/some/path.php

I need to check that both services are up. I have tried playing around with multiple services for single host as here described http://www.opsview.com/whats-new/blog/monitor-multiple-different-service... but it only works with one attribute defined two times (DISK). In my case, I need sets of attributes (URL, PORT, RESPONSE). Any hints on how to achieve this? Thanks,

 

 

E.

 

smarsh
smarsh's picture
Re: How do I set the same service check on the same host ...

Hi,

Why not create just the one attribute - %HTTP_CHECK_ARGS%, that has the following:

%HTTP_CHECK_ARGS:1% = the custom port

%HTTP_CHECK_ARGS:2% = the customer response text 

%HTTP_CHECK_ARGS:3% = the custom request URL

Then create a new service check called 'Check HTTP Custom' with the following arguments:

-H $HOSTADDRESS$ -w 10 -c 10 -p %HTTP_CHECK_ARGS:1% -s %HTTP_CHECK_ARGS:2% -u "%HTTP_CHECK_ARGS:3"

Then on the 'advanced tab' set the 'Create multiple..' to the new attribute you created: http://i.imgur.com/21IiLB9.png

Then, simply apply this new check to your host - and add 2 attributes - one per site, and populate the arguments accordingly.

That way you monitor both sites, by just defining arguments - and you can add another site just by adding another attribute.

Hope this helps,

Sam

 

ejortegau
ejortegau's picture
Re: How do I set the same service check on the same host ...

You are asbsolutely right... that works and is far simpler than what I am trying to accomplish.

 

Thanks!