Home » Zabbix » Monitoring WebSite with Zabbix

Monitoring WebSite with Zabbix

I continue my series of articles on setting up a monitoring system based on a popular free product, which has been the subject of heated debate on social media these days, provoked by The Marketing Heaven. This time we will setting up a web site monitoring with zabbix server. As an example, take some third-party resource and check on it the standard functionality.


To monitor the web site, we will use the standard zabbix functionality. Here are the parameters for which we will observe:

  • Availability.
  • Response time in milliseconds.
  • Access speed.
  • Work authorization on the site.

To do this, we will perform the following sequence of actions:

  • Create a template for monitoring sites.
  • Configure Web scenarios.
  • Create graphs.
  • Add triggers to check the availability and download speed of the site.

We proceed to setting up monitoring. We will use only the standard functionality available after installation. There will be no additional user parameters or scripts. If you do not have your own monitoring server, I recommend post on this site – install and configure zabbix.

Adding a web site to the monitoring

The easiest way to connect a site to monitoring is to add its check on an already existing host. In this case there is one big disadvantage – if you want to enable this monitoring from another host, or simply transfer to another server, then it will be difficult to do so. It is much more easy to monitor sites and everything connected with it, set up in a separate template. So go to the section Configuration -> Templates and create a new template.

Creating a template for monitoring sites in zabbix

A standard form for creating a template opens. Enter the name of the template, where the settings for monitoring sites will be, and add it to some group.

Template parameters

Open this template. Go to the Web Scenarios tab and add a new web scenario to monitor the site.

Creating a web site monitoring script

Fill in the basic parameters of the script. As a name, I usually specify the address of the site. In my example it will be github.com. Set the name of the application for monitoring sites for easy sorting of items related to the sites, the interval of testing and the number of connection attempts.

Web Scenario Parameters

After that, go to the Steps tab and add the verification step.

First step of monitoring

Then I specify the parameters of the step.

Parameters for monitoring a specific page

Let me explain each parameter:

  • Name – the name of the step. In this case, the main page of the site will be checked, therefore I call the step index. This is not important, but I recommend giving names meaningful, so that later it would be convenient to operate with names, for example, in triggers.
  • URL – the address of the page to be checked.
  • Required string – the string on the page that zabbix will look for. I took the string from the footer site. If zabbix find it on the page, it will assume that the site is all right. If not, it will bee an error.
  • Required status codes – the required response code. I specify 200. If zabbix receives some other code in response from the web server, the check has failed.

After filling in all the parameters, click Add to add a step and then Add again to add the verification script itself. It should turn out like this.

Ready web scenario

The simplest site availability check is done. Next we need to attach this template to some host, so that the actual checks start. I will attach the template to the zabbix server itself. To do this, go to Configuration -> Hosts, select Zabbix Server and attach the template created earlier to it.

Enable site monitoring

We wait a few minutes and go to the section Monitoring -> Web to watch the results of monitoring the site github.com.

Monitoring result - response time and site loading speed

The response code 200, the search string was found, which confirms Status OK. Here is graphics site download speed and response time. For more information about monitoring the specified site can be found in Latest Data.

Latest data for Site Monitoring

The value of the parameter Failed step of scenario “github.com” equal to 0 means that all steps to check the site were completed without errors. If you have several steps and one of them is finished with an error, there will be a number of this step. That is, in general, all that is not 0, these are some problems. Later we will use it in the trigger. In the meantime, add a couple of graphs to the template, which can then be used in dashboards.

Setting up web site monitoring graphs

We return to our template and go to the Graphs section. Create a new graph.

Add graphics

Add a graph of the download speed for the main page of the site.

Graphics settings

Similarly, you can add a site response time. I once added both of these graphics to Screen. It should turn out like this.

Screen for response and site loading speed

For more usefull visualizations, it is better to use Dashboards. Now we will configure monitoring of the site with authorization.

Website monitoring with authorization

Let’s complicate the task a bit. Let’s try to authorize the site and monitor both the authorization itself and the closed page behind it. For example, I will take the forum centos.org/forums/, log in to it, and after logging in I will check the page with the personal information of a specific user.

In order to set up a monitoring site with authorization in zabbix, you need to correctly prepare a post request. To do this, I go to the page with authorization. In this case, it is https://www.centos.org/forums/ucp.php?mode=login, open DevTools in Сhrome, tab Network. I fill in the fields of the authorization form with knowingly incorrect data so that the authorization ends with an error. After this error, I look at the headers of the post request.

Formation of post request

I click on the view source in the Form Data section and copy the resulting string. In my case, it was this:


From here you can precisely remove the redirect parameter. As a result, I save the following line:


Now I’m going to a template for monitoring sites and adding a new site – centos.org. I create the first step with authorization, call it auth. In it I specify post request for authorization.

Configure monitoring site with authorization

Do not forget to change the password to the correct one. After successful authorization, you will see the main page of the forum, where there will be a link to private forum messages. This link is available only after authorization.

An example of an authorized page

The next step is to check the Private messages line on the main forum page.

Internal Page Monitoring

Steps are performed sequentially. In the first step, we only log in, in the second we check the page that is available after authorization. Go to Latest Data and see the result.

Monitoring results with authorization

