Professional Documents
Culture Documents
Zabbix 5 IT Infrastructure Monitoring Cookbook11-20
Zabbix 5 IT Infrastructure Monitoring Cookbook11-20
ii Table of Contents
3
Working with Triggers and Alerts
Technical requirements 88 How it works… 104
Setting up triggers 88 There's more… 105
||||||||||||||||||||
||||||||||||||||||||
4
Building Your Own Structured Templates
Technical requirements 114 Getting ready 125
Creating your Zabbix template 114 How to do it… 126
How it works… 126
Getting ready 114
How to do it… 114 Setting up different kinds of
How it works… 116 macros127
There's more… 117 Getting ready 127
Setting up template How to do it… 127
applications118 How it works… 129
There's more… 131
Getting ready 118
How to do it… 118 Using LLD on templates 131
How it works… 119
Getting ready 131
See also 121
How to do it… 131
Creating template items 121 How it works… 137
See also 140
Getting ready 121
How to do it… 121 Nesting Zabbix templates 140
How it works… 125
Getting ready 140
See also 125
How to do it… 141
Creating template triggers 125 How it works… 143
5
Visualizing Data, Inventory, and Reporting
Technical requirements 146 How it works… 161
Creating graphs for accessing Creating dashboards for getting
visual data 146 the right overview 162
Getting ready 146
Getting ready 162
How to do it… 147
How to do it… 162
How it works… 153
How it works… 167
Creating maps to keep an eye Setting up Zabbix inventory 167
on infrastructure 153
Getting ready 168
Getting ready 154
How to do it… 168
How to do it… 154
How it works… 169
||||||||||||||||||||
||||||||||||||||||||
iv Table of Contents
6
Using Discovery for Automatic Creation
Technical requirements 176 Getting ready 187
Setting up Zabbix Agent How to do it… 187
discovery176 How it works… 192
Getting ready 176 There's more… 193
How to do it… 176 Using the new Windows
How it works… 181 performance counter discovery 193
There's more… 181
Getting ready 193
Setting up Zabbix SNMP How to do it… 194
discovery182 How it works… 198
Getting ready 182 Discovering JMX objects 199
How to do it… 182
Getting ready 199
How it works… 186
How to do it… 200
Working with Active agent How it works… 202
autoregistration187 There's more… 203
7
Setting Up Zabbix Proxies
Technical requirements 206 Working with active Zabbix
Setting up a Zabbix proxy 206 proxies212
Getting ready 206 Getting ready 212
How to do it… 206 How to do it… 212
How it works… 208 How it works… 214
There's more… 209
Monitoring hosts with Zabbix
Working with passive Zabbix proxy215
proxies209 Getting ready 215
Getting ready 209 How to do it… 215
How to do it… 210 How it works… 217
How it works… 211 There's more… 219
See also 219
||||||||||||||||||||
||||||||||||||||||||
Table of Contents v
8
Integrating Zabbix with External Services
Technical requirements 232 Using Telegram bots with
Setting up Slack alerting with Zabbix251
Zabbix232 Getting ready 251
Getting ready 232 How to do it… 252
How to do it… 232 How it works… 261
How it works… 242 There's more… 262
See also 243 See also 262
9
Extending Zabbix Functionality with Custom Scripts and the
Zabbix API
Technical requirements 274 Building a jumphost using the
Using the Zabbix API for Zabbix API and Python 282
extending functionality 274 Getting ready 282
Getting ready 274 How to do it… 283
How to do it 275 How it works 289
How it works 280 See also 291
See also 282
||||||||||||||||||||
||||||||||||||||||||
vi Table of Contents
10
Maintaining Your Zabbix Setup
Technical requirements 308 Upgrading a Zabbix database
Setting Zabbix maintenance from older MariaDB versions to
periods308 MariaDB 10.5 318
Getting ready 308 Getting ready 318
How to do it… 308 How to do it 319
How it works 311 How it works 321
Backing up your Zabbix setup 311 Upgrading your Zabbix setup 321
Getting ready 311 Getting ready 322
How to do it 312 How to do it 322
How it works 315 How it works 328
There's more 315 See also 329
11
Advanced Zabbix Database Management
Technical requirements 340 See also 350
Setting up MySQL partitioning Using the new PostgreSQL
for your Zabbix database 340 TimescaleDB functionality 350
Getting ready 340
Getting ready 350
How to do it… 340
How to do it… 350
How it works… 348
||||||||||||||||||||
||||||||||||||||||||
12
Bringing Zabbix to the Cloud with Zabbix Cloud Integration
Technical requirements 370 How to do it… 378
Setting up AWS monitoring 370 How it works… 382
There's more… 383
Getting ready 370
How to do it… 371 Building your Zabbix Docker
How it works… 376 monitoring383
There's more… 378 Getting ready 383
Setting up Microsoft Azure How to do it… 383
monitoring378 How it works… 385
There's more… 385
Getting ready 378
||||||||||||||||||||
||||||||||||||||||||
||||||||||||||||||||
||||||||||||||||||||
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.
||||||||||||||||||||
||||||||||||||||||||
x Preface
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.
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.
||||||||||||||||||||
||||||||||||||||||||
Preface xi
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
||||||||||||||||||||