souza
souza

Reputation: 1438

Zabbix - Trigger an email if a certain string is present in website

I've started to use Zabbix (version 4.0) some weeks ago with the intent of constantly monitoring my company's websites and applications. I easily made it monitor the response code and download time for some sits, and even check if some crucial strings are present on it. That means, in the steps of my web scenario, I've configured Zabbix to search for a string on the website and trigger an error email if the string isn't present.

What I have to do now, though, is the exact opposite: I have to configure Zabbix to trigger a string is present on the website.

For example: I have the website www.myprettyexample.com, monitored by Zabbix. If there's the string "Error detected!!" present in its HTML, Zabbix will trigger me an e-mail, warning about it somehow.

So, is this possible to accomplish? How? And if not, what could be the best workaround?

Upvotes: 0

Views: 2030

Answers (1)

Simone Zabberoni
Simone Zabberoni

Reputation: 2113

You could use the new http agent check.

Configure an item of http agent type on your Zabbix server with these settings:

  • key: choose a key name
  • url: www.myprettyexample.com/somepage.html
  • method: get
  • retrieve mode: body
  • type: text

This will capture the whole page and store it (keep the storage checked!), you can check the capture in the "Latest Data" page.

Then you can create a simple regexp trigger like {YourZabbix:YourKey.iregexp("Error detected")}=1.

While it works, it could be a waste of your storage: a better approach is to capture a json status page (if exists) of a specific status page with a small footprint.

Upvotes: 1

Related Questions