Skip to header Skip to main navigation Skip to main content Skip to footer

Search form

Site branding

Home
What's up, home?

Main navigation

  • Home
  • Story mode
  • About
  • Features
  • Hardware list
  • Videos
  • GitHub (opens in new tab)
  • Daily AI generated stories (opens in new tab)

Part 79: Zabbix 7.0 takes website monitoring to new level

Breadcrumbs

Breadcrumb

  • Home
  • Part 79: Zabbix 7.0 takes website monitoring to new level

Main page content

By whatsuphome | 9:22 PM EEST, Sun May 26, 2024

TL;DR

Zabbix 7.0 adds a new Browser item type powered by Selenium that tests websites exactly as end-users see them, including screenshot capture. Setting it up requires a Selenium server and two lines in the Zabbix server config. The pre-built template makes
Camera with a Zabbix logo on it, illustrating it's taking screenshots of websites

Zabbix 7.0rc2 was released few days ago, and one of the most striking additions to it is the pre-built template for the new Selenium-based website monitoring. Of course I had to try it out.

Wait, new website monitoring?

Yep, Zabbix 7.0 comes with new Browser item type. It allows you to test any website by using Selenium, and it can even take & store screenshots to new Binary item type. Zabbix 7.0 does not bundle Selenium for you, but getting Selenium up and running is easy, just follow the instructions for your operating system.

Selenium runs a headless instance of Google Chrome, Firefox, or any other web browser, so your site gets tested exactly as the end-users would see it. This is fantastic, especially with the addition of the screenshots -- you'll get to see how your site did look like when some error situation happened.

Setting up Zabbix for Selenium

After you have your Selenium server up and running, connecting Zabbix to it is a breeze. Just add these two lines to your Zabbix server configuration file.

WebDriverURL=http://your.selenium.server:4444
StartBrowserPollers=1

... the lines are self-explanatory, but the WebDriverURL is the URL for your Selenium server and StartBrowserPollers tells how many simultaneous site checks could be going on.

Download the template

In case you upgraded your Zabbix to 7.0rc2 from some older version instead of fresh install, download the new Browser template from official Zabbix templates.

Setup your first new site check

In my case, I just added the new template for this blog site, I have a host whatsuphome.fi for it.

Website by Browser template

Next, went to that host macros, and changed the address:

website.domain macro

.... and that's really it to get started!

How does the default Selenium dashboard look like?

Here's how the default Selenium dashboard that's coming with the new template looks like. 

Dashboard

You'll get to see how long it took to load the page resources, how long it took for TLS handshakes, DNS lookups, many other metrics. And, you'll get to see the screenshots in a very intuitive way, much like a film roll.

Screenshots of checks

This is great! 

Under the hood

Under the hood, the new Browser item is very configurable. For its general parameters, it's much like any other Zabbix item type.

Browser item type

And if you look at the Script, you'll see that the default example script that's coming with template is actually very simple and easy to extend to your needs.

const Website = {
   params: {},
   setParams(params) {
       ['scheme', 'domain','width', 'height'].forEach(function (field) {
           if (typeof params !== 'object' || !params[field]) {
               throw new Error('Required param is not set: ' + field + '.');
           }
       });
       this.params = params;
   },
   getOptions(browser) {
       switch ((browser || '').trim().toLowerCase()) {
           case 'firefox':
               return Browser.firefoxOptions();
           case 'safari':
               return Browser.safariOptions();
           case 'edge':
               return Browser.edgeOptions();
           default:
               return Browser.chromeOptions();
       }
   },
   getPerformance() {
       const browser = new Browser(Website.getOptions(Website.params.browser));
       const url = Website.params.scheme + '://' + Website.params.domain + '/' + Website.params.path
       const screenshot = '';
       browser.setScreenSize(Number(Website.params.width), Number(Website.params.height))
       browser.navigate(url);
       browser.collectPerfEntries();
       screenshot = browser.getScreenshot();
       const result = browser.getResult();
       result.screenshot = screenshot;
       return JSON.stringify(result);
   }
};
try {
   Website.setParams(JSON.parse(value));
   return Website.getPerformance();
} catch (error) {
   error += (String(error).endsWith('.')) ? '' : '.';
   Zabbix.log(3, '[ Website get metrics] ERROR: ' + error);
   return JSON.stringify({ 'error': error });
}

Finally, after many years, we have a native, modern way for synthetic website monitoring in Zabbix. Oh man, Zabbix 7.0 is really shaping up to be one of the biggest Zabbix releases ever.

 

 

 

whatsuphome
zabbix
monitoring
syntheticmonitoring
selenium
browser
endusermonitoring
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
Zabbix 7.0 adds a new Browser item type powered by Selenium that tests websites exactly as end-users see them, including screenshot capture. Setting it up requires a Selenium server and two lines in the Zabbix server config. The pre-built template makes

Search

Who am I?

  • Janne Pikkarainen from Finland 🇫🇮
  • Began with computers in 1986 with C64
  • Doing IT for living since 1999
  • Principal Site Reliability Engineer at Forcepoint
  • A Zabbix Summit speaker every year since 2022
  • Walking, talking Zabbix commercial

Support my project

Buy me a coffee 

Footer menu

  • Contact

What's up, home? | Janne Pikkarainen | contact(at)whatsuphome.fi | 2022 - 2026

Developed and Designed by Janne Pikkarainen