en	# 9 Web monitoring
zh-cn	# 9. Web 监控

en	#### Overview With Zabbix you can check several availability aspects of web sites.\ ::: noteimportant To perform web monitoring Zabbix server must be initially [configured](/manual/installation/install#from_the_sources) 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. 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](/manual/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](http://curl.haxx.se/libcurl/c/CURLOPT_MAXREDIRS.html)). All cookies are preserved during the execution of a single scenario.
zh-cn	#### Overview 用户通过Zabbix可以检查网站的可用性。\ ::: noteimportant 要执行Web监控，Zabbix server的初始[configured](/manual/installation/install#from_the_sources)（配置）必须支持cURL (libcurl) 。 ::: 若要启用web监控需要用户定义web场景。Web场景由一个或者多个HTTP请求或着"steps"（步骤）组成。这些步骤由Zabbix server以预设的顺序定制执行。如果主机由proxy完成监控，则这些步骤由proxy执行。 Web场景以与监控项、触发器等相同的方式应用到主机/模板上。这意味着WEb场景也可以在模板一级上创建，然后一次性应用于多个主机。 在任何的Web场景中Zabbix都会收集到以下信息： - 整个场景所有步骤的平均每秒下载速度 - 失败的步骤数 - 最后一条错误消息 在任何web场景步骤中都会收集以下信息： - 每秒下载速度 - 响应时间 - 响应代码 更多的信息，用户可以查看 [web monitoring items](/manual/web_monitoring/items)。 从执行web场景中收集的数据保存在数据库中。这个数据自动用于图形、触发器和通知。 Zabbix还可以检查检索到的HTML页面是否包含预定义的字符串。它可以执行模拟登录，并遵循页面上模拟鼠标点击的路径。 Zabbix网络监控同时支持HTTP和HTTPS。当运行网络场景时，Zabbix将选择性地遵循重定向（请参阅下面的选项*Followredirects*）。 重定向的最大数量硬编码为10 （使用cURL选项[CURLOPT\_MAXREDIRS](http://curl.haxx.se/libcurl/c/CURLOPT_MAXREDIRS.html)) 所有cookie都会在单个场景的执行过程中保留。

en	#### Configuring a web scenario To configure a web scenario: - Go to: *Data collection → Hosts* (or *Templates*) - Click on *Web* in the row of the host/template - Click on *Create web 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. ![](../../assets/en/manual/config/scenario.png) All mandatory input fields are marked with a red asterisk. Scenario parameters: |Parameter|Description| |--|--------| |*Name*|Unique scenario name.<br>[User macros](/manual/config/macros/user_macros) are supported. *Note* that if user macros are used, these macros will be left unresolved in [web monitoring item](/manual/web_monitoring/items) names.| |*Update interval*|How often the scenario will be executed.<br>[Time suffixes](/manual/appendix/suffixes) are supported, e.g. 30s, 1m, 2h, 1d.<br>[User macros](/manual/config/macros/user_macros) are supported. *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). <br> New web scenarios will be checked within 60 seconds of their creation.| |*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.<br>*Note*: Zabbix will not repeat a step because of a wrong response code or the mismatch of a required string.| |*Agent*|Select a client agent.<br>Zabbix will pretend to be the selected browser. This is useful when a website returns different content for different browsers.<br>User macros can be used in this field.| |*HTTP proxy*|You can specify an HTTP proxy to use, using the format `[protocol://][username[:password]@]proxy.example.com[:port]`.<br>This sets the [CURLOPT\_PROXY](https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html) cURL option.<br>The optional `protocol://` prefix may be used to specify alternative proxy protocols (the protocol prefix support was added in cURL 7.21.7). With no protocol specified, the proxy will be treated as an HTTP proxy.<br>By default, 1080 port will be used.<br>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.<br>You may also enter a SOCKS proxy address. If you specify the wrong protocol, the connection will fail and the item will become unsupported.<br>*Note* that only simple authentication is supported with HTTP proxy.<br>User macros can be used in this field.| |*Variables*|Variables that may be used in scenario steps (URL, post variables).<br>They have the following format:<br>**{macro1}**=value1<br>**{macro2}**=value2<br>**{macro3}**=regex:<regular expression><br>**{macro4}**=jsonpath:<jsonpath><br>**{macro5}**=xmlxpath:<xmlxpath><br>**{macro6}**={{macro}.function()} (see [macro functions](/manual/config/macros/macro_functions))<br>For example:<br>{username}=Alexei<br>{password}=kj3h5kJ34bd<br>{hostid}=regex:hostid is (\[0-9\]+)<br>{url}=jsonpath:$.host_url<br>{status}=xmlxpath://host/response/status<br>{newvar}={{myvar}.btoa()}<br>The macros can then be referenced in the steps as {username}, {password}, {hostid}, etc. 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.<br>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.<br>User macros and {HOST.\*} [macros](/manual/appendix/macros/supported_by_location) are supported.<br>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*|HTTP Headers are used when performing a request. Default and custom headers can be used.<br>Headers will be assigned using default settings depending on the Agent type selected from a drop-down list on a scenario level, and will be applied to all the steps, unless they are custom defined on a step level.<br>**It should be noted that defining the header on a step level automatically discards all the previously defined headers, except for a default header that is assigned by selecting the 'User-Agent' from a drop-down list on a scenario level.**<br>However, even the 'User-Agent' default header can be overridden by specifying it on a step level.<br>To unset the header on a scenario level, the header should be named and attributed with no value on a step level.<br>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](http://curl.haxx.se/libcurl/c/CURLOPT_HTTPHEADER.html) cURL option.<br>For example:<br>Accept-Charset=utf-8<br>Accept-Language=en-US<br>Content-Type=application/xml; charset=utf-8<br>User macros and {HOST.\*} [macros](/manual/appendix/macros/supported_by_location) are supported.| |*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: | | | |--|--------| |![](../../assets/en/manual/web_monitoring/buttons_clone.png)|Create another scenario based on the properties of the existing one.| |![](../../assets/en/manual/web_monitoring/buttons_clear.png)|Delete history and trend data for the scenario. This will make the server perform the scenario immediately after deleting the data.| ::: notetip 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. ![](../../assets/en/manual/config/scenario_b.png){width="600"} ::: noteclassic Secret [user macros](/manual/config/macros/user_macros#configuration) must not be used in URLs as they will resolve to "\*\*\*\*\*\*". :::
zh-cn	#### 配置一个web场景 配置web场景的流程如下： - 前往： *Data collection → Hosts* (or *Templates*)（数据采集→主机或模板） - 点击位于主机/模板功能项一栏中的*Web* - 点击右侧的*Create web scenario*（创建场景） 或在场景名称上编辑现有场景。 - 在表格中输入有关场景的参数。 在**Scenario**（场景）配置选项中，允许用户配置Web场景的常规参数。 ![](../../assets/en/manual/config/scenario.png) 所有必填输入字段都用红色星号标记。 场景参数： |参数|描述| |--|--------| |*Name*|唯一的场景名称。<br>[User macros](/manual/config/macros/user_macros)（用户宏）支持使用。*Note* 如果使用用户宏，那么这些宏在[web monitoring item](/manual/web_monitoring/items)名称中将处于未解析的状态。| |*Update interval*|场景执行的频率。<br>支持使用[Time suffixes](/manual/appendix/suffixes) （时间后缀），例如，30s，1m，2h，1d。<br>支持使用[User macros](/manual/config/macros/user_macros) （用户宏）。*Note*如果使用用户宏并修改其数值(例如，5m → 30s), 则将根据先前设定的值执行下一次检查 (在下一次执行时使用示例值). <br> 新的网络场景将在创建后60秒内进行检查。| |*Attempts*|系统尝试运行Web场景步骤的次数。如果出现网络问题（超时、无连接等），Zabbix可以多次重复执行同一个步骤。该数字集将同样影响场景的每个步骤。最多可以指定10次尝试，默认值为1。<br>*Note*: Zabbix不会因为错误的响应代码或所需字符串不匹配而进行步骤重复操作。| |*Agent*|选择一个客户端代理。<br>Zabbix将假装是选定的浏览器。当一个网站为不同的浏览器返回不同的内容时，这种方式将会很有用。<br>用户宏可以用于此字段。| |*HTTP proxy*|您可以使用以下格式指定要使用的HTTP代理`[protocol://][username[:password]@]proxy.example.com[:port]`。<br>这设置了[CURLOPT\_PROXY](https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html) cURL配置。<br>可选的`protocol://`前缀可用于指定替代的代理协议（在cURL 7.21.7中添加了对协议前缀的支持）。如果未指定任何协议，则代理将被视为HTTP代理。<br>默认情况下，将使用1080端口。<br>如果指定，代理将覆盖与代理相关的环境变量，如http_proxy、HTTPS_proxy。如果未指定，代理将不会覆盖与代理相关的环境变量。输入的值按原样传递，不会进行健全性检测。<br>用户也可以输入SOCKS代理地址。如果指定了错误的协议，则连接将失败，并且该项目将变得不受支持。<br>*Note* HTTP代理只支持简单的身份验证。<br>用户宏可以用于此字段。| |*Variables*|可以在场景步骤中使用的变量（URL、发布变量）。<br>它们具有以下格式：<br>**{macro1}**=value1<br>**{macro2}**=value2<br>**{macro3}**=regex:<regular expression><br>举例说明：<br>{username}=Alexei<br>{password}=kj3h5kJ34bd<br>{hostid}=regex:hostid is (\[0-9\]+)<br>后续可以在步骤中将宏引用为｛username｝、｛password｝和｛hostid｝。Zabbix会自动将它们替换为实际值。请注意，带有“regex:”的变量需要一个步骤才能获得正则表达式的值，因此提取的值只能应用于下一个步骤。<br>如果值部分以`regex:`开头，则后面的部分将被视为搜索网页的正则表达式，如果找到，则将匹配项存储在变量中。必须至少存在一个子组，以便可以提取匹配的值。<br>支持用户宏和{HOST.\*} [macros](/manual/appendix/macros/supported_by_location)。<br>当在查询变量的字段或表单数据中使用时，变量会自动进行URL编码，但在原始数据或直接在URL中使用时必须手动进行URL编码。| |*Headers*|执行请求时使用HTTP标头。可以使用默认标头和自定义标头。<br>标头将使用默认设置进行分配，具体取决于从方案级别的下拉列表中选择的Agent类型，并且将应用于所有步骤，除非它们是在步骤级别上自定义的。<br>**需要注意的是，在步骤级别上定义标头会自动丢弃之前定义的所有标头，但通过从场景级别的下拉列表中选择“用户代理”分配的默认标头除外。**<br>但是，即使是“用户代理”默认标头也可以通过在步骤级别上指定目标来实行覆盖。<br>要在场景级别上取消设置标头，应在步骤级别上对标头进行命名和属性化，而不配置任何值。<br>标头应使用与HTTP协议中显示的语法相同的语法，也可以选择使用一些由[CURLOPT\_HTTPHEADER](http://curl.haxx.se/libcurl/c/CURLOPT_HTTPHEADER.html)提供的cURL功能。<br>举例说明：<br>Accept-Charset=utf-8<br>Accept-Language=en-US<br>Content-Type=application/xml; charset=utf-8<br>用户宏和{HOST.\*} [macros](/manual/appendix/macros/supported_by_location) 同样支持。| |*Enabled*|如果选中此框，则场景处于活动状态，否则为禁用状态。| 请注意，在编辑现有场景时，有两个额外的按钮可供使用： | | | |--|--------| |![](../../assets/en/manual/web_monitoring/buttons_clone.png)|根据现有场景的属性创建另一个场景。| |![](../../assets/en/manual/web_monitoring/buttons_clear.png)|删除场景的历史和趋势数据。这将使服务器在删除数据后立即执行场景。| ::: notetip 如果*HTTP proxy* 字段空白，使用HTTP代理的另一种方式是设置HTTP代理相关的环境变量。 对 HTTP 检查而言 - 为Zabbix server用户设置 **http\_proxy** 环境变量。例如， `http_proxy=http://proxy_ip:proxy_port`. 对HTTPS检查而言 - 配置 **HTTPS\_PROXY** 环境变量。例如， `HTTPS_PROXY=http://proxy_ip:proxy_port`。用户可以通过运行shell命令来获得更多信息：*\# man curl*。 ::: **Steps**（步骤）配置选项允许用户可以配置web场景步骤。要添加web场景步骤，单击*Steps* （步骤）栏中的 *Add*（添加）按钮进行创建。 ![](../../assets/en/manual/config/scenario_b.png){width="600"} ::: noteclassic 这里不建议用户在URLs中选择加密格式的[user macros](/manual/config/macros/user_macros#configuration) （用户宏），因为这些用户宏会被系统解析为乱码："\*\*\*\*\*\*"。 :::

