Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Zabbix 5 IT Infrastructure Monitoring Cookbook

You're reading from   Zabbix 5 IT Infrastructure Monitoring Cookbook Explore the new features of Zabbix 5 for designing, building, and maintaining your Zabbix setup

Arrow left icon
Product type Paperback
Published in Feb 2021
Publisher Packt
ISBN-13 9781800202238
Length 428 pages
Edition 1st Edition
Tools
Concepts
Arrow right icon
Authors (2):
Arrow left icon
Brian van Baekel Brian van Baekel
Author Profile Icon Brian van Baekel
Brian van Baekel
Nathan Liefting Nathan Liefting
Author Profile Icon Nathan Liefting
Nathan Liefting
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Chapter 1: Getting Started with Zabbix and User Management 2. Chapter 2: Setting Up Zabbix Monitoring FREE CHAPTER 3. Chapter 3: Working with Triggers and Alerts 4. Chapter 4: Building Your Own Structured Templates 5. Chapter 5: Visualizing Data, Inventory, and Reporting 6. Chapter 6: Using Discovery for Automatic Creation 7. Chapter 7: Setting Up Zabbix Proxies 8. Chapter 8: Integrating Zabbix with External Services 9. Chapter 9: Extending Zabbix Functionality with Custom Scripts and the Zabbix API 10. Chapter 10: Maintaining Your Zabbix Setup 11. Chapter 11: Advanced Zabbix Database Management 12. Chapter 12: Bringing Zabbix to the Cloud with Zabbix Cloud Integration 13. Other Books You May Enjoy

Setting up HTTP agent monitoring

With the Zabbix HTTP agent, we can monitor a web page or API by retrieving data from it. For instance, if there's a counter on a web page and we want to keep an eye on that counter value, we can do so with Zabbix HTTP monitor.

Getting ready

We are going to need a web page to monitor and we will need our Zabbix server. For your convenience, we've added a page to our own website to retrieve a value from. Here's the page: https://oicts.com/book-page/.

Please also note that your Zabbix server will need an active internet connection for this recipe.

How to do it…

Let's poll this special web page we've created for you for the visitor count that's currently configured on it. This is a real counter for the number of times (unique) visitors have opened the URL:

  1. Navigate to your Zabbix frontend and navigate to Configuration | Hosts, then click the host called lar-book-agent_simple. Now go to Items; we want to create a new item here by clicking the Create item button. Now we are going to need to create an HTTP agent item as shown in the following screenshot:
    Figure 2.44 – Zabbix Item configuration page, visitor count on oicts.com page

    Figure 2.44 – Zabbix Item configuration page, visitor count on oicts.com page

    Use the following preprocessing steps:

    Figure 2.45 – Zabbix Item preprocessing page

    Figure 2.45 – Zabbix Item preprocessing page

  2. Now navigate to Monitoring | Hosts and open the Latest data page for our lar-book-agent_simple host. If everything is working as it should, we should now be requesting this page's visitor count every 15 minutes as follows:
Figure 2.46 – Zabbix Latest data page

Figure 2.46 – Zabbix Latest data page

How it works…

What we do here is request the complete web page from Zabbix by navigating to the page with the HTTP agent and downloading it. When we have the complete content of the page, in this case, an HTML/PHP page, we can process the data:

Figure 2.47 – Diagram showing Zabbix HTTP agent communication

Figure 2.47 – Diagram showing Zabbix HTTP agent communication

We ask our preprocessor via a regex to go through the requested code and only show the number behind where it says Total Page Visits:.

All that's left is the number, ready for us to use in graphs and other types of data visualization.

You have been reading a chapter from
Zabbix 5 IT Infrastructure Monitoring Cookbook
Published in: Feb 2021
Publisher: Packt
ISBN-13: 9781800202238
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image