Skip to main content

Hello

Need a Help 
How to interprate this comman

 /usr/lib/centreon/plugins//centreon_protocol_http.pl     --plugin=apps::protocols::http::plugin     --mode=expected-content     --hostname='******************l'     --proto='http'     --port='80'     --urlpath='/app/*****************/'     --critical-content='%{content} !~ /<title>**********<\/title>/mi'     --http-backend='curl'     --curl-opt='CURLOPT_ACCEPT_ENCODING => gzip'

OK: HTTP test(s) | 'size'=1183B;;;0; 'time'=0.042s;;;0;

 

Hello,

If i understood correctly, this command will get the content of your web page

If the content of your web page doesn't contain '/<title>**********<\/title>/mi', the service will turn into CRITICAL state

  --critical-content='%{content} !~ /<title>**********<\/title>/mi' 

In your output it seems your page contain <title>**********<\/title> so it turn into OK state

You can have more detail by adding '--verbose --debug ' in the EXTRAOPTIONS


Is that what you wanted to know?


Thank you for your response, but I need to clarify my question.

My CLI command is working perfectly. What I need help with is how to properly configure these same parameters in Centreon's web interface.

Specifically, I need to know how to translate these CLI parameters:

CLI Command:


/usr/lib/centreon/plugins//centreon_protocol_http.pl
--plugin=apps::protocols::http::plugin
--mode=expected-content
--hostname='[hostname]'
--proto='http'
--port='80'
--urlpath='/app/[path]/'
--critical-content='%{content} !~ /<title>[title]</title>/mi'
--http-backend='curl'
--curl-opt='CURLOPT_ACCEPT_ENCODING => gzip'

 

Into the web interface fields:
- Template: generic-active-service-custom
- Check Command: -CE-Check_HTTP_expected-content_insecure

My main questions are:
1. How do I correctly format the EXPECTEDSTRING parameter in the web interface to match my CLI --critical-content parameter?
2. What's the correct syntax for curl-opt in the web interface?
3. Are there any special considerations for the other parameters when configuring via web interface?

Again, the CLI command works perfectly - I just need help with the web interface configuration to match this working CLI command.

Thank you for your help.


Can you show the command you created in the Centreon UI? 

-CE-Check_HTTP_expected-content_insecure

 

 


The fields you add in the WEBUI are not the same you use in a cli command

Those fields are MACRO, its variables for Centreon

There are generated from the command

You can recognize the macro in the command with the syntaxe $_SERVICE + Name of the macro + $

Like the first two macro in your command ‘$_SERVICEURLPATH$ and $_SERVICEEXPECTEDSTRING$ which create two fields on the service creation

The value you put will replace Macros in the command

 

If you read the command, the macro are put as value in the plugin’s parameters (--expected-string=’$_SERVICEEXPECTEDSTRING$’

 

What you did is create a macro with the name of the parameters of your cli command, and this will not works

Most of the services commands have a macro named EXTRAOPTIONS where you can put all your fields as value

You can do it like this or create a macro for each of your parameters

Hope it helps


Reply