Zabbix 5 IT Infrastructure Monitoring Cookbook - Nathan Liefting - E-Book

Zabbix 5 IT Infrastructure Monitoring Cookbook E-Book

Nathan Liefting

0,0
34,79 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Zabbix offers useful insights into your infrastructure performance and issues and enables you to enhance your monitoring setup with its variety of powerful features. This book covers hands-on, easy-to-follow recipes for using Zabbix 5 for effectively monitoring the performance of devices and applications over networks.
The book starts by guiding you through the installation of Zabbix and using the Zabbix frontend. You'll then work your way through the most prominent features of Zabbix and make the right design choices for building a scalable and easily manageable environment. The book contains recipes for building items and triggers for different types of monitoring, building templates, and using Zabbix proxies. As you advance, you’ll learn how to use the Zabbix API for customization and manage your Zabbix server and database efficiently. Finally, you'll find quick solutions to the common and not-so-common problems that you may encounter in your everyday Zabbix monitoring work.
By the end of this Zabbix book, you’ll have learned how to use Zabbix for all your monitoring needs and be able to build a solid Zabbix setup by leveraging its key functionalities.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 323

Veröffentlichungsjahr: 2021

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Zabbix 5 IT Infrastructure Monitoring Cookbook

Explore the new features of Zabbix 5 for designing, building, and maintaining your Zabbix setup

Nathan Liefting

Brian van Baekel

BIRMINGHAM—MUMBAI

Zabbix 5 IT Infrastructure Monitoring Cookbook

Copyright © 2021 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author(s), nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Group Product Manager: Wilson D'souza

Publishing Product Manager: Rahul Nair

Senior Editor: Arun Nadar

Content Development Editor: Pratik Andrade

Technical Editor: Nithik Cheruvakodan

Copy Editor: Safis Editing

Project Coordinator: Neil Dmello

Proofreader: Safis Editing

Indexer: Priyanka Dhadke

Production Designer: Roshan Kawale

First published: January 2021

Production reference: 2220221

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham

B3 2PB, UK.

ISBN 978-1-80020-223-8

www.packt.com

To my grandparents, for supporting my education, my brother, for always being at the ready, and my mom and stepdad, for cheering me on. To my girlfriend, for always supporting whatever new idea I get into my head. To my colleagues throughout the years, my first mentor, Sander F., for inspiring me, and Brian, for making it all possible.

– Nathan Liefting

Packt.com

Subscribe to our online digital library for full access to over 7,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.

Why subscribe?

Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionalsImprove your learning with Skill Plans built especially for youGet a free eBook or video every monthFully searchable for easy access to vital informationCopy and paste, print, and bookmark content

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.

At www.packt.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.

Foreword

2020 was probably for most of us not the most typical year. There was the Covid-19 issue that stopped the world as we know it. To make things worse, I had to deal with some personal and family issues last year, so writing a new book was not top of the list of things I wanted to do in 2020. So, when Packt asked me to write a successor to the Zabbix Cookbook, I had to decline.

Of course, I didn't want to let the book be written by someone I didn't believe in, and Packt asked me if I knew someone who was willing and able to write the book.

My first thoughts went to Brian, who I have worked closely with over the years and who I think I can call a friend. I focus on the Belgian market, while Brian focuses on the Dutch and the US markets, but we both speak the same language. Being certified Zabbix trainers, speaking the same language helps a lot when we run into unknown issues when we give training or do some work for a client.

Brian became a certified trainer a few years after me but has grown quickly in a short time and is very dedicated to the job. A few years ago, Brian was even bold enough to start his own business, with the main focus on Zabbix. Last year, when most businesses had to downsize or went broke, Brian managed to even hire someone to expand his company. This is where Nathan came into the picture. Nathan already had some experience with Zabbix, of course, but he managed to work on the book and also became a certified Zabbix trainer in probably one of the most economically difficult years in recent history. So, I think I can say that I am certain this book has been worked on by the best people for the job. I know that Brian and Nathan have spent lots of time on this book in the last year, and I know they are dedicated and knowledgeable. I hope you like what they did with this book, and I hope it will help you with your first steps in setting up and running Zabbix.

Good luck, and thank you Brian and Nathan.

Patrik Uytterhoeven

Open Source Consultant / Zabbix trainer at Open-Future, Nossegem Belgium

Contributors

About the authors

