9. Web monitoring

    Overview

    To perform web monitoring Zabbix server must be initially with cURL (libcurl) support.

    To activate web monitoring you need to define web scenarios. A web scenario consists of one or several HTTP requests or “steps”. The steps are periodically executed by Zabbix server in a pre-defined order. If a host is monitored by proxy, the steps are executed by the proxy.

    Since Zabbix 2.2 web scenarios are attached to hosts/templates in the same way as items, triggers, etc. That means that web scenarios can also be created on a template level and then applied to multiple hosts in one move.

    The following information is collected in any web scenario:

    • average download speed per second for all steps of whole scenario

    • number of the step that failed

    • last error message

    The following information is collected in any web scenario step:

    • response time

    • response code

    For more details, see web monitoring items.

    Data collected from executing web scenarios is kept in the database. The data is automatically used for graphs, triggers and notifications.

    Zabbix can also check if a retrieved HTML page contains a pre-defined string. It can execute a simulated login and follow a path of simulated mouse clicks on the page.

    Zabbix web monitoring supports both HTTP and HTTPS. When running a web scenario, Zabbix will optionally follow redirects (see option Follow redirects below). Maximum number of redirects is hard-coded to 10 (using cURL option ). All cookies are preserved during the execution of a single scenario.

    Configuring a web scenario

    To configure a web scenario:

    • Go to: Configuration → Hosts (or Templates)

    • Click on Web in the row of the host/template

    • Enter parameters of the scenario in the form

    The Scenario tab allows you to configure the general parameters of a web scenario.

    All mandatory input fields are marked with a red asterisk.

    User macros are supported in many web scenario parameters, but secret macros should not be used in URLs as they will resolve as “******“ .

    Scenario parameters:

    Note that when editing an existing scenario, two extra buttons are available in the form:

    If HTTP proxy field is left empty, another way for using an HTTP proxy is to set proxy related environment variables.

    For HTTP checks - set the http_proxy environment variable for the Zabbix server user. For example, http_proxy=http://proxy\_ip:proxy\_port.

    For HTTPS checks - set the HTTPS_PROXY environment variable. For example, HTTPS_PROXY=. More details are available by running a shell command: # man curl.

    The Steps tab allows you to configure the web scenario steps. To add a web scenario step, click on Add in the Steps block.

    Configuring steps

    Step parameters:

    Any changes in web scenario steps will only be saved when the whole scenario is saved.

    See also a real-life example of how web monitoring steps can be configured.

    Configuring authentication

    The Authentication tab allows you to configure scenario authentication options. A green dot next to the tab name indicates that some type of HTTP authentication is enabled.

    Authentication parameters:

    [1] Zabbix supports certificate and private key files in PEM format only. In case you have your certificate and private key data in PKCS #12 format file (usually with extention *.p12 or *.pfx) you may generate the PEM file from it using the following commands:

    Zabbix server picks up changes in certificates without a restart.

    If you have client certificate and private key in a single file just specify it in a “SSL certificate file” field and leave “SSL key file” field empty. The certificate and key must still be in PEM format. Combining certificate and key is easy:

    Display

    To view web scenarios configured for a host, go to Monitoring → Hosts, locate the host in the list and click on the Web hyperlink in the last column. Click on the scenario name to get detailed information.

    9. Web monitoring - 图7

    An overview of web scenarios can also be displayed in Monitoring → Dashboard by a Web monitoring widget.

    Recent results of the web scenario execution are available in the Monitoring → Latest data section.

    Extended monitoring

    Sometimes it is necessary to log received HTML page content. This is especially useful if some web scenario step fails. Debug level 5 (trace) serves that purpose. This level can be set in server and configuration files or using a runtime control option (, where N is the process number). The following examples demonstrate how extended monitoring can be started provided debug level 4 is already set: