如何创建设备和目标

HTTP/S 监视检查单个 URL 的可用性、性能、适当的内容和错误。 它支持 POST 和 GET 请求、Cookie、表单提交、自定义标头、密码保护站点(基本 HTTP/S 授权以及 Cookie/脚本授权机制)和超时阈值。

HTTP/S 监视验证安全证书、检查证书颁发机构并检查过期。 也可以将其配置为在证书到期日期临近时向您发送提醒。

您可以将请求参数值转换为上下文变量以传递值,例如,从其他任务的响应中检索到的值。

创建 HTTP/S 任务

创建设备并添加或编辑 HTTP/S 任务后,系统将提示您调整以下设置。

Url

Enter the URL of the page you wish to perform the task on. It should be formatted as such: www.example.com.

You can turn on a visually friendly input mode by clicking the Detailed switcher on the top of the section.

SSL/Certificate Check for HTTPS task

Secure Socket Layer SSL Certificate Monitoring is a standard aspect of HTTPS monitoring.

For an HTTPS task, the following additional options are available:

  • Authority: verifies whether a certificate chain contains a root certificate that is trusted, or not trusted.
  • Common Name (CN): validates that an address you navigate to matches the address certificate the address was signed to.
  • Date: verifies the certificate expiration date.
  • Revocation: validates that the certificate’s chain of trust doesn’t contain a revoked certificate.
  • Usage: verifies a certificate chain for the improper use of an intermediate certificate.
  • Expiration Reminder in Days: a reminder that notifies (as an error) about certificate expiration.
  • Client Certificate: client certificate name.

另请参阅:目标主机名或 IP 地址

完成超时(以秒为单位)

Enter the number of seconds the task should wait for a response from the web page before ending the task and returning an error. If this is left blank the default timeout for a task is 120 seconds.

请求类型

You can send a GET or a POST request to the web page. Selecting a GET request will simply retrieve data from the web server.  Selecting a POST request indicates that you are including a set of data for the server to act upon.  Note:  if you set the request type to POST but do not specify a POST parameter in the additional parameters section below, the POST value will default back to get upon saving the task.

内容验证

Content Validation Keywords are used to ensure that the expected content was loaded onto a web page.

In the Keyword fields, you can specify one or more words or phrases that you wish to search for in the web page content.  If the expected keywords are not found, the task will return an error.

You can enter multiple strings into the keyword fields.  The values you enter can be separated by logical expressions as follows:
{[(“keyword1″&”keyword2″)|!”keyword3″]}
]} – keyword expression end;
where
{[ – keyword expression start;
() – grouping brackets;
& – logical AND;
| – logical OR;
! – logical NOT;
“string” – a keyword;

A successful keyword expression must include the start and end brackets as follows:

{[“keyword”]}

基本身份验证

Basic authentication is used to allow users to access content on some websites.

Username: contains a username for HTTP/S basic or digest access authentication.

User Password: contains a password for HTTP/S basic or digest access authentication.

Read the article on Authentication username and password for more information.

The option allows to add any additional custom headers in the following format (by “=” symbol, each header should start from a new line):

Header_name_1 = "value"
Header_name_2 = "value"

Header Name: specify the name of the parameter as it will appear in the request.

Value: enter the value associated with the name of the parameter.

User-Agent header used by the Dotcom-Monitor HTTP task: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; .NET CLR 1.0.3705).

However, the IE6 user string can be replaced with any other string. To do this, add a custom header with the name “user-agent” and the specific value needed.

发布请求的数据选项

If Post request type was selected you can specify the following Post parameters:

  • Name: the name of the parameter as it will appear in the request.
  • Value: the value associated with the name of the parameter.

Read the article on Authentication username and password for more information.

DNS 选项

The DNS Options feature allows users to choose how domain name server (DNS) requests are conducted during a monitoring task.

To specify the mode of resolving hostnames, in the DNS Resolve Mode section, select one of the available modes. For more details on the feature configuration, see DNS Mode Options.

The Custom DNS Hosts section contains the mappings of IP addresses to hostnames.

To specify the mapping, enter the IP address and the host name in the corresponding fields.

Examples:

192.168.107.246   example.com user.example.com userauth.example.com tools.example.com
192.168.107.246   example.com
192.168.107.246   user.example.com
192.168.107.246   userauth.example.com

See also: DNS Mode Options.

准备脚本

The fields can contain C# code, which can be used for specific POST, GET, URL data or for validating or publishing custom headers. Please see the Using Prepare Script and Post Script article or contact technical support for more details on usage.

使用上下文变量

使用以下语法指定上下文变量:

上下文。 <变量名称>

上下文变量名称必须与要指定的相应 Web 元素的名称相同。 变量名称区分大小写。

要在请求中指定变量名称,请检查相应的元素代码并复制“name”属性值。

假设,我们希望监控提交具有唯一字段值的网站注册表单。 首先,我们需要创建一个带有相应Post请求的 HTTP 任务。 然后,我们需要在请求正文(Post Data)中添加表单字段的参数,并将其值转换为上下文变量。

要添加新参数:

  1. “请求类型”字段中选择”过帐”。
  2. 展开“发布数据”字段,然后单击“详细切换”,然后单击”添加参数“。
  3. “参数名称“字段中,键入窗体的字段名称,使其在相应的元素代码中如何显示。
  4. 要将参数值转换为上下文值,请指向“值”字段并单击齿轮图标。
  5. “编辑值”窗口中,选择“动态”并使用以下语法指定参数值:上下文。 <变量名称 > . 单击“完成“。
  6. 要为上下文参数指定默认动态值,请单击 任务配置边栏上的操作菜单按钮,然后单击”管理上下文参数“。 单击“完成”以完成。

在下图中,名称Pwd参数现在将分别从分别命名为”登录”“密码”的上下文变量中获取该值。