Configure as passive Check

If you have already implemented active checks and you are happy with them you can ignore the rest of this page. But if you are getting problems with long timeouts due to crawling a big site with many pages and links, you should return here to learn how to implement check_site_simple as passive checks.

To implement check_site_simple as passive check follow these steps:

1. Configuration File (cfg)

Create a configuration file on the monitoring server. E.g.:

###############################################################################
#
# WEBHOSTS.CFG - for checking webservers with check_site_simple
#
###############################################################################


# HINT: Sections which will require editing are marked with TODO:


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

define command {
    command_name    report_outdated
    command_line    $USER1$/noresults.sh $ARG1$ $ARG2$
}

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

define host {

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




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

define host {
    host_name               my-site     ; TODO: change at least the address here
    use                     webhosts
    alias                   my-site.com
    address                 my-site.com
}

# add other hosts here ...


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

define contact {
    contact_name            webmaster            ; Short name of user
    use                     generic-contact
    alias                   Webmaster            ; Full name of user
    email                   webmaster@my-site.com ; TODO: change
}

define contactgroup {
    contactgroup_name       webmasters
    alias                   Webmasters
    members                 webmaster
}


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

# Define the content checks (using the check_site_simple plugin)

define service {
    use                     generic-service
    register                0
    service_description     generic-check_site_simple
    name                    generic-check_site_simple
    passive_checks_enabled  1
    active_checks_enabled   0
    is_volatile             0
    check_freshness         1
    contact_groups          webmasters
    notification_interval   60   ; re-notify every hour

    # 1 day = 86400 seconds, 1 hour = 3600 seconds
    # checking every 2 hours is ok if you submit results with cron.hourly
    freshness_threshold     7200

    check_command           report_outdated!3!"Warning: outdated results"
}

define service {
    use                     generic-check_site_simple
    host_name               my-site ; TODO: change and/or add other web-server
    service_description     Online with Content
}

2. cron

Configure the Check as a cron script.

A small shell-script will run the checks against your website. We have prepared an example:

#!/bin/sh
/usr/local/monitoring-plugins.pro/check-site/bin/check_site_simple -H example.com \
  --url https://example.com \
  -S "Online with Content" \
  --contains="My Company Name Inc." \
  --contains="MyCity" \
  --contains="+43-1-234 567 89" \
  --contains="office@example.com" \
  --crawl

The above example has the --crawl switch set. Therefore it will expect the strings after --contain on every page below what you have set with the --url parameter. Be sure to use generic information strings.

Edit and copy this shell-script into the monitoring servers folder /etc/cron.hourly/.

Instead of copying you can also create the file somewhere else and then link it into the cron.hourly/ folder. The latter gives you a bit more flexibility when it comes to temporarily disabling the check.

Alternative to cron.hourly

Instead of using cron.hourly you can create cron entries e.g.:

0  *  * * * /usr/local/monitoring-plugins.pro/check-site/bin/check_site_simple --url https://example.com -S "Online with Content" --contains="My Company Inc."
15  7  * * * /usr/local/monitoring-plugins.pro/check-site/bin/check_site_simple -U https://exampple.com -S "Broken Links" --crawl

The above example crontab would check the sites homepage and content every hour and crawl the whole site once a day (at 7:15 am).

3. Tuning

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

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