Skip to main content
Question

how to monitor the presence/accessibility of three different URLs

  • 20 June 2024
  • 2 replies
  • 53 views

Hello,

I am new to CENTREON.

Could someone help me or explain how to monitor the presence/accessibility of three different URLs of our production environments (e.g., akpdev.mydomain.com, akpdev-test.mydomain.com, akpdev-param.mydomain.com) in a single model/service/host, etc.?

I would also like to create the command for this and call it in a model or service in order to easily create alerts for these three environments for each of our clients, of which there are  about 250.

I imagine I will need to create macros, command lines, templates, services, and then hosts. However, I'm not really sure how to create them, where to start, and how to make all of these features work together to achieve the desired results.

 

PS: H’ve already ilstalled the plugin pack  “centreon-plugin-Applications-Protocol-Http”

Thank you in advance for your answer.

Sincerely,

2 replies

Userlevel 5
Badge +14

hello

in a single service it is not possible, each service will monitor an url ‘out of the box’

I personnaly use a dummy host (it’s template without active ping) per website, then add the host template App-Protocol-HTTP-custom

this template with use the “HOSTADDRESS” of the host and return you the default “http response time” and you can tune a few things in the host macro and service macro

(it’s not what you want I guess)

 

if you want a single “check” (=service = command to be executed with a single output)

then you need to code your own script in bash/perl/python, and get for example the return code of a curl command

that is the first step. make a script.

 

as this command will need to take some argument, you next create your own “check command”

if your “check command” is build this way in the check command editor :

/pathtoscript.sh ‘$_SERVICEURLA$’ ‘$_SERVICEURLB$’ ‘$_SERVICEURLC$’ 

then when you create your service template based on the command, you will get 3 macro called URLA, URLB, URLC.

(if you have variable number of url to check, you  could make few more paramaters, they’ll be passed empty to your script, it will be the job of your script to ignore or work with the number of url passed in parameter)

next you create a host template, make a relation with the service  template

 

that’s ready to be used as is, create new host, apply your new template (I highly suggest using the dummy host template then your custom host template in 2nd place)

 

 

Alternatively, if you don’t want to bother to edit the service macro once you have deployed your template

the check command could look like that 

/pathtoscript.sh ‘$_HOSTURLA$’ ‘$_HOSTURLB$’ ‘$_HOSTURLC$’ 

 

this would then make the macro appear on the host instead of th service

if you have a single host per group of URL, it  could be easier to deploy

 

to provision 200 host with multiple  url, I also suggest you look into clapi (centreon command line) where you can use command lines to create host, apply a template, set the macro

or even use the webapi to do that

Badge +1

Hello christophe.niel-ACT,

 

Thank you very much for your response to my question and the detailed explanation.

 

However, I am not comfortable with Perl/Python. I know how to write more or less standard Bash scripts for daily system administration, but not enough to integrate them into Centreon.

 

I was rather thinking of the alternative you suggested for CLAPI (Centreon Command Line), but I don't know if this method can answer my needs and monitor the 3 URLs for each of our clients (each client has 3 URLs to monitor, such as their main domain, subdomain A, subdomain B).

 

The problem is that in the online Centreon documentation, there are no examples on this type of subject, nor anywhere else.

 

Do you have a link to an example configuration that would meet my needs, please?

 

Thank you.

Reply