You can create a browser detection task to simulate users in different regions and network environments to access detection targets, monitoring the stability and performance of the detection targets being accessed from browsers. By default, a new browser detection task is in the Running state. When the detection frequency is reached, the task is automatically executed. This topic provides an example on how Taobao developers use the script recording feature to assert the loading integrity of the Taobao website on Google Chrome.
Prerequisites
Network Analysis and Monitoring is activated. For more information, see Activate Network Analysis and Monitoring.
For information about the billing of browser detection, see Pay-as-you-go.
One or more alert contacts and alert contact groups are created. For more information, see Create an alert contact or alert contact group.
To use the alert callback feature when you configure alert rules, prepare a callback URL that can be accessed over the Internet and add the IP addresses 47.74.206.0/26, 47.74.206.64/26, 47.74.206.128/26, 47.74.206.192/26, and 8.222.159.116 to the whitelist of the firewall.
Limits
You can use the script recording feature only for browsers on PCs.
Procedure
Create a browser detection task.
Log on to the CloudMonitor console.
In the left-side navigation pane, choose .
On the Monitoring Tasks tab, click Create Task.
On the Create Task page, configure the parameters for the browser detection task.
Basic Information
Enter a task name in Task Name, enter https://www.taobao.com/ in Monitored Address, and select Chrome under PC for Browsers and Devices. Retain the default settings of other parameters.
Parameter
Description
Task Name
The name of the browser detection task.
The name must be 4 to 100 characters in length, and can contain letters, digits, and underscores (_).
Monitored Address
The URL for browser detection.
You can enter multiple URLs, such as
https://www.taobao.com/
. Separate multiple addresses with line feeds.NoteIf you enter multiple monitored URLs, a browser detection task is automatically generated for each URL. A maximum of five browser detection tasks are supported.
Frequency
The browser detection interval.
Valid values: 5 Minutes, 15 Minutes, 30 Minutes, and 60 Minutes. For example, if you select 5 Minutes, the detection points in each region monitor the URLs at an interval of 5 minutes.
Browsers and Devices
Different browsers (Chrome, Edge, Firefox, and Safari) on different devices (PCs, tablets, and mobile phones) are used to monitor the URLs.
Strict mode
After you enable the strict mode, any resource that fails to be loaded during the detection will cause the detection task to fail.
Certificate Error
If you select Ignore Certificate Error, issues such as expired certificates and mismatched certificates are ignored during detection.
Additional waiting time
If your web page is redirected after it is loaded, you can set an additional waiting time to collect monitoring data accurately.
Customizations
You can set the custom header and host information. You can specify the key and value for a custom header and the domain name and IP address of a custom host.
NoteYou can click Advanced Settings to configure this parameter.
DNS Server
The type of the DNS server. Valid values:
System default DNS
The operator DNS corresponding to the detection point
Custom DNS
NoteYou can click Advanced Settings to configure this parameter.
Hijacking Check
The whitelisted objects that are used to prevent DNS hijacking for carriers.
NoteYou can click Advanced Settings to configure this parameter.
Traffic hijacking check
The check items for traffic hijacking. Valid values:
Resource Count Threshold: If the number of loaded resources exceeds this threshold when a page is redirected, traffic hijacking occurs.
Resource blacklist: The resources that do not appear on the page that is being loaded.
Resource Whitelist: The only resources that appear on the page that is being loaded.
NoteYou can click Advanced Settings to configure this parameter.
Page Text Assertion
The blacklist and whitelist of page character assertions. Valid values:
Page Character Blacklist: The characters that do not appear on your page.
Page Character Whitelist: The only characters that appear on your page.
NoteYou can click Advanced Settings to configure this parameter.
Mask Resource List
The unnecessary or harmful resources that are shielded.
NoteYou can click Advanced Settings to configure this parameter.
Define Assertions
The default available condition is used for assertions: The first packet time is less than 1,000 ms.
You can configure multiple assertions by specifying conditions. A detection point is available only if it meets all the specified conditions. If the default available condition provided by CloudMonitor does not meet your requirements, click Add Condition Group to add condition groups. The relationship between multiple condition groups is AND.
Select Detection Points
Use the default detection points.
Configure Alert Rules
The default Availability Rate alert rule is used.
CloudMonitor provides an alert rule by default. If the default rule does not meet your business requirements, perform the following steps to add an alert rule:
Click Add Rule.
In the Add Rule Description panel, configure parameters for the alert rule. The following table describes the parameters.
Parameter
Description
Rule Name
The name of the alert rule.
Metric Name
The name of the metric that is used by the alert rule. Valid values:
Availability
First Contentful Paint
Number of Error Elements
Download Time
Comparison
The operator that is used to compare the metric value with the threshold in the alert rule. Valid values:
>=
>
<=
<
=
!=
Compared With Yesterday Rise
Compared With Yesterday Decline
Compared With Last Week Rise
Compared With Last Week Decline
Compared With Last Period Rise
Compared With Last Period Decline
Threshold and Alert Level
The alert level and the corresponding threshold.
The notification method for alerts of the Info level is Email + Webhook.
Valid values of the number of consecutive periods in which the metric value reaches the threshold before an alert is triggered: 1, 2, 3, 4, 5, 10, 15, and 20.
Tag
The tag name and tag value of the alert rule.
Auto Scaling
If you turn on Auto Scaling, the specified scaling rule is enabled when an alert is triggered. In this case, you must configure the Region, ESS Group, and ESS Rule parameters.
For more information about how to create a scaling group, see Manage scaling groups.
For more information about how to create a scaling rule, see Manage scaling rules.
Simple Log Service
If you turn on Simple Log Service, the alert information is sent to the specified Logstore when an alert is triggered. In this case, you must configure the Region, ProjectName, and Logstore parameters.
For more information about how to create a project and a Logstore, see Getting Started.
Simple Message Queue (formerly MNS) - Topic
If you turn on Simple Message Queue (formerly MNS) - Topic, the alert information is sent to the specified topic in Simple Message Queue (formerly MNS) (SMQ) when an alert is triggered. In this case, you must configure the Region and topicName parameters.
For more information about how to create a topic, see Create a topic.
Function Compute
If you turn on Function Compute, an alert notification is sent to Function Compute for format processing when an alert is triggered. In this case, you must configure the Region, Service, and Function parameters.
For more information about how to create a service and a function, see Quickly create a function.
Click OK.
Select Alert Contact Groups
The alert contact groups. Retain the default settings of the parameters in the Advanced Settings section.
Parameter
Description
Contact Groups
The alert contact groups to which alert notifications are sent. Select at least one alert contact group.
Alert notifications are sent to the alert contacts that belong to the specified alert contact groups. An alert contact group can contain one or more alert contacts.
Mute For
The interval at which CloudMonitor resends alert notifications before an alert is cleared. Valid values: 5 Minutes, 15 Minutes, 30 Minutes, 60 Minutes, 3 Hours, 6 Hours, 12 Hours, and 24 Hours.
If a metric value reaches the threshold, CloudMonitor sends an alert notification. If the metric value reaches the threshold again within the mute period, CloudMonitor does not resend an alert notification. If the alert is not cleared after the mute period ends, CloudMonitor resends an alert notification.
NoteYou can click Advanced Settings to configure this parameter.
Effective Period
The period during which the alert rule is effective. CloudMonitor monitors the specified resources based on the alert rule only within the specified period.
NoteYou can click Advanced Settings to configure this parameter.
Alert Callback
The callback URL that can be accessed over the Internet. CloudMonitor sends HTTP POST requests to push alert notifications to the specified URL. Only HTTP requests are supported. For more information about how to configure alert callback, see Use the alert callback feature to send notifications about threshold-triggered alerts.
To test the connectivity of an alert callback URL, perform the following steps:
Click Test next to the callback URL.
In the Webhook Test panel, you can check and troubleshoot the connectivity of the alert callback URL based on the returned status code and test result details.
NoteTo obtain the details of the test result, configure the Test Template Type and Language parameters and click Test.
Click Close.
NoteYou can click Advanced Settings to configure this parameter.
Click Save and edit script recording.
Optional. Load the following extension on Google Chrome: CloudMonitor Browser Detection plug-in.
NoteThis operation is required only when you use the script recording feature for the first time.
On the Record Script page, click Local Installation.
Download the installation package of the CloudMonitor Browser Detection plug-in.
Decompress the installation package of the CloudMonitor Browser Detection plug-in.
Enter
chrome://extensions/
on Google Chrome.On the Extensions page, turn on Developer mode in the upper-right corner, click Load unpacked, select the decompressed CloudMonitor Browser Detection plug-in package, and then click Select Folder.
Select the loaded CloudMonitor Browser Detection plug-in.
Refresh the Record Script page.
In the script recording section on the right, the Taobao page is displayed. You can record the operation script.
On the Record Script page, assert the website loading integrity.
This operation is used to assert the image display integrity on Taobao.
Click Assertion in the upper-left corner.
In the Detecting Page Elements section, click Test for the presence of an element.
In the recording section on the right, click the desired image on Taobao.
If the assertion content is displayed as shown in the following figure, the assertion content is successfully recorded. In this case, use the locator automatically generated by CloudMonitor to locate the desired element. If the location fails or is inaccurate, you can specify a locator.
View the browser detection result.
On the Monitoring Tasks tab, click the name of the detection task to view the detection result.
For an incorrect detection record, click Details in the Actions column of the detection record. On the Detailed analysis page, click the Procedure tab to view the detailed steps and the cause of the error.