Both steps completed successfully, no errors. Let’s look at the section Monitoring -> Web.

Download speed and response time for pages

Everything is all right. It is clearly seen that the authorization process is much longer and slower than the loading of the main page.

Site unavailability alert

Let’s set up notifications about problems on the site. I offer 2 types of alerts:

  • Low site access speed.
  • The site availability.

We go, as usual in the original template, on the Triggers tab and add a new one.

Adding a trigger

I propose such a trigger condition to determine the inaccessibility of the site. If the average value of the last 3 checks is greater than or equal to one, then the site unavailability warning is triggered.

Notice of site unavailability

When 0 goes in all checks, everything is in order. The trigger will work only if all 3 last checks are not zero. In my example, Failed step can be either 0 or 1, where 1 is the number of the failed step. If you have several steps, then the second step or the third step may be a failure. That is, the value can be greater than 1. But in any case, if the last 3 values in a row are strictly not 0, then the trigger is triggered. The recovery operation is very simple. If the last check without error, that is, the code is 0, then we consider that the site is already working.

To test the trigger, it is enough to add a line to the /etc/hosts file on the zabbix server: github.com

and wait 3 minutes to get 3 unsuccessful checks. After that, you should have been sent a notification about the inaccessibility of the site. I got this:

Notification from zabbix server about inaccessibility of the site

Next, we check the server response time. Here everyone is free to tune in as it seems to him more correct and convenient. I use such a scheme. I take the average response time of the site and multiply it by 3. Then I look at the last 7 checks. If in 5 checks among these seven there were values ​​higher than the tripled average response time, then I consider that the site slows down and it is necessary to send a notification. It is a bit confusing, but in practice such a scheme I have recommended myself well without false positives. However, if there are real problems, I see them. We make the trigger.

Site slow alert

Condition recovery – in the last three requests, two or more were faster than the tripled average access time. Expression text to copy:

{Sites Monitoring:web.test.time[github.com,index,resp].count(#7,1.5,"ge")}>4
{Sites Monitoring:web.test.time[github.com,index,resp].count(#3,1.5,"lt")}>1

Here 1.5 is the response time in seconds. You can check it in Latest Data.

Data format for site response in zabbix

In conclusion, I leave my template that I created for writing the article. You can copy and edit to adapt it for your sites. It is faster than being from scratch. Template exported from zabbix version 4.0 – sites_monitoring.xml

That’s all, web site monitoring works, authorization is checked, the site unavailability notification is configured. For completeness, you can create a Screen or Dashboard with the output of all the necessary parameters on one screen. Its settings will already depend on the specific situation and the data that you have. For example, if you have configured web server monitoring, then you can place a number of graphs of its download and parameters of access to the site. There you can also add the load of the server itself on the processor and memory and display a graph of the use of the network interface.

Zabbix is very flexible and allows you to customize everything for every taste and under any requirements.


I will add a few words on how this web site monitoring can be used. I had two hosting and wanted to choose one faster. The load of the server itself for the hardware was so low that it could not be taken at all into account. The more important parameter was the response time of the server and the speed of access to it. I launched the site on both servers and set up monitoring. By its parameters chose a faster server.

Of course, here you need to understand that the data of such monitoring is very conditional and depends on where the zabbix server itself is located. It is possible that the monitoring of all sites will show approximately the same numbers due to the limitations of the monitoring server itself. You need to have this in mind. Still quite often when checking the response time of the site, there are big dips in time to 5-10-15 seconds. This greatly affects the average access time. These failures occur due to temporary network problems not necessarily on the site itself. This also needs to be taken into account when analyzing the obtained data.

In any case, you need to approach the analysis of the site monitoring data. In most cases, not the values ​​themselves are important, but the general trends of their changes in comparison with other hosts. Consider it. I have it all.


  1. Excelente artigo, me ajudou muito. Travei num etapa de pegar o response de um step do Web Scenario. Tenho response seguinte:

    “access_token”: “kjskjdHJKHj7678678678d67a8s6d767678s6a8das”,
    “token_type”: “Bearer”,
    “expires_in”: 3599,
    “scope”: “resource.READ resource.WRITE”

    Preciso recuperar o access_token para usar no próximo step, porém não tenho sucesso, eu estou usando regex, conforme orienta a documentação, mas sem sucesso.

    Eu estou setando a variavel como {token} e o valor dela como: regex:[A-Za-z-0-9]{54} para eu pegar o valor de access_token do response e ele não interpreta meu regex, pelo q estou vendo, não é erro de expressão, ele simplesmente não interpreta

  2. Sensacional, Fenomenal.. PERFEITO!!!

  3. That is the best tutorial of how to setup web monitoring on Zabbix i could find. Thanks for sharing, it works perfectly!

  4. Idham Hafidz Ismail Ismail

    Its hard to find a tutorial that also teach how to retrieve the token as well

  5. Very nice article, thank you!

  6. excellent explanation. i was struggling in configuring triggers . thank you.
    can you even explain mail server configuration and triggers link to mail settings.

  7. Best Zabbix Web Scenario Tutorial. Thanks

  8. Thank you so much, your post really helped me to solve a problem.

Leave a Reply

Your email address will not be published.

Нажимая кнопку "Отправить комментарий" Я даю согласие на обработку персональных данных.