Zabbix Documentation 3.4

3.04.04.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


Sidebar

manual:web_monitoring

9. Web monitoring

Overview

With Zabbix you can check several availability aspects of web sites.

To perform web monitoring Zabbix server must be initially configured 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:

  • download speed per second
  • 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 CURLOPT_MAXREDIRS). All cookies are preserved during the execution of a single scenario.

See also known issues for web monitoring using HTTPS protocol.

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
  • Click on Create scenario to the right (or on the scenario name to edit an existing scenario)
  • Enter parameters of the scenario in the form

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

Scenario parameters:

ParameterDescription
Host Name of the host/template that the scenario belongs to.
Name Unique scenario name.
User macros and {HOST.*} macros are supported, since Zabbix 2.2.
Application Select an application the scenario will belong to.
Web scenario items will be grouped under the selected application in Monitoring → Latest data.
New application Enter the name of a new application for the scenario.
Update interval How often the scenario will be executed.
Time suffixes are supported, e.g. 30s, 1m, 2h, 1d, since Zabbix 3.4.0.
User macros are supported, since Zabbix 3.4.0.
Note that if a user macro is used and its value is changed (e.g. 5m → 30s), the next check will be executed according to the previous value (farther in the future with the example values).
Attempts The number of attempts for executing web scenario steps. In case of network problems (timeout, no connectivity, etc) Zabbix can repeat executing a step several times. The figure set will equally affect each step of the scenario. Up to 10 attempts can be specified, default value is 1.
Note: Zabbix will not repeat a step because of a wrong response code or the mismatch of a required string.
This parameter is supported starting with Zabbix 2.2.
Agent Select a client agent.
Zabbix will pretend to be the selected browser. This is useful when a website returns different content for different browsers.
User macros can be used in this field, starting with Zabbix 2.2.
HTTP proxy You can specify an HTTP proxy to use, using the format: http://[username[:password]@]proxy.mycompany.com[:port]
By default, 1080 port will be used.
If specified, the proxy will overwrite proxy related environment variables like http_proxy, HTTPS_PROXY. If not specified, the proxy will not overwrite proxy related environment variables.
The entered value is passed on “as is”, no sanity checking takes place. You may also enter a SOCKS proxy address. If you specify the wrong protocol, the connection will fail and the item will become unsupported. With no protocol specified, the proxy will be treated as an HTTP proxy.
Note: Only simple authentication is supported with HTTP proxy.
User macros can be used in this field.
This parameter is supported starting with Zabbix 2.2.
Variables Variables that may be used in scenario steps (URL, post variables).
They have the following format:
{macro1}=value1
{macro2}=value2
{macro3}=regex:<regular expression>
For example:
{username}=Alexei
{password}=kj3h5kJ34bd
{hostid}=regex:hostid is ([0-9]+)
The macros can then be referenced in the steps as {username}, {password} and {hostid}. Zabbix will automatically replace them with actual values. Note that variables with regex: need one step to get the value of the regular expression so the extracted value can only be applied to the step after.
If the value part starts with regex: then the part after it is treated as a regular expression that searches the web page and, if found, stores the match in the variable. At least one subgroup must be present so that the matched value can be extracted.
Regular expression match in variables is supported since Zabbix 2.2.
User macros and {HOST.*} macros are supported, since Zabbix 2.2.
Variables are automatically URL-encoded when used in query fields or form data for post variables, but must be URL-encoded manually when used in raw post or directly in URL.
Headers Custom HTTP headers that will be sent when performing a request.
Headers should be listed using the same syntax as they would appear in the HTTP protocol, optionally using some additional features supported by the CURLOPT_HTTPHEADER cURL option.
For example:
Accept-Charset=utf-8
Accept-Language=en-US
Content-Type=application/xml; charset=utf-8
User macros and {HOST.*} macros are supported.
Specifying custom headers is supported starting with Zabbix 2.4.
Enabled The scenario is active if this box is checked, otherwise - disabled.

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

Create another scenario based on the properties of the existing one.
Delete history and trend data for the scenario. This will make the server perform the scenario immediately after deleting the data.
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=http://proxy_ip:proxy_port. 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:

ParameterDescription
Name Unique step name.
User macros and {HOST.*} macros are supported, since Zabbix 2.2.
URL