Configure as Active Check

So after looking at the basic examples its time to configure the check.

First a few tips:

  • Consider a long check_interval of several hours especially if you have set the crawl switch. For some specific pages like the start page of a site it may make sense to choose a lower check_interval.

  • Huge sites may need a very long timeout with --crawl. Consider to switch to passive checks it that begins to hurt you.

Example Configuration File

The following example configuration for active-checks contains all directives - command-definitions, templates, host-definitions and service-definitions.

###############################################################################
# 
# WEBHOSTS.CFG - for checking web servers with check_site_simple
#
###############################################################################


# COMMANDS ####################################################################


define command {
    command_name    check_page
    command_line    $USER1$/check_site_simple --host=$HOST$ --url=$ARG1$ $ARG2$ --timeout=30
}

define command {
    command_name    check_site
    command_line    $USER1$/check_site_simple --host=$HOST$ --url=$ARG1$ $ARG2$ --crawl --timeout=60
}

# HOST TEMPLATES ##############################################################

define host {

    name                            webhosts     ; The name of this host template
    use                             linux-server ;
    passive_checks_enabled          0
    active_checks_enabled           1
    contact_groups                  webmasters
    register                        0            ; 0 = template only
}



# HOST DEFINITIONS ###########################################################

define host {
    host_name               www
    use                     webhosts
    alias                   www.example.com
    address                 www.example.com
}

define host {
    host_name               www2
    use                     webhosts
    alias                   www2.example.com
    address                 www2.example.com
}



# CONTACTS ###################################################################

define contact {
    contact_name            webmaster            ; Short name of user
    use                     generic-contact
    alias                   Webmaster            ; Full name of user
    email                   webmaster@example.com
}

define contactgroup {
    contactgroup_name       webmasters
    alias                   Webmasters
    members                 webmaster
}


# SERVICE DEFINITIONS ########################################################

# "ping" the webhosts

define service {
    use                     generic-service
    host_name               *,!localhost
    service_description     PING
    check_command           check_ping!100.0,20%!500.0,60%
}


# Check HTTP on the webhosts.

define service {
    use                     generic-service
    host_name               *,!localhost
    service_description     HTTP
    check_command           check_http
    parents                 PING
}



# Define ACTIVE content checks

define service {
    use                     generic-service
    register                0   
    service_description     generic-check_site_simple-active
    name                    generic-check_site_simple-active
    passive_checks_enabled  0
    active_checks_enabled   1
    is_volatile             0
    contact_groups          webmasters
    notification_interval   240   ; re-notify every 4 hours
    check_interval          120   ; check every 2 hours
    parents                 HTTP
}

define service {
    use                     generic-check_site_simple-active
    host_name               www
    service_description     Startpage
    check_command           check_page!https://www.example.com!--contains="My Company Name Inc." --no-contains="hacked" 

}

define service {
    use                     generic-check_site_simple-active
    host_name               www
    service_description     Online with Content Active
    check_command           check_site!https://www.example.com!--contains="My Company Name Inc."

}

define service {
    use                     generic-check_site_simple-active
    host_name               www2
    service_description     Online with Content Active
    check_command           check_site!https://www2.example.com! \       
                            --contains="My Company Name Inc." \
                            --contains="Wien" \
                            --contains="+43-1-123 456" \
                            --contains="welcome@example.com" \
                            --no-contains="Old Company Name" 
}

Tuning

From this point on you probably have to tune the configuration a bit and tell it, what exactly you want it to check and which false-positives it should ignore.

The chapter Advanced Examples will show you some possibilities. Please also consider reading the the programs --help.