Wie man Geräte und Ziele aufs Neue

Eine HTTP/S-Überwachung überprüft eine einzelne URL auf Verfügbarkeit, Leistung, ordnungsgemäßen Inhalt und Fehler. Es unterstützt POST- und GET-Anforderungen, Cookies, Formularübermittlungen, benutzerdefinierte Header, passwortgesicherte Websites (grundlegende HTTP/S-Autorisierung sowie Cookie/Skript-Autorisierungsmechanismen) und Timeout-Schwellenwerte.

Die HTTP/S-Überwachung überprüft Sicherheitszertifikate, überprüft die Zertifizierungsstelle und überprüft den Ablauf. Es kann auch so konfiguriert werden, dass Sie Erinnerungen senden, wenn sich das Ablaufdatum des Zertifikats nähert.

Sie können HTTP(S)-Anforderungsparameter in Kontextparameter konvertieren, um Werte zu übergeben, z. B. aus einer Antwort einer anderen Anforderung innerhalb des Überwachungsgeräts abgerufen. Sie können Kontextparameter für die URL, Header, Anforderungsinhalte (für Post-, Put-, Patch-Methoden) und die Skripts zum Vorbereiten und Nachsenden einrichten. Weitere Informationen finden Sie unter Verwenden von Kontextparametern in HTTP(S)-Anforderungen.

Konfigurieren einer Anforderung

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 

Secure Socket Layer SSL Certificate Check is a standard aspect of HTTP(S) tests.

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.

Siehe auch: Ziel-Hostname oder IP-Adresse.

Schwellenwert für die Zeitüberprüfung (in Sekunden)

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.

Anforderungstyp

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.

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.

URL-Umleitungen

If the Follow Redirects option is set to Yes, the system will follow the path of the URL that is sent with the 301 response and consider each redirect as a separate HTTP request. It enables you to follow the full redirect chain (all the links the request is redirected through) in the test results, including response times both for the initial URL and subsequent responses.

We recommend that you leave the Follow Redirects option activated if you need to test not only the initial URL, but all the URLs in the chain. For example, it can be useful to perform an SSL certificate check for each URL in a redirect chain.

In cases where you want to test an initial URL only, disable the Follow Redirects option.

Note that a default redirection limit is set at 10 redirects. If you want the system to execute a particular number of redirects (less than 10), you can specify the number of URLs you want to test in your redirect chain in the Prepare Script field:

string url;
url = "http://wtatour.com/";
currentTask.TaskMaxRedirectAttempts = N;

Where N is the number of redirect locations we want to follow. To follow no redirects, simply set the number of redirect locations to 0.

Inhaltsvalidierung

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"]}

Where:
{[ – keyword expression start;
]} – keyword expression end;
() – 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"]}

Standardauthentifizierung

The Basic Authentication scheme s used to allow users to access content on some websites. Once provided login credentials will be passed along with the request header to the web server.

  • 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.

Do not confuse Basic Authentication with other authentication schemes such as Bearer Authentication that involves bearer tokens and OAuth 2.0 that uses access tokens.

Read the articles on Basic Authentication Username and Password and Monitoring OAuth 2.0-based APIs for more information.

Header

Die Option ermöglicht das Hinzufügen zusätzlicher benutzerdefinierter Header. Sie können z. B. den MIME-Typ der gesendeten Daten zusammen mit der Anforderung im Content-Type-Header definieren:

Content-Type: text/html

Wenn der Content-Type-Header nicht für die Anforderung angegeben ist, wird die Anforderung mit dem Standardinhaltstyp application/x-www-form-urlencodedgesendet.

The default User-Agent header is set to:

User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0; .NET CLR 1.1.4322; .NET CLR 1.0.3705; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) DMBrowser/2.1 (SV)

However, the user-agent 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.

POST -Daten (PUT, PATCH)

If one of the POST, PUT, or PATCH methods were selected, you can specify the payload here. The content within the HTTP request body can be sent as “raw” data (JSON, XML, etc.) or static name-value collection (Form Data).

To work with a name-value collection, you can turn on the detailed input mode by using the Detailed switcher on the top of the section and provide request parameter names and values in the corresponding field.