Nathan Liefting, also known as Larcorba, is an IT consultant, trainer, and content creator (artist). He has more than 6 years of professional experience in IT. His experience ranges from managing networks running EVPN/VXLAN to Linux environments and programming. Nathan started working with Zabbix in 2016, when it was still at Zabbix 2 and Zabbix 3 was just released.

He now works for Opensource ICT Solutions BV in the Netherlands as a Zabbix trainer and consultant, designing and building professional Zabbix environments and Zabbix components for some of the biggest companies around the world.

Brian van Baekel quickly discovered how powerful Zabbix is during his career as a network engineer. Ever since, he has been working with Zabbix in various (large) environments, leading to his official Zabbix Certified Trainer certification in early 2017.

In 2018, Brian founded Opensource ICT Solutions BV in the Netherlands and Opensource ICT Solutions LLC in the USA. Both companies primarily focus on building Zabbix environments all over the world. Fun fact: even his cat is named "Zabbix."

About the reviewers

James Cook is a seasoned IT engineer from Perth, Western Australia, specializing in systems administration, monitoring, automation, and programming. He currently works for a large-scale managed service provider (Kinetic IT Pty. Ltd.) leading a team of colleagues who specialize in developing monitoring and automation solutions for both on-premise and cloud technologies. His latest work has focused on developing a Zabbix monitoring solution for his employer's clients that is scalable, catering for multiple tenants, along with developing integration that provides automated service restoration and incident management. James is an experienced programmer, competent in several languages, including C, Python, Ruby, and Perl. He uses these to automate and integrate different products while making the pain of manual tasks disappear.

Justin Addams was born and raised in Western Australia. He is a highly skilled IT professional with over 10 years of industry experience. Most of the time you can find him monitoring systems or automating some inane task out of existence to save someone's sanity. He holds both the Zabbix Certified Specialist and Professional certifications. This, in combination with working a wide array of positions, from small business IT services to infrastructure support to enterprise management systems development, has led to a solid skillset in supporting business requirements through monitoring and automation.

I would like to thank the light of my life, my wife.

Packt is searching for authors like you

If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.

Table of Contents

Preface

Chapter 1: Getting Started with Zabbix and User Management

Technical requirements

Installing the Zabbix server

Getting ready

How to do it…

How it works…

Setting up the Zabbix frontend

Getting ready

How to do it…

How it works…

Using the Zabbix frontend

Getting ready

How to do it…

Navigating the frontend

Getting ready

How to do it…

Creating user groups

Getting ready

How to do it…

Creating your first users

Getting ready

How to do it…

Advanced user authentication with SAML

Getting ready

How to do it…

How it works…

There's more…

Chapter 2: Setting Up Zabbix Monitoring

Technical requirements

Setting up Zabbix agent 2 monitoring

Getting ready

How to do it

How it works…

See also

Working with SNMP monitoring

Getting ready

How to do it…

How it works…

Creating Zabbix simple checks and the Zabbix trapper

Getting ready

How to do it…

How it works…

Working with calculated and dependent items

Getting ready

How to do it…

How it works…

Creating external checks

Getting ready

How to do it…

How it works…

Setting up JMX monitoring

Getting ready

How to do it…

How it works…

See also

Setting up database monitoring

Getting ready

How to do it…

How it works…

There's more…

Setting up HTTP agent monitoring

Getting ready

How to do it…

How it works…

Using Zabbix preprocessing to alter item values

Getting started

How to do it…

How it works…

See also

Chapter 3: Working with Triggers and Alerts

Technical requirements

Setting up triggers

Getting ready

How to do it…

How it works…

There's more…

See also

Setting up alerts

Getting ready

How to do it…

How it works…

There's more…

Keeping alerts effective

Getting ready

How to do it…

How it works…

There's more…

Customizing alerts

Getting ready

How to do it…

How it works…

Chapter 4: Building Your Own Structured Templates

Technical requirements

Creating your Zabbix template

Getting ready

How to do it…

How it works…

There's more…

Setting up template applications

Getting ready

How to do it…

How it works…

See also

Creating template items

Getting ready

How to do it…

How it works…

See also

Creating template triggers

Getting ready

How to do it…

How it works…

Setting up different kinds of macros

Getting ready

How to do it…

How it works…

There's more…

Using LLD on templates

Getting ready

How to do it…

How it works…

See also

Nesting Zabbix templates

Getting ready

How to do it…

How it works…

Chapter 5: Visualizing Data, Inventory, and Reporting

Technical requirements

Creating graphs for accessing visual data

Getting ready

How to do it…

How it works…

Creating maps to keep an eye on infrastructure

Getting ready

How to do it…

How it works…

Creating dashboards for getting the right overview

Getting ready

How to do it…

How it works…

Setting up Zabbix inventory

Getting ready

How to do it…

How it works…

Working through Zabbix reporting

Getting ready

How to do it…

Chapter 6: Using Discovery for Automatic Creation

Technical requirements

Setting up Zabbix Agent discovery

Getting ready

How to do it…

How it works…

There's more…

Setting up Zabbix SNMP discovery

Getting ready

How to do it…

How it works…

Working with Active agent autoregistration

Getting ready

How to do it…

How it works…

There's more…

Using the new Windows performance counter discovery

Getting ready

How to do it…

How it works…

Discovering JMX objects

Getting ready

How to do it…

How it works…

There's more…

Chapter 7: Setting Up Zabbix Proxies

Technical requirements

Setting up a Zabbix proxy

Getting ready

How to do it…

How it works…

There's more…

Working with passive Zabbix proxies

Getting ready

How to do it…

How it works…

Working with active Zabbix proxies

Getting ready

How to do it…

How it works…

Monitoring hosts with Zabbix proxy

Getting ready

How to do it…

How it works…

There's more…

See also

Using Discovery with Zabbix proxies

Getting ready

How to do it…

How it works…

Monitoring your Zabbix proxies

Getting ready

How to do it…

How it works…

Chapter 8: Integrating Zabbix with External Services

Technical requirements

Setting up Slack alerting with Zabbix

Getting ready

How to do it…

How it works…

See also

Setting up Microsoft Teams alerting with Zabbix

Getting ready

How to do it…

How it works…

See also

Using Telegram bots with Zabbix

Getting ready

How to do it…

How it works…

There's more…

See also

Integrating Atlassian Opsgenie with Zabbix

Getting ready

How to do it…

How it works…

There's more…

Chapter 9: Extending Zabbix Functionality with Custom Scripts and the Zabbix API

Technical requirements

Using the Zabbix API for extending functionality

Getting ready

How to do it

How it works

See also

Building a jumphost using the Zabbix API and Python

Getting ready

How to do it…

How it works

See also

Creating maintenance periods as a Zabbix User

Getting ready

How to do it

How it works

See also

Enabling and disabling a host from Zabbix maps

Getting ready

How to do it

How it works

See also

Chapter 10: Maintaining Your Zabbix Setup

Technical requirements

Setting Zabbix maintenance periods

Getting ready

How to do it…

How it works

Backing up your Zabbix setup

Getting ready

How to do it

How it works

There's more

Upgrading the Zabbix backend from older PHP versions to PHP 7.2 or higher

Getting ready

How to do it

How it works

Upgrading a Zabbix database from older MariaDB versions to MariaDB 10.5

Getting ready

How to do it

How it works

Upgrading your Zabbix setup

Getting ready

How to do it

Ubuntu 16.04

How it works

See also

Maintaining Zabbix performance over time

Getting ready

How to do it

How it works

There's more

Chapter 11: Advanced Zabbix Database Management

Technical requirements

Setting up MySQL partitioning for your Zabbix database

Getting ready

How to do it…

How it works…

See also

Getting ready

How to do it…

How it works…

See also

Securing your Zabbix MySQL database

Getting ready

How to do it…

How it works…

Chapter 12: Bringing Zabbix to the Cloud with Zabbix Cloud Integration

Technical requirements

Setting up AWS monitoring

Getting ready

How to do it…

How it works…

There's more…

Setting up Microsoft Azure monitoring

Getting ready

How to do it…

How it works…

There's more…

Building your Zabbix Docker monitoring

Getting ready

How to do it…

How it works…

There's more…

Other Books You May Enjoy

Leave a review - let other readers know what you think

Preface

Welcome to Zabbix 5, IT Infrastructure Monitoring Cookbook. IT infrastructure ranges from Windows and Linux to networking and development, and basically anything that runs on computer hardware. In this book, we will go over various subjects useful to anyone in IT that wants to use Zabbix to monitor their IT infrastructure.

Who this book is for

Monitoring systems are often overlooked within IT organizations, but they can provide an overview that will save you time, money, and headaches. This book is for IT engineers that want to learn something about Zabbix 5 and how to use it to bring their IT environments to the next level.

What this book covers

Chapter 1, Getting Started with Zabbix and User Management, covers how to set up Zabbix, work your way through its menus, and create your first users.

Chapter 2, Setting Up Zabbix Monitoring, covers how to set up almost any type of monitoring within Zabbix.

Chapter 3, Working with Triggers and Alerts, covers how to set up triggers and get alerts from them.

Chapter 4, Building Your Own Structured Templates, covers how to build templates that are structured and will work wonders for keeping your Zabbix setup organized.

Chapter 5, Visualizing Data, Inventory, and Reporting, covers how to visualize data in graphs, maps, and dashboards. It also covers how to use the Zabbix inventory and reporting functionality.

Chapter 6, Using Discovery for Automatic Creation, covers how to use Zabbix discovery for automatic host creation as well as items, triggers, and more with agents, SNMP, WMI, and JMX.

Chapter 7, Setting Up Zabbix Proxies, teaches how to set up Zabbix proxies correctly for use in a production environment.

Chapter 8, Integrating Zabbix with External Services, teaches how to integrate Zabbix with external services for alerting.

Chapter 9, Extending Zabbix Functionality with Custom Scripts and API, covers how to extend Zabbix functionality by using custom scripts and the Zabbix API.

Chapter 10, Maintaining Your Zabbix Setup, covers how to maintain a Zabbix setup and keep its performance up over time.

Chapter 11, Advanced Zabbix Database Management, teaches how to manage Zabbix databases for an advanced setup.

Chapter 12, Bringing Zabbix to the Cloud with Zabbix Cloud Integration, covers how to use Zabbix in the cloud with services such as AWS, Azure, Docker, and Kubernetes.

To get the most out of this book

You should have a good basis in IT to understand the terminology used in this book. This book is best for people with at least a starting knowledge about monitoring systems, Linux, and network engineering.

Make sure you have a virtualization environment ready to create virtual machines for use with the recipes. VirtualBox, VMware, or any type of client/hypervisor will do.

