Hi Tomasz,

On Sa, 2014-09-27 at 21:56 +0200, Tomasz Chmielewski wrote:
> I'm trying to use Icinga 2.1.1, but I'm not sure how I can set custom 
> command parameters.
> 
> By default, /etc/icinga2/conf.d/hosts/localhost/http.conf was defined 
> as:
> 
> /*
>   * The CheckCommand object `http` is provided by
>   * the plugin check command templates.
>   * Check the documentation for details.
>   */
> object Service "http" {
>    import "generic-service"
> 
>    host_name = "localhost"
>    check_command = "http"
>    vars.sla = "24x7"
> }
> 
> 
> I also see "http" command was defined in 
> /usr/share/icinga2/include/command-plugins.conf as:
> 
> object CheckCommand "http" {
>          import "plugin-check-command"
> 
>          command = [ PluginDir + "/check_http" ]
> 
>          arguments = {
>                  "-H" = "$http_vhost$"
>                  "-I" = "$http_address$"
>                  "-u" = "$http_uri$"
>                  "-p" = "$http_port$"
>                  "-S" = {
>                          set_if = "$http_ssl$"
>                  }
>                  "--sni" = {
>                          set_if = "$http_sni$"
>                  }
>                  "-a" = {
>                          value = "$http_auth_pair$"
>                          description = "Username:password on sites with 
> basic authentication"
>                  }
>                  "--no-body" = {
>                          set_if = "$http_ignore_body$"
>                  }
>                  "-r" = "$http_expect_body_regex$"
>                  "-w" = "$http_warn_time$"
>                  "-c" = "$http_critical_time$"
>                  "-e" = "$http_expect$"
>          }
> 
>          vars.http_address = "$address$"
>          vars.http_ssl = false
>          vars.http_sni = false
> }
> 
> 
> Now, how do I modify /etc/icinga2/conf.d/hosts/localhost/http.conf so 
> that it contains several other parameters available from 
> /usr/lib/nagios/plugins/check_http command?
> 
> For example, I would like /etc/icinga2/conf.d/hosts/localhost/http.conf 
> check to contain -H and -s parameters.

Thats simple, just add the appropriate vars to the service definition.

object Service "http" {
    import "generic-service"
 
    host_name = "localhost"
    check_command = "http"
    vars.sla = "24x7"
    vars.http_ssl = 1
    vars.http_vhost = "host.domain.com"
}

http_address (-I) is automatically set to the hosts address.

Cheers
Markus


-- 
Markus Frosch
[email protected]
http://www.lazyfrosch.de

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to