To send “raw” data along with the request, such as a JSON object, enter your JSON payload in the input field. You can also dynamically change the request body. For example, if you need to send the current date and time as a part of your POST request or pass the current session ID in JSON payload to a remote server. Dotcom-Monitor enables dynamically changing HTTP request payload by using the Razor syntax and data masks.

  • Example. Dynamic JSON Body for HTTP Post Requests

    To better understand how Dynamic JSON body works in the HTTP request, let’s have a look at the following example. Suppose we need to submit an order on a website and the submission transaction includes three basic steps executed sequentially:

    1. Login
    2. Check-in
    3. Order Submission

    To set up a test with these steps executed sequentially, we need to create three HTTP tasks within one monitoring device (or load test, if load testing is taking place).

    Let’s assume that we need to send the current time and a unique GUID in the JSON with the HTTP request to check in with the application. Also, to submit an order, a user session ID generated upon login and an order time is required by the application.

    To implement this test, we first need to configure a login request with basic authentication parameters to the web application web server. Next, we need to configure an HTTP request to pass the actual check-in time and unique GUID along with a JSON body. For this example, we will enter the following string using the Razor syntax in the JSON body:

    { "CheckInTime": "@Model["CurrentTime"]", "GenGuid": "@Model["Guid"]" }

    Where @Model[“<Parameter Name>”] references a necessary context parameter name in the Razor expression.

    We must declare the context parameters and specify how the Post Data should be processed in the Prepare Script field:

    context.Guid = Guid.NewGuid().ToString(); // uniq random string
    context.CurrentTime = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-dd\\Thh:mm:ss") + ".0Z"; // get current time in UTC
    ProcessPostDataByRazor(currentTask); // the call to process the Post Data content with the Razor engine

    The result HTTP request will look similar to this:

    03:15:23
    POST http://www.dotcom-monitor.com/CheckIn
    { "CheckInTime": "2021-03-30T08:15:22.0Z", "GenGuid": "5c5e3d23-66fd-49d0-bd57-62c516aea7e7" }

    In the next step, we need to configure the HTTP request to submit an order. In order to do this, we will pass the order current time and session ID, along with the item’s model identification number, in the JSON body to the target endpoint. See the JSON body for this request below:

    { "OrderTime": "@Model["OrderTime"]",   "VIEWSTATE": "@Model["Session"]",  "ModelID": "2128506" }

    To pass a value of the current session ID variable, we need to retrieve it from the login page, called at the first login step, using the View State method. It can be coded in the prepare script. Additionally, to simulate a real user’s think time, we will set the order time variable with a three minute offset. Therefore, the Prepare Script field will contain the following strings:

    context.OrderTime = DateTime.Now.AddMinutes(3).ToUniversalTime().ToString("yyyy-MM-dd\\Thh:mm:ss") + ".0Z"; // order time + 3 min
    context.Session = (Tasks["Login"] as Http).body["//INPUT[@ID='__VIEWSTATE']", "VALUE"]; // track state value from Login page 
    ProcessPostDataByRazor(currentTask);

    The resulting HTTP request will look similar to this:

    03:15:45
    POST http://www.dotcom-monitor.com/Order
    { "OrderTime": "2021-03-30T08:18:45.0Z", "VIEWSTATE": "<Server Generated ViewState>", "ModelID": "2128506" }
                        

To learn how to configure an HTTP request with a dynamically changing payload, see How to Dynamically Change Payload in HTTP Request.

DNS-Optionen

Mit der Funktion DNS-Optionen können Benutzer auswählen, wie DNS-Anforderungen (Domain Name Server) während einer Überwachungsaufgabe ausgeführt werden.

Um den Modus zum Auflösen von Hostnamen anzugeben, wählen Sie im Abschnitt DNS-Auflösungsmodus einen der verfügbaren Modi aus. Weitere Informationen zur Feature-Konfiguration finden Sie unter DNS-Modusoptionen.

Der Abschnitt Benutzerdefinierte DNS-Hosts enthält die Zuordnungen von IP-Adressen zu Hostnamen.

Um die Zuordnung anzugeben, geben Sie die IP-Adresse und den Hostnamen in die entsprechenden Felder ein.

Beispiele:

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

Siehe auch: DNS-Modusoptionen.

Vorbereiten von Skript und Postskript

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.