en	#### Configuring steps ![](../../assets/en/manual/config/scenario_step.png){width="600"} Step parameters: |Parameter|Description| |--|--------| |*Name*|Unique step name.<br>[User macros](/manual/config/macros/user_macros) are supported. *Note* that if user macros are used, these macros will be left unresolved in [web monitoring item](/manual/web_monitoring/items) names.| |*URL*|URL to connect to and retrieve data. For example:<br>https://www.example.com<br>http://www.example.com/download<br>Domain names can be specified in Unicode characters. They are automatically punycode-converted to ASCII when executing the web scenario step.<br>The *Parse* button can be used to separate optional query fields (like ?name=Admin&password=mypassword) from the URL, moving the attributes and values into *Query fields* for automatic URL-encoding.<br>Variables can be used in the URL, using the {macro} syntax. Variables can be URL-encoded manually using a {{macro}.urlencode()} syntax.<br>User macros and {HOST.\*} [macros](/manual/appendix/macros/supported_by_location) are supported.<br>Limited to 2048 characters.| |*Query fields*|HTTP GET variables for the URL.<br>Specified as attribute and value pairs.<br>Values are URL-encoded automatically. Values from scenario variables, user macros or {HOST.\*} macros are resolved and then URL-encoded automatically. Using a {{macro}.urlencode()} syntax will double URL-encode them.<br>User macros and {HOST.\*} [macros](/manual/appendix/macros/supported_by_location) are supported.| |*Post*|HTTP POST variables.<br>In **Form data** mode, specified as attribute and value pairs.<br>Values are URL-encoded automatically. Values from scenario variables, user macros or {HOST.\*} macros are resolved and then URL-encoded automatically.<br>In **Raw data** mode, attributes/values are displayed on a single line and concatenated with a **&** symbol.<br>Raw values can be URL-encoded/decoded manually using a {{macro}.urlencode()} or {{macro}.urldecode()} syntax.<br>For example: id=2345&userid={user}<br>If {user} is defined as a variable of the web scenario, it will be replaced by its value when the step is executed. If you wish to URL-encode the variable, substitute {user} with {{user}.urlencode()}.<br>User macros and {HOST.\*} [macros](/manual/appendix/macros/supported_by_location) are supported.| |*Variables*|Step-level variables that may be used for GET and POST functions.<br>Specified as attribute and value pairs.<br>Step-level variables override scenario-level variables or variables from the previous step. However, the value of a step-level variable only affects the step after (and not the current step).<br>They have the following format:<br>**{macro}**=value<br>**{macro}**=regex:<regular expression><br>For more information see variable description on the [scenario](web_monitoring#configuring_a_web_scenario) level.<br>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.<br>Specified as attribute and value pairs.<br>A header defined on a step level will be used for that particular step.<br>**It should be noted that defining the header on a step level automatically discards all the previously defined headers, except for a default header that is assigned by selecting the 'User-Agent' from a drop-down list on a scenario level.**<br>However, even the 'User-Agent' default header can be overridden by specifying it on a step level.<br>For example, assigning the name to a header, but setting no value will unset the default header on a scenario level.<br>User macros and {HOST.\*} macros are supported.<br>This sets the [CURLOPT\_HTTPHEADER](http://curl.haxx.se/libcurl/c/CURLOPT_HTTPHEADER.html) cURL option.| |*Follow redirects*|Mark the checkbox to follow HTTP redirects.<br>This sets the [CURLOPT\_FOLLOWLOCATION](http://curl.haxx.se/libcurl/c/CURLOPT_FOLLOWLOCATION.html) cURL option.| |*Retrieve mode*|Select the retrieve mode:<br>**Body** - retrieve only body from the HTTP response<br>**Headers** - retrieve only headers from the HTTP response<br>**Body and headers** - retrieve body and headers from the HTTP response| |*Timeout*|Zabbix will not spend more than the set amount of time on processing the URL (from one second to maximum of 1 hour). Actually this parameter defines the maximum time for making connection to the URL and maximum time for performing an HTTP request. Therefore, Zabbix will not spend more than **2 x Timeout** seconds on the step.<br>[Time suffixes](/manual/appendix/suffixes) are supported, e.g. 30s, 1m, 1h. [User macros](/manual/config/macros/user_macros) are supported.| |*Required string*|Required regular expression pattern.<br>Unless retrieved content (HTML) matches the required pattern the step will fail. If empty, no check on required string is performed.<br>For example:<br>Homepage of Zabbix<br>Welcome.\*admin<br>*Note*: Referencing [regular expressions](regular_expressions) created in the Zabbix frontend is not supported in this field.<br>User macros and {HOST.\*} [macros](/manual/appendix/macros/supported_by_location) are supported.| |*Required status codes*|List of expected HTTP status codes. If Zabbix gets a code which is not in the list, the step will fail.<br>If empty, no check on status codes is performed.<br>For example: 200,201,210-299<br>User macros are supported.| ::: noteclassic Any changes in web scenario steps will only be saved when the whole scenario is saved. ::: See also a [real-life example](/manual/web_monitoring/example) of how web monitoring steps can be configured.
zh-cn	#### 配置步骤 ![](../../assets/en/manual/config/scenario_step.png){width="600"} 步骤参数： |参数|描述| |--|--------| |*Name*|唯一的步骤名称。<br>支持使用[User macros](/manual/config/macros/user_macros)（用户宏）*Note* 如果使用用户宏，那么这些宏在[web monitoring item](/manual/web_monitoring/items)名称中将处于未解析的状态。| |*URL*|URL用于连接和检索数据。例如： <br>https://www.example.com<br>http://www.example.com/download<br>域名可以使用Unicode字符指定。在执行web场景步骤时，域名会自动转换为ASCII格式。<br>*Parse*按钮可以用于分离可选查询字段（like ?name=Admin&password=mypassword）与URL，将属性和值移动到*Query fields*（查询字段）中方便进行自动的URL编码。<br>变量可以应用在URL中通过使用{macro}语法。用户可以使用{{macro}.urlencode()}语法直接手动编码URL变量。<br>支持使用用户宏与{HOST.\*} [macros](/manual/appendix/macros/supported_by_location)。<br>字符数量限制在2048个。| |*Query fields*|应用于URL的HTTP GET变量。<br>以配对的方式指定属性与对应的数值。<br>数值会自动进行URL编码。来气场景变量、用户宏或{HOST.\*}宏的值会被解析，然后自动进行URL编码。系统使用{{macro}.urlencode()}语法对数值进行双重URL编码。<br>支持用户宏和{HOST.\*} [macros](/manual/appendix/macros/supported_by_location)（宏）。| |*Post*|HTTP POST 变量。<br>在**Form data**（表单数据）模式下，数据的属性和数值会对应显示。<br>数值会进行自动地URL加密。来自场景变量、用户宏或 {HOST.\*}宏的数据会被自动解析，然后进行URL编码。 <br>在**Raw data**（原始数据）模式下，属性/数值会显示在同一行中，并以**&** 符号相连。<br>{{macro}.urlencode()} 或 {{macro}.urldecode()} 语法手动对原始值进行 URL 编码/解码。<br>例如，id=2345&userid={user}<br>如果 {user} 被定义为web场景的变量，执行步骤时会被替换为它的值。如果您希望对变量进行 URL 编码，请将 {user} 替换为 {{user}.urlencode()}.<br>支持使用用户宏和{HOST.\*} [macros](/manual/appendix/macros/supported_by_location)。| |*Variables*|应用于 GET 和 POST 函数的步骤级变量。<br>数据的属性和数值会对应显示<br>步骤级变量会覆盖场景级变量或上一步中的变量。 但是，步骤级变量的值仅影响之后的步骤（而不影响当前步骤）。<br>它们具有以下格式<br>**{macro}**=value<br>**{macro}**=regex:<regular expression><br>更多的信息请查看[scenario](web_monitoring#configuring_a_web_scenario)（场景）界别的变量描述。<br>变量在用于查询字段或用于发布变量的表单数据时会自动进行 URL 编码，但在原始发布或直接在 URL 中使用时必须手动进行 URL 编码。| |*Headers*|执行请求时将发送的自定义 HTTP 标头。<br>数据的属性和数值会对应显示<br>步骤级别的标头将覆盖为场景指定的标题。<br>**应该注意的是，在步骤级别定义标头会自动丢弃所有先前定义的标头，但通过从场景级别的下拉列表中选择“用户代理”来分配的默认标头除外。**<br>但无论如何，即使'User-Agent' 默认标头也可以通过在步骤级别指定它来覆盖。<br>_例如，设置没有值的 'User-Agent' 属性将删除在场景级别设置的 User-Agent 值。<br>支持用户宏和{HOST.\*} 宏。<br>设定[CURLOPT\_HTTPHEADER](http://curl.haxx.se/libcurl/c/CURLOPT_HTTPHEADER.html) cURL选项。| |*Follow redirects*|标记复选框以遵循 HTTP 重定向。<br>设定[CURLOPT\_FOLLOWLOCATION](http://curl.haxx.se/libcurl/c/CURLOPT_FOLLOWLOCATION.html) cURL选项。| |*Retrieve mode*|选择检索模式：<br>**Body** - 从 HTTP 响应中仅检索正文<br>**Headers** - 从 HTTP 响应中仅检索标头<br>**Body and headers** - 从 HTTP 响应中检索正文和标头| |*Timeout*|Zabbix 处理 URL 的时间不会超过设定的时间 （从 1 秒到最长 1 小时）。实际上，这个参数定义了连接到 URL 的最长时间和执行 HTTP 请求的最长时间。因此，Zabbix 在该步骤上花费的时间不会超过**2 x Timeout**。<br>支持[Time suffixes](/manual/appendix/suffixes)（支持时间后缀），例如 30s、1m、1h。<br>支持[User macros](/manual/config/macros/user_macros)（用户宏）。| |*Required string*|要求使用正则表达式模式。<br>除非检索到的内容 (HTML) 与所需的模式匹配，否则该步骤将失败。如果为空，则不检查所需的字符串。<br>例如：<br>Zabbix主页<br>Welcome.\*admin<br>*Note*: 根据[regular expressions](regular_expressions)原则，不支持引用在 Zabbix 前端创建。<br>支持[User macros](/manual/config/macros/user_macros)（用户宏）。| |*Required status codes*|预期的 HTTP 状态代码列表。如果 Zabbix 获得不在列表中的代码，则该步骤将失败<br>如果为空，则不检查状态代码。<br>例如：200,201,210-299<br>支持 用户宏。| ::: noteclassic Web 场景步骤中的任何更改只有在保存整个场景时才会保存。 ::: 更多有关Web 配置监控步骤的信息，可以查看[real-life example](/manual/web_monitoring/example) （真实案例）。

