[comment]: # translation:outdated

[comment]: # aside:9

[comment]: # ({new-6b0e1e45})
# Monitor websites with browser items

[comment]: # ({/new-6b0e1e45})

[comment]: # ({new-8046ed31})
#### Introduction

This page walks you through the steps required to start basic monitoring of websites with browser items.

[comment]: # ({/new-8046ed31})

[comment]: # ({new-1c8f337f})
**Who this guide is for**

This guide is designed for new Zabbix users and contains the minimum set of steps required to enable basic monitoring of websites with browser items.
If you are looking for deep customization options or require more advanced configuration, see the [Browser items](/manual/config/items/itemtypes/browser) page or the [Configuration](/manual/config) section of Zabbix manual.

[comment]: # ({/new-1c8f337f})

[comment]: # ({new-746e75a8})
**Prerequisites**

Before proceeding with this guide, you need to [download and install](https://www.zabbix.com/download) Zabbix server and Zabbix frontend according to the instructions for your OS.

Depending on your environment, some steps in this guide may slightly differ.
This guide is based on an environment running Ubuntu.

[comment]: # ({/new-746e75a8})

[comment]: # ({new-9003b4f8})
#### Configure WebDriver

Browser items require an automation framework (either Selenium Server or a plain WebDriver, for example, ChromeDriver) as a web testing endpoint that controls and interacts with a browser, executing test commands such as clicking buttons or entering text.
As an example, this guide will use Selenium Server with Chrome in a Docker container.

It is assumed that Docker is already configured. This guide does not cover the configuration of Docker.
For installation instructions, see [Install Docker Engine on Ubuntu](https://docs.docker.com/engine/install/ubuntu/).

1\. Launch Selenium Server with Chrome in a Docker container with the following options:

-   **docker run --name browser** - runs a new Docker container named "browser";
-   **-p 4444:4444** - maps port 4444 on your host machine to port 4444 on the container (this is the port used by Selenium Server to accept commands);
-   **-p 7900:7900** - maps port 7900 on your host machine to port 7900 on the container (this is the port used by the Virtual Network Computing (VNC) server, allowing you to view the browser GUI remotely; requires a VNC client);
-   **--shm-size="2g"** - allocates 2GB of shared memory to the container (this is important for Chrome to run properly, as it can require a significant amount of shared memory to avoid crashes);
-   **-d** - runs the container in detached mode, meaning it will run in the background;
-   **selenium/standalone-chrome:latest** - specifies the Docker image to use; in this case, the latest version of [Selenium Server with Chrome](https://hub.docker.com/r/selenium/standalone-chrome).

```bash
docker run --name browser \
-p 4444:4444 \
-p 7900:7900 \
--shm-size="2g" \
-d selenium/standalone-chrome:latest
```

2\. Ensure that the `browser` Docker container is running and accessible.

-   Retrieve the IP address of the container (in this example, 192.0.2.1):

```bash
ip addr

# 1: lo: <LOOPBACK,UP,LOWER_UP>
#    ...
# 3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> ...
#    inet 192.0.2.1/16 brd 192.0.255.255 scope global docker0
#    ...
```

-   Test the connection to the container with [Ncat](https://nmap.org/ncat/):

```bash
nc -zv 192.0.2.1 4444

# Connection to 192.0.2.1 4444 port [tcp/*] succeeded!
```

-   Retrieve the webpage content from Selenium Server with [curl](https://curl.se/):

```bash
curl -L 192.0.2.1:4444

# <!DOCTYPE html>
# <html lang="en">
# 
# <head>
#   <meta charset="utf-8"/>
#   <link href="favicon.svg" rel="icon" type="image/svg">
#   <meta content="width=device-width, initial-scale=1" name="viewport"/>
#   <link href="logo192.png" rel="apple-touch-icon"/>
#   <link href="manifest.json" rel="manifest"/>
#   <title>Selenium Grid</title>
# </head>
# 
# <body>
# ...
```

::: noteclassic
For troubleshooting, refer to [Docker documentation](https://docs.docker.com/engine/).
:::

[comment]: # ({/new-9003b4f8})

[comment]: # ({new-3e81f645})
#### Configure Zabbix server

Browser items are executed and processed by *browser poller* Zabbix processes that need to be enabled by adjusting the [StartBrowserPollers](/manual/appendix/config/zabbix_server#startbrowserpollers) server configuration parameter.
Additionally, the [WebDriverURL](/manual/appendix/config/zabbix_server#webdriverurl) parameter should specify the previously configured web testing endpoint.

By default, the StartBrowserPollers parameter is set to 1, therefore you only need to specify the web testing endpoint.

1\. Open the Zabbix server configuration file.

```bash
vi /etc/zabbix/zabbix_server.conf
```

2\. Locate and set the [WebDriverURL](/manual/appendix/config/zabbix_server#webdriverurl) parameter in Zabbix server configuration file:

```ini
### Option: WebDriverURL
#	WebDriver interface HTTP[S] URL. For example http://localhost:4444 used with Selenium WebDriver standalone server.
#
# Mandatory: no
# Default:
# WebDriverURL=

WebDriverURL=192.0.2.1:4444
```

3\. Restart Zabbix server.

```bash
systemctl restart zabbix-server
```

[comment]: # ({/new-3e81f645})

[comment]: # ({new-48af2e5f})
#### Configure Zabbix frontend

1\. Log into Zabbix frontend.

2\. [Create a host](/manual/config/hosts/host) in Zabbix web interface:

- In the *Host name* field, enter a host name (for example, "git.zabbix.com").
- In the *Templates* field, type or select the "Website by Browser" template. For more information on this template, see [Website by Browser](https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/website_browser?at=refs%2Fheads%2Frelease%2F7.0).
- In the *Host groups* field, type or select a host group (for example, a new host group "Websites").

![](../../../assets/en/manual/guides/browser_host.png){width="600"}

- In the *Macros* tab, switch to *Inherited and host macros*, look for the following macros and click on *Change* next to the macro value to update it:
    - {$WEBSITE.DOMAIN} - Domain name (for example, git.zabbix.com/projects/ZBX/repos/zabbix/browse)
    - {$WEBSITE.GET.DATA.INTERVAL} - Item data update interval (for example, 15m)

![](../../../assets/en/manual/guides/browser_macros.png){width="600"}

3\. Click the *Add* button to create the host. This host will represent the website you want to monitor.

[comment]: # ({/new-48af2e5f})

[comment]: # ({new-f8dfb64b})
#### View collected metrics

Congratulations! At this point, Zabbix is already monitoring the website you specified.

To view collected metrics, navigate to the [*Monitoring → Hosts*](/manual/web_interface/frontend_sections/monitoring/hosts) menu section and click on *Dashboards* next to the host.

![](../../../assets/en/manual/guides/browser_monitored_hosts.png){width="600"}

This action will take you to the host dashboard (configured on the template level) with the most important metrics collected from the website.

![](../../../assets/en/manual/guides/browser_dashboard.png){width="600"}

[comment]: # ({/new-f8dfb64b})

[comment]: # ({new-e3d26cda})
#### Set up problem alerts

Zabbix can notify you about a problem with your infrastructure using a variety of methods.
This guide provides basic configuration steps for sending email alerts.

1\. Navigate to [*User settings → Profile*](/manual/web_interface/user_profile), switch to the *Media* tab and [add your email](/manual/quickstart/basic_config/login#adding-user).

![](../../../assets/en/manual/quickstart/new_media.png){width="600"}

2\. Follow the guide for [Receiving a problem notification](/manual/quickstart/basic_config/notification).

Next time, when Zabbix detects a problem, you should receive an alert via email.

[comment]: # ({/new-e3d26cda})

[comment]: # ({new-77577f84})
#### Test your configuration

To test your configuration, we can simulate a real problem by updating the host configuration in Zabbix frontend.

1\. Open your website host configuration in Zabbix.

2\. Switch to the *Macros* tab and select *Inherited and host macros*.

3\. Click on *Change* next to, for example, the [previously configured](#configure-zabbix-frontend) {$WEBSITE.DOMAIN} macro value and set an incorrect domain name (for example, /git.zabbix.com/projects/ZBX/repos/zabbix/browse).

4\. Click on *Update* to update the host configuration.

5\. In a few moments, Zabbix will detect the problem "Failed to get JSON of the requested website", because it will not be able to connect to the specified website.
The problem will appear in [*Monitoring → Problems*](/manual/web_interface/frontend_sections/monitoring/problems).

![](../../../assets/en/manual/guides/browser_problem.png){width="600"}

If alerts are [configured](#set-up-problem-alerts), you will also receive the problem notification.

6\. Change the macro value back to its previous value to resolve the problem and continue monitoring the website.

[comment]: # ({/new-77577f84})

[comment]: # ({new-cfdcb2f0})
#### See also

- [Creating an item](/manual/config/items/item) - how to start monitoring additional metrics.
- [Problem escalations](/manual/config/notifications/action/escalations) - how to create multi-step alert scenarios
  (e.g., first send message to the system administrator, then, if a problem is not resolved in 45 minutes, send message to the data center manager).
- [Browser items](/manual/config/items/itemtypes/browser) - how to configure Browser items.
- Template [Website by Browser](https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/website_browser?at=refs%2Fheads%2Frelease%2F7.0) - additional information about the *Website by Browser* template.

[comment]: # ({/new-cfdcb2f0})