If you are using the digital version of this book, we advise you to type the code yourself or access the code via the GitHub repository (link available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Zabbix-5-Network-Monitoring-Cookbook. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: http://www.packtpub.com/sites/default/files/downloads/9781800202238_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "It's important to back up all of our Zabbix configuration data, which is located in /etc/zabbix/."

A block of code is set as follows:

# MariaDB Server

# To use a different major version of the server, or to pin to a specific minor version, change URI below.

deb [arch=amd64] http://downloads.mariadb.com/MariaDB/mariadb-10.5/repo/ubuntu xenial main

Any command-line input or output is written as follows:

systemctl start mariadb

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this: "Then we navigate to Monitoring | Hosts and click on Latest data for the Zabbix server host."

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.

Whether you are a real Zabbix guru or if you've just started working with Zabbix, this book will include some recipes for everyone. We are going over most of the Zabbix basics and we are even doing some cool stuff with the Zabbix API in the book.

We decided to write this book because we want to supply you with the Zabbix information available online and in official Zabbix training in a clear and straightforward way. We've all been through the process of bookmarking all these amazing community blog posts, community guides, and even official documentation. Sometimes it can be a bit much, which is where this book will help. See it as a guide with something for everyone without the need to Google until your fingers fall off.

Now, even if you are experienced, or have finished this and maybe other books and you've bookmarked every useful page about Zabbix, you might still not know everything. This is where we come in. Zabbix is a free product built on an amazing open source community, but besides that, there are some real Zabbix gurus out there that have decided to make a living out of it. Our company, Opensource ICT Solutions, comes from these humble beginnings and we are there to provide our customers with everything they need when it comes to Zabbix. As a Premium Zabbix partner, we provide the following services:

Official Zabbix trainingOfficial Zabbix supportZabbix consultancyHelpdesk services

So, if you've enjoyed this book, please do think about us and others in our amazing Zabbix community. Give us a follow on LinkedIn (and other social media) and if you ever need help, give us a call! We will definitely be ready to help you out with any questions you might run into.

Brian van Baekel – Founder of Opensource ICT Solutions

WEB: https://oicts.com

EMAIL ADDRESS: [email protected]

PHONE: +1-929-377-1253 or +31(0)72 743 65 83

Chapter 1: Getting Started with Zabbix and User Management

There have been quite a few changes to the Zabbix UI since 4.4 and earlier in this Zabbix 5 release. This book has been written completely with Zabbix 5, but while reading, you'll find some information detailing the differences between 4 and 5.

In this chapter, we will install the Zabbix server and explore the Zabbix UI to get you familiar with it. We will go over finding your hosts, triggers, dashboards, and more to make sure you feel confident diving into the deeper material later on in this book. The Zabbix UI has a lot of options to explore, so if you are just getting started, don't get overwhelmed. It's quite structurally built actually and once you get the hang of it, I am confident you will find your way without issues.

We will also work on creating our first user groups, users, and some advanced user authentication as a bonus. This way, we will make sure we have a structured Zabbix setup before continuing on with this book. You will learn all about these subjects in the following recipes:

Installing the Zabbix serverSetting up the Zabbix frontendUsing the Zabbix frontendNavigating the Zabbix frontendCreating user groupsCreating your first usersAdvanced user authentication with SAML

Technical requirements

We'll be starting this chapter with an empty Linux (virtual) machine. Feel free to choose a RHEL or Debian based Linux distribution. We will then setup a Zabbix server from scratch on this host.

So before jumping in make sure you have your Linux host at the ready.

Installing the Zabbix server

Before doing anything within Zabbix, we need to install it and get ready to start working with it. In this recipe, we are going to discover how to install Zabbix server 5.

Getting ready

Before we actually install the Zabbix server, we are going to need to fulfill some prerequisite requirements. We will be using MariaDB mostly throughout this book. MariaDB is popular and a lot of information is available on the use of it with Zabbix.

At this point, you should have a prepared Linux server in front of you running either an RHEL- or Debian-based distribution. I'll be installing CentOS 8 and Ubuntu 20 on my server; let's call them lar-book-centos and lar-book-ubuntu.

When you have your server ready, we can start the installation process.

How to do it…

Let's start by adding the Zabbix 5.0 repo to our system.

For RHEL-based systems, use the following:

rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm

dnf clean all

For Debian-based systems, use the following:

wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+focal_all.deb

dpkg -i zabbix-release_4.5-1+focal_all.deb

sudo apt update

Now that the repo is added, let's install MariaDB on our server.

For RHEL-based systems, use the following:

dnf install mariadb-server

systemctl enable mariadb

systemctl start mariadb

For Debian-based systems, use the following:

apt-get install mariadb-server

systemctl enable mariadb

systemctl start mariadb

After installing MariaDB, make sure to secure your installation with the following command:

sudo /usr/bin/mysql_secure_installation

Run through the secure installation setup and make sure to remember your password.Now, let's install our Zabbix server with MySQL support.

For RHEL-based systems, use the following:

dnf install zabbix-server-mysql

systemctl enable zabbix-server

systemctl start zabbix-server

For Debian-based systems, use the following:

apt-get install zabbix-server-mysql

systemctl enable zabbix-server

systemctl start zabbix-server

With the Zabbix server installed, we are ready to create our Zabbix database. Log in to MariaDB with the following:

sudo mysql -u root -p

Enter the password you set up during the secure installation and create the Zabbix database with the following:

create database zabbix character set utf8 collate utf8_bin;

create user zabbix@localhost identified by 'password';

grant all privileges on zabbix.* to zabbix@localhost;

flush privileges;

quit

Now we need to import our Zabbix database scheme to our newly created Zabbix database:

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u zabbix -p zabbix

Important note

At this point, it might look like you are stuck and the system is not responding. Do not worry though as it will just take a while to import the SQL scheme.

We are now done with the preparations at our MariaDB side and are ready to move on to the next step, which will be configuring the Zabbix server:

The Zabbix server is configured using the Zabbix server config file. This file is located in /etc/zabbix/. Let's open this file with our favorite editor; I'll be using Vim throughout the book:

vim /etc/zabbix/zabbix_server.conf

Now, edit the following lines in the file:

DBName=zabbix

DBPassword=password

Tip

Before starting the Zabbix server on a CentOS 8 machine, you should configure SELinux to allow the use of the Zabbix server. If this is a test machine, you can use a permissive stance for SELinux, but it might not be smart to use this in production.

All done; we are now ready to start our Zabbix server:

systemctl enable zabbix-server

systemctl start zabbix-server

Check whether everything is starting up as expected with the following:

systemctl status zabbix-server

Alternatively, monitor the log file, which provides a detailed description of the Zabbix startup process:

tail -f /var/log/zabbix/zabbix_server.log

How it works…

The Zabbix server is the main process for our Zabbix setup. It is responsible for our monitoring, problem alerting, and a lot of the other tasks described in this book. A complete Zabbix stack consists of at least the following:

A database (MySQL, PostgreSQL, or Oracle)A Zabbix serverApache or NGINX running the Zabbix frontend with PHP 7.2+

We can see the components and how they communicate with each other in the following figure:

Figure 1.1 – Zabbix setup communications diagram

We've just set up the Zabbix server and database; by running these two, we are basically ready to start monitoring. The Zabbix server communicates with the Zabbix database to write collected values to it.

There is still one problem though: we cannot configure our Zabbix server to do anything. For this, we are going to need our Zabbix frontend, which we'll set up in the next recipe.

Setting up the Zabbix frontend

The Zabbix frontend is the face of our server. It's where we will configure all of our hosts, templates, dashboard, maps, and everything else. Without it, we would be blind to what's going on on the server side, so let's set it up in this recipe.

Getting ready

We are going to set up the Zabbix frontend using Apache. Before starting with this recipe, make sure you are running the Zabbix server on a Linux distribution of your choice. I'll be using the lar-book-centos and lar-book-ubuntu hosts in these recipes to show the setup process on CentOS 8 and Ubuntu 20.

How to do it…

Let's start by installing PHP to our server with the following command.

For RHEL-based systems, use the following:

dnf install php

For Debian-based systems, use the following:

apt-get install php

Now that we have fulfilled our requirements, it is time for us to actually install the frontend. Issue the following command to get started.

For RHEL-based systems, use the following:

dnf install zabbix-web-mysql zabbix-apache-conf

For Debian-based systems, use the following:

apt-get install zabbix-frontend-php zabbix-apache-conf

Tip

Don't forget to allow ports 80 and 443 in your firewall if you are using one. Without this, you won't be able to connect to the frontend.

Restart the Zabbix components and make sure they start up when the server is booted with the following.

For RHEL-based systems, use the following:

systemctl enable httpd php-fpm

systemctl restart zabbix-server httpd php-fpm

For Debian-based systems, use the following:

systemctl enable apache2

systemctl restart zabbix-server apache2

We should now be able to navigate to our Zabbix frontend without any issues and start the final steps to set up the Zabbix frontend.Let's go to our browser and navigate to our server's IP. It should look like this:

http://<your_server_ip>/zabbix

We should now see the following web page:

Figure 1.2 – The Zabbix welcome screen

If you don't see this web page, it's possible you have missed some steps in the setup process. Retrace your steps and double-check your configuration files; even the smallest typo could prevent the web page from serving.

Let's continue by clicking Next step on this page, which will serve you with the next page:

Figure 1.3 – The Zabbix installation pre-requisites page

Every single option here should be showing OK now; if not, fix the mistake it's showing you. If everything is OK, you may proceed by clicking Next step again, which will take you to the next page:

Figure 1.4 – The Zabbix installation DB connection page

Here, we need to tell our Zabbix frontend where our MySQL database is located. Since we installed it on localhost, we just need to change the database name and fill in the password. This should make the Zabbix frontend able to communicate with the database. Let's proceed by clicking Next step again:

Figure 1.5 – The Zabbix installation server details page

Next up is the Zabbix server configuration. Make sure to name your server something useful or something cool. For example, I've set up a production server called Meeseeks because every time we got an alert, we could make Zabbix say "I'm Mr. Meeseeks look at me."Let's name our server and proceed to the next step:

Figure 1.6 – The Zabbix installation summary page

Verify your settings and proceed to click Next step one more time.

Figure 1.7 – The Zabbix installation finish page

You have successfully installed the Zabbix frontend. You may now press the Finish button and we can start using the frontend. You'll be served with a login page where you can use the following default credentials:

Username: Admin

Password: zabbix

How it works…

Now that we've installed our Zabbix frontend, our Zabbix setup is complete and we are ready to start working with it. Our Zabbix frontend will connect to our database to edit the configuration values of our setup, as we can see in the following figure:

Figure 1.8 – Zabbix setup communications diagram

The Zabbix frontend will also talk to our Zabbix server, but this is just to make sure the Zabbix server is up and running. Now that we know how to set up the Zabbix frontend, we can start using it. Let's check this out in the next recipe.

Using the Zabbix frontend

If this is your first time using Zabbix, congratulations on getting to the UI. If this is your first time using Zabbix 5.0, surprise, this is the new layout! We'll be going over some of the different elements that we can find in the Zabbix frontend so that during this book, you'll feel confident in finding everything you need.

Getting ready

To get started with the Zabbix UI, all we need to do is log in to the frontend. You will be served with the following page at the IP on which your server is running the Zabbix frontend:

Figure 1.9 – The Zabbix login screen

Make sure you log in to the Zabbix frontend with the default credentials:

Username: Admin

Password: zabbix

Tip

Just like in Linux, Zabbix is case-sensitive in most places. When entering your username, make sure to include the right cases; otherwise, you won't be able to log in!

How to do it…

After you log in, you'll be served with the default page, which is the default dashboard. This is what Zabbix has called Global view and it provides us with a nice overview of what's going on. We can completely customize this and all the other dashboards that Zabbix supplies, but it's a good idea to familiarize yourself with the default setup before building something new:

Figure 1.10 – The Global view dashboard

So, let's get started on getting to know this Zabbix 5.0 frontend by looking at the default dashboard. Please follow along in the frontend by clicking and checking out the content mentioned.

Zabbix uses dashboards and they are filled with widgets to show you the information. Let's go over the different widgets in the default dashboard and detail their information.

From left to right, let's start with the System information widget:

Figure 1.11 – The System information widget

This is the System information widget, which as you might have guessed details all the system information to you. This way, we can keep an eye on what's going on with our Zabbix server and see whether our Zabbix is even running. Let's go over the parameters:

Zabbix server is running: This details to us whether the Zabbix server backend is reachable, and we can see where it is reachable. In this case, the Zabbix frontend can reach the Zabbix server, and it is running on localhost:10051.Number of hosts: This parameter displays the number of hosts enabled (1), the number of hosts disabled (0), and the number of templates we have (144). It gives us a quick overview of our Zabbix server host information.Number of items: Here, we can see the details of our Zabbix server's items: in this case, enabled (106), disabled (0), and not supported (6). Number of triggers: This details the number of triggers to us. We can see how many are enabled (60) and disabled (0), as well as how many are in a problem state (0) and how many are in the ok state (60).Number of users (online): The first value details the total number of users. The second value details the numbers of users currently logged in to the Zabbix frontend.Required server performance, new values per second: Perhaps I'm introducing you to a completely new concept here, which is New Values Per Second, or NVPS. A Zabbix server receives or requests values through items and writes this to our MariaDB (or another database). The NVPS detailed here shows the estimated number of NVPS received by the Zabbix server. Keep a close eye on this as your Zabbix server grows; it's a good indicator to see how fast you should scale up.

Now, that's one of the most important widgets when it comes to your Zabbix server and it's a great one to keep on your main dashboard if you ask me. Let's move on to the next widget, Host availability:

Figure 1.12 – The Host availability widget

The Host availability widget is a quick overview widget showing you everything you want to know about your monitored host's availability status. In this widget, it shows whether the host is Available, Not Available, or Unknown. This way, you get a good overview of the availability of all the hosts you could be monitoring with your Zabbix server in a single widget.

On top of that, it also shows you how many hosts currently have a trigger in a certain state. There are several default severity in Zabbix:

DisasterHighAverageWarningInformationNot classified

We can fully customize the severity levels; for example, what severity levels we want to put on which triggers. So, if you are worried about the severities right now, don't be; we'll get to that later.

Tip

Customizing the severity levels can be very useful to your organization. We can customize the severity levels to match levels used throughout our company or even to match some of our other monitoring systems used.

The next widget is Local:

Figure 1.13 – The Local widget, indicating a time

It's a clock with the local Linux system time, need I say more? Let's move on to the Problems widget:

Figure 1.14 – One of the Problems widgets available

Now, this is an interesting widget that I use a lot. We see our current problems on this screen, so if we have our triggers set up correctly, we get valuable information here. A quick overview of how many hosts are having problems is one thing, but the Problems page also gives us more details about the problem:

Time: At what time this problem was noticed by the Zabbix server firstInfo: Details information about the problem.Host: What host this problem occurred on.Problem/Severity: What the problem is and how severe it is. The severity is shown in a color, in this case orange meaning Average.Duration: How long this has been a problem.Ack: Whether this problem has been acknowledged, and if you hover over Yes or No, it will show you the acknowledged details.Actions