en	#### Configuring tags The **Tags** tab allows to define scenario-level [tags](/manual/config/tagging). ![](../../assets/en/manual/config/scenario_c.png) Tagging allows to filter web scenarios and web monitoring [items](/manual/web_monitoring/items).
zh-cn	#### 标签配置 **Tags**（标签）配置选项允许定义场景级别的[标签](/manual/config/tagging)。 ![](../../assets/en/manual/config/scenario_c.png) 标签允许过滤 Web 场景和 Web的[监控项](/manual/web_monitoring/items)。

en	#### 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. ![](../../assets/en/manual/config/scenario_d.png) Authentication parameters: |Parameter|Description| |--|--------| |*HTTP authentication*|Select the authentication option:<br>**None** - no authentication used;<br>**Basic** - basic authentication is used;<br>**NTLM** - NTLM ([Windows NT LAN Manager](http://en.wikipedia.org/wiki/NTLM)) authentication is used;<br>**Kerberos** - Kerberos authentication is used (see also: [Configuring Kerberos with Zabbix](/manual/appendix/items/kerberos));<br>**Digest** - Digest authentication is used.| |*User*|Enter the user name (up to 255 characters).<br>This field is available if *HTTP authentication* is set to Basic, NTLM, Kerberos, or Digest. User macros are supported. | |*Password*|Enter the user password (up to 255 characters).<br>This field is available if *HTTP authentication* is set to Basic, NTLM, Kerberos, or Digest. User macros are supported. | |*SSL verify peer*|Mark the checkbox to verify the SSL certificate of the web server.<br>The server certificate will be automatically taken from system-wide certificate authority (CA) location. You can override the location of CA files using Zabbix server or proxy configuration parameter [SSLCALocation](/manual/appendix/config/zabbix_server#sslcalocation).<br>This sets the [CURLOPT\_SSL\_VERIFYPEER](http://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYPEER.html) cURL option.| |*SSL verify host*|Mark the checkbox to verify that the *Common Name* field or the *Subject Alternate Name* field of the web server certificate matches.<br>This sets the [CURLOPT\_SSL\_VERIFYHOST](http://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYHOST.html) cURL option.| |*SSL certificate file*|Name of the SSL certificate file used for client authentication. The certificate file must be in PEM^1^ format. If the certificate file contains also the private key, leave the *SSL key file* field empty. If the key is encrypted, specify the password in *SSL key password* field. The directory containing this file is specified by Zabbix server or proxy configuration parameter [SSLCertLocation](/manual/appendix/config/zabbix_server).<br>`HOST.*` macros and user macros can be used in this field.<br>This sets the [CURLOPT\_SSLCERT](http://curl.haxx.se/libcurl/c/CURLOPT_SSLCERT.html) cURL option.| |*SSL key file*|Name of the SSL private key file used for client authentication. The private key file must be in PEM^1^ format. The directory containing this file is specified by Zabbix server or proxy configuration parameter [SSLKeyLocation](/manual/appendix/config/zabbix_server).<br>`HOST.*` macros and user macros can be used in this field.<br>This sets the [CURLOPT\_SSLKEY](http://curl.haxx.se/libcurl/c/CURLOPT_SSLKEY.html) cURL option.| |*SSL key password*|SSL private key file password.<br>User macros can be used in this field.<br>This sets the [CURLOPT\_KEYPASSWD](http://curl.haxx.se/libcurl/c/CURLOPT_KEYPASSWD.html) cURL option.| ::: noteimportant \[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 extension \*.p12 or \*.pfx) you may generate the PEM file from it using the following commands: openssl pkcs12 -in ssl-cert.p12 -clcerts -nokeys -out ssl-cert.pem openssl pkcs12 -in ssl-cert.p12 -nocerts -nodes -out ssl-cert.key ::: ::: noteclassic Zabbix server picks up changes in certificates without a restart. ::: ::: noteclassic 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: cat client.crt client.key > client.pem :::
zh-cn	#### 认证配置 **Authentication**（认证）配置选项允许用户配置场景身份认证功能。选项卡名称旁边的绿点表示启用了某种类型的 HTTP 身份验证。 ![](../../assets/en/manual/config/scenario_d.png) 认证参数： |参数|描述| |--|--------| |*HTTP authentication*|选择认证选项：<br>**None** - 不使用认证；<br>**Basic** - 使用基本验证；<br>**NTLM** - 使用NTLM ([Windows NT LAN Manager](http://en.wikipedia.org/wiki/NTLM))认证方式；<br>**Kerberos** - 使用 Kerberos 验证 (更多信息，请参考： [Configuring Kerberos with Zabbix](/manual/appendix/items/kerberos))；<br>**Digest** - 使用 Digest 认证。| |*User*|输入用户名称（最多支持255个字符）。<br>当*HTTP authentication*设置为Basic（基础）、NTLM、Kerberos或者Digest，则用户可以填写本字段。支持使用用户宏。| |*Password*|输入用户密码（最多支持255个字符）。<br>当*HTTP authentication*设置为Basic（基础）、NTLM、Kerberos或者Digest，则用户可以填写本字段。支持使用用户宏。| |*SSL verify peer*|勾选复选框以验证 Web 服务器的 SSL 证书。<br>服务器证书将自动从系统范围的证书颁发机构 (CA) 位置获取。用户可以使用 Zabbix server 或 proxy 配置参数[SSLCALocation](/manual/appendix/config/zabbix_server)覆盖 CA 文件的位置。<br>设置[CURLOPT\_SSL\_VERIFYPEER](http://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYPEER.html) cURL选项。| |*SSL verify host*|标记复选框以验证Web 服务器证书的*Common Name* 字段或*Subject Alternate Name* 字段是否匹配。<br>配置[CURLOPT\_SSL\_VERIFYHOST](http://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYHOST.html) cURL选项。| |*SSL certificate file*|用于客户端身份验证的 SSL 证书文件的名称。证书文件必须为PEM^1^ 格式。如果证书文件还包含私钥，请将*SSL key file* （SSL密钥文件）字段留空。如果密钥已加密，请在*SSL key password*（SSL密钥密码） 字段中指定密码。 包含此文件的目录由 Zabbix server 或 proxy 配置参数由[SSLCertLocation](/manual/appendix/config/zabbix_server)指定。<br>支持`HOST.*` 宏和用户宏。<br>配置[CURLOPT\_SSLCERT](http://curl.haxx.se/libcurl/c/CURLOPT_SSLCERT.html) cURL选项。| |*SSL key file*|用于客户端身份验证的 SSL 私钥文件的名称。私钥文件必须是PEM^1^ 格式。包含此文件的目录由 Zabbix server 或 proxy 配置参数由[SSLKeyLocation](/manual/appendix/config/zabbix_server)指定。<br>支持使用`HOST.*`宏和用户宏。<br>配置[CURLOPT\_SSLKEY](http://curl.haxx.se/libcurl/c/CURLOPT_SSLKEY.html) cURL选项。| |*SSL key password*|SSL 私钥文件密码。<br>支持用户宏。<br>配置[CURLOPT\_KEYPASSWD](http://curl.haxx.se/libcurl/c/CURLOPT_KEYPASSWD.html) cURL选项。| ::: noteimportant \[1\] Zabbix 仅支持 PEM 格式的证书和私钥文件。 如果用户拥有PKCS \#12 格式文档（通常带有扩展名\*.p12 或者\*.pfx）的证书和私钥数据，可以使用以下命令从中生成 PEM 文件： openssl pkcs12 -in ssl-cert.p12 -clcerts -nokeys -out ssl-cert.pem openssl pkcs12 -in ssl-cert.p12 -nocerts -nodes -out ssl-cert.key ::: ::: noteclassic Zabbix server 无需重启即可获取证书中的更改。 ::: ::: noteclassic 如果你在单个文件中有客户端证书和私钥，只需在 "SSL certificate file（SSL 证书文件）" 字段中指定它，并将 "SSL key file（SSL秘钥文件）" 字段留空。证书和密钥必须仍为 PEM 格式。组合证书和密钥是比较容易的： cat client.crt client.key > client.pem :::

en	#### 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. ![](../../assets/en/manual/web_monitoring/scenario_details2.png){width="600"} An overview of web scenarios can also be displayed in *Dashboards* by the Web monitoring widget. Recent results of the web scenario execution are available in the *Monitoring → Latest data* section.
zh-cn	#### 展示 若用户要查看为主机配置的 Web 场景，请转到*Monitoring → Hosts*（监控→主机）在列表中找到主机并单击最后一列中的 *Web* 超链接。 单击方案名称以获取详细信息。 ![](../../assets/en/manual/web_monitoring/scenario_details2.png){width="600"} Web 场景的概述也可以通过 Web 监控部件显示在*Dashboards* 中。 Web 场景执行的最新结果可在*Monitoring → Latest data* （监控→最新数据）中找到。

en	#### 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](/manual/appendix/config/zabbix_server#debuglevel) and [proxy](/manual/appendix/config/zabbix_proxy#debuglevel) configuration files or using a [runtime control](/manual/concepts/server#runtime-control) option (`-R log_level_increase="http poller,N"`, where N is the process number). The following examples demonstrate how extended monitoring can be started provided debug level 4 is already set: # Increase log level of all http pollers: zabbix_server -R log_level_increase="http poller" # Increase log level of second http poller: zabbix_server -R log_level_increase="http poller,2" If extended web monitoring is not required it can be stopped using the `-R log_level_decrease` option.
zh-cn	#### 监控扩展 记录收到的 HTML 页面内容是十分必要的。尤其是当某些 Web 场景步骤失败 。调试级别 5（跟踪）的存在便是应用于此目的。此级别可以在[server](/manual/appendix/config/zabbix_server) 和 [proxy](/manual/appendix/config/zabbix_proxy) 配置文件中设置，也可以使用运行控制选项 (`-R log_level_increase="http poller,N"`, 其中 N 是进程号)。以下示例演示了如何在已设置调试级别 4 的情况下启动扩展监控： # Increase log level of all http pollers: zabbix_server -R log_level_increase="http poller" # Increase log level of second http poller: zabbix_server -R log_level_increase="http poller,2" 如果不需要扩展 Web 监控，可以使用 `-R log_level_decrease` 选项。