Professional Documents
Culture Documents
ZCS6 Day 2 Slides
ZCS6 Day 2 Slides
DAY 2
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved
COPYRIGHT NOTICE
Rules
It is prohibited to make any video and/or audio recordings during the whole period of this course.
This course is intended only for the officially enrolled student. Subject to the Copyright Notice below, the student is not allowed to
share his credentials for attending this course, to allow others to join and take part, or otherwise make use of these Materials.
Copyright notice
© Zabbix, 2022. All rights reserved.
Unless otherwise indicated, Zabbix owns the copyright and other intellectual property rights in the text, graphics, information,
designs, data, verbal/audio/video presentations and files, comments, drawings, exam questions and exam answers, and other
training content, lab manuals and practical tasks, and training courses themselves (further – Materials).
The Materials are protected by watermarks, copyright statements, and other means. It is prohibited to remove any of watermarks
and copyright statements, or in any other way to amend or change the content or appearance of the Materials.
Any unauthorized reprint, publication, reproduction, sharing, or use of the Materials is prohibited. No part of the Materials may be
reproduced, transmitted, or published in any form or by any means, electronic or mechanical, including photocopying, recording,
or by any information storage and retrieval system without the express signed written permission from Zabbix.
All course Materials made available to the student during the course of the training may be used solely by the student enrolled in
the relevant course for personal and educational purposes only. Materials provided to the student should be treated as
confidential information shared with the student only for the purpose of the student performing Zabbix Certified training.
The student acknowledges that damages alone would not be an adequate remedy for the breach of this copyright and the student
shall be entitled to the granting of equitable relief concerning any threatened or actual breach of any of the provisions of this
Copyright notice.
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 2
AGENDA
Zabbix agent Zabbix agent
User parameters
passive checks active checks
Human-readable
Update intervals Preprocessing
data
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 3
Zabbix agent passive checks
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 15 minutes 4
PASSIVE CHECKS
A passive check is a simple data request:
Zabbix server or proxy asks for a single metric
Zabbix agent gets the request and sends back the result
system.cpu.load = ?
0.57
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 5
FRONTEND SETTINGS
Settings for connecting to a passive agent are defined in Zabbix frontend:
Add one or multiple interfaces with the type "Agent" on a host
Specify IP address or DNS name of the target host
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 6
SERVER PARAMETER
Zabbix agent needs to be configured to accept requests from Zabbix server:
Server parameter must match Zabbix server or proxy address
Multiple IP addresses, IP address ranges or DNS names can be specified
Specifying 0.0.0.0/0 will accept connection from any address (very insecure setting!)
Agent will reject connection if the address of Zabbix server or proxy will not match
system.cpu.load = ?
IP=192.168.0.5 Server=127.0.0.1
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 7
AGENT PORT AND PROCESSES
Zabbix passive agent listens to port 10050 by default:
Different port can be specified using ListenPort parameter:
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 8
TIMEOUTS
Zabbix server/proxy and agent timeouts both have effect on passive checks:
Zabbix server timeout is the connection timeout
Zabbix agent timeout is the service timeout
system.sw.packages = ?
Timeout=4s Timeout=3s
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 9
ZABBIX GET UTILITY
Command line utility zabbix_get may be used to connect to a passive agent:
Can be used to troubleshoot agent availability or item keys
Can be used in custom scripts to collect the data
Utility is standalone and can be installed on any Linux/Windows workstation
Additional parameters can be displayed using zabbix_get --help command
The agent must accept connections from the machine executing zabbix_get
# zabbix_get -s prod-server.example.com -k agent.version
6.0.0
agent.version = ?
6.0.0
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 10
PRACTICAL SETUP
1) Create a new host
Host name: Training-VM-XX
Groups: Training/Servers
Interface: Type: Zabbix agent DNS: student-xx.zabbix.training
2) Create an item on the Training-VM-XX host with 10 seconds update interval:
CPU load
3) Create two items on the Training-VM-XX host with 1 minute update interval:
System uptime
Free memory size
4) Create an item on the Training-VM-XX host with one hour update interval
Total memory size
5) Force the data collection by pressing "Execute now"
Make sure that the items receive data
6) Install zabbix_get utility from official Zabbix repository
List installed Zabbix packages using zabbix_get utility
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 20 minutes Practical task No: 8 11
Zabbix agent active checks
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 20 minutes 12
ACTIVE CHECKS
In active mode, Zabbix agent initializes connection to Zabbix server or proxy:
Active agent requests configuration by sending its Hostname
Server responds with configuration (item keys and update intervals)
Agent collects metrics using received configuration and sends them back at regular intervals
hostname=Prod server
configuration = {....}
system.cpu.load = 0.75
net.if.in[eth0] = 143535
Data from active agents is accepted by the trapper process on port 10051:
Start more trappers on server or proxies if you have a lot of active agents
### Option: StartTrappers
# Number of pre-forked instances of trappers.
# Range: 0-1000
StartTrappers=5
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 13
FRONTEND SETTINGS
Settings for an active agent in Zabbix frontend:
Only Host name field is used to accept incoming requests from active agents
Visible name is not used!
None of the interfaces (even if defined) are used for active checks
Active agent does not have any interface in the item configuration
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 14
ACTIVE AGENT CONFIGURATION
The two most important parts in active agent configuration are:
Hostname The hostname must match hostname in Zabbix frontend
ServerActive IP address of Zabbix server or proxy
### Option: Hostname
# List of comma delimited unique, case sensitive hostnames.
# Required for active checks and must match hostnames as configured on the server.#
Hostname=Production server
Hostname=Production server
ServerActive=192.168.0.5 IP=192.168.0.5
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 15
SPECIFY THE HOSTNAME
There are three ways how to specify a hostname:
Hostname just write a hostname into the configuration file
If multiple hostnames are specified, the agent will send values to all hostnames defined here
### Option: Hostname
# List of comma delimited unique, case sensitive hostnames.
# Required for active checks and must match hostnames as configured on the server.#
Hostname=Production server
Comment out both options and use system hostname from the OS instead
The value of system.hostname item is used (without a domain name)
#Hostname=Production server
#HostnameItem=system.hostname
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 16
SERVER ACTIVE ADDRESSES
ServerActive specifies the addresses of Zabbix servers
Usually just one Zabbix server address is used
ServerActive=192.168.0.5
If more than one address is specified, the same Zabbix agent will report data to all Zabbix
servers listed here
ServerActive=10.10.10.5,192.168.0.5
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 17
ACTIVE CHECK PROCESSING
Active checks are processed by Zabbix agent and values are sent back:
Agent retrieves a list of items from Zabbix server for independent processing:
On agent start
Every 120 seconds when running (by default)
Zabbix agent in active mode collects all metrics immediately after start / restart
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 18
MEMORY BUFFER
Zabbix agent in active mode is storing collected values in a memory buffer:
SQLite can be used as a buffer for Zabbix Agent 2 (optionally)
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 19
AVAILABILITY ICON
Active checks do not have any availability icon:
Active agent does not use or require the agent interface!
No interface is defined
The availability icon will be gray if an interface is defined but not used by any passive item
Interface is defined but not used
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 20
PRACTICAL SETUP
1) Configure Zabbix agent for active checks
2) Full Clone the host "Training-VM-XX"
Host name: student-XX (training VMs hostname)
Visible name: Training-VM-XX active checks
3) Change the type of all items on this host to Zabbix agent (active)
4) Remove Zabbix agent host interface
5) Change the Hostname in Zabbix agent configuration file and restart agent
6) Make sure that the items receive data
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 20 minutes Practical task No: 9 21
Zabbix agent
troubleshooting
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 15 minutes 22
TYPICAL MISTAKES
Wrong Hostname defined in the agent configuration is a typical problem:
Metrics are collected, but sent to a different host configured in Zabbix frontend
Technically, the monitoring is working properly as configured
Default Hostname on new agent installations is "Zabbix server"!
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 23
TYPICAL MISTAKES
The host is not defined on Zabbix server at all:
Visible name field is not used for identification, only the Host name
Both Zabbix agent and server will complain about non existing hosts in the log files:
cannot send list of active checks to "192.168.1.5": host [Production server] not found
Hello, my hostname is
Sorry, I do not have
"Production server" and
any configuration for
I need monitoring
"Production server"
configuration
Configuration request
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 24
TYPICAL MISTAKES
The host is monitored by proxy, but Zabbix server address is used in
ServerActive:
When moving hosts between proxies, do not forget to change ServerActive
Multiple ServerActive entries are possible, but they will create a lot of errors in logs
Hello 10.10.10.1,
please send me Sorry, I am
monitoring not monitoring
configuration "Production server"
Configuration request
IP=10.10.10.5
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 25
TYPICAL MISTAKES
The same Zabbix server is specified multiple times in ServerActive
It is not possible to specify the same IP or DNS name twice, but:
IP and DNS may match the same host
Multiple DNS names may match the same host
Zabbix agent will think these are separate Zabbix instances
Zabbix will send the same configuration multiple times
Agent will send back metrics to each instance, which will result in duplicated values
Values are
duplicated
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 26
TIMESTAMP OF COLLECTED VALUE
Local UNIXTIME is used to timestamp all collected values:
Passive checks are timestamped by Zabbix server or proxy
agent.version = ?
Timestamp Value
6.0.0
1642318203 6.0.0
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 27
User parameters
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 15 minutes 28
USER PARAMETERS
UserParameter allows to run a check that does not come predefined with Zabbix:
Shell commands
Custom scripts
All commands are executed from the OS user which is used to run agent:
The user must have enough permissions to execute the command or script
The return value of the command is the standard output together with the standard error
UserParameter must be configured for every agent where they will be used:
Directly in zabbix_agentd.conf file
Included from zabbix_agentd.d directory (recommended)
### Option: UserParameter
# User-defined parameter to monitor. There can be several user-defined parameters.
#
UserParameter=mykey,echo 1
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 29
DEFINING USER PARAMETERS
More than one UserParameter can be defined per agent:
Multiple include files can be specified with different sets of parameters
All keys per agent must be unique or Zabbix agent will exit with the error message:
ERROR: cannot add user parameter "mysql.qps,mysqladmin status : key "mysql.qps" already exists
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 30
RELOAD LIST OF USER PARAMETERS
Zabbix agent will be able to use the new item key only after it is loaded into
configuration
# zabbix_agentd -R userparameter_reload
zabbix_agentd [1651700]: command sent successfully
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 31
USER PARAMETER SYNTAX
A user parameter has the following syntax: UserParameter=key,command
The key will be used by the item, any unique key name can be entered
The command will be executed when the key is requested
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 32
UNSAFE USER PARAMETERS
Certain symbols can not be passed as arguments by default:
\'"`*?[]{}~$!&;()<>|#@
Additionally, newline characters are not allowed
Can beUnsafeUserParameters
### Option: allowed by setting UnsafeUserParameters=1 in zabbix_agentd.conf file
# Allow all characters to be passed in arguments to user-defined parameters.
# The following characters and newline characters are not allowed:
# \ ' " ` * ? [ ] { } ~ $ ! & ; ( ) < > | # @
# Range: 0-1
UnsafeUserParameters=1
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 33
SLOW USER PARAMETERS
Slow UserParameters can delay other metric collection:
They will respect timeouts defined in the server and agent configuration
When used as a passive check:
Pollers will become busy waiting for new values, more pollers may be needed
More passive agent processes may be needed, because some will be utilized for long time
data missing
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 34
PRACTICAL SETUP
1) Add a simple user parameter:
Name: MySQL Uptime (simple)
Key: mysql.uptime.s
Command line: mysqladmin -uzabbix -pP455w0RD status 2>/dev/null | awk '{print $2}'
2) Restart Zabbix agent
3) Add a new item to Training-VM-XX host to monitor this user parameter
4) Add a flexible user parameter:
Name: MySQL Uptime (flexible)
Key: mysql.uptime.f[*]
Command line: mysqladmin -u$1 -p$2 status 2>/dev/null | awk '{print $$2}'
5) Add the user parameter to Zabbix agent without restarting it
6) Add a new item to Training-VM-XX host to monitor this user parameter
Use macros to specify the username
Use secret macro to specify the password
7) Make sure both items are receiving data
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 20 minutes Practical task No: 10 35
Human-readable data
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 15 minutes 36
UNITS
Unit symbols are used for a human-readable representation of data:
Can be used with numerical data only (unsigned / float)
If units are defined, K/M/G/T/P/E/Z/Y prefix fill be used
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 37
UNIT CONVERSION OPTIONS
Any unit can be prevented from being converted by using a ! prefix
Stored in database Units Displayed in frontend
5000 Hz 5 KHz
5000 !Hz 5000 Hz
614 s 10m 14s
614 !s 614s
1500 ms 1.5 Kms
1500 !ms 1500 ms
Try to store base units (bytes, seconds, etc.) to avoid strange results in the
frontend:
Data can be converted using preprocessing steps if needed (discussed later)
Stored in database Units Displayed in frontend
3200 MB 3.2 KMB
3200 !MB 3200 MB
3435972078 B 3.2 GB
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 38
VALUE MAPS
Value maps contain the mapping between raw values and string representations:
Used both by Zabbix frontend and notifications
Value maps are defined on the Host or Template level
Available value map can be specified in the item configuration form
Can be used with items having type of information:
Numeric (unsigned)
Numeric (float)
Character
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 39
VALUE MAP INHERITANCE
Value maps do not have inheritance from templates:
They can be defined on both template or host level
Linking a template to the host does not make the host inherit the value maps:
A local item on a host can use only the value map from the host
A templated item on a host will use the value map from the template
TEMPLATE HOST
! It is not possible to create a template with a value map and use it for host items!
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 40
APPLYING VALUE MAPS
Usually, multiple mappings are defined per value map:
Mapping is applied according to the order of mapping rules
If multiple mappings overlap, the first match will be applied
It is possible to reorder mappings by dragging
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 41
VALUE MAP OVERLAP
Multiple value mappings can overlap:
Mapping is applied according to the order of mapping rules (first match)
It is possible to reorder mappings by dragging
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 42
PRACTICAL SETUP
1) Add corresponding units to the items on Training-VM-XX host
System uptime s
Total memory size B
Free memory size B
MySQL uptime (use s or uptime units)
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 20 minutes Practical task No: 11 43
Update intervals
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 15 minutes 44
UPDATE INTERVAL
Retrieve a new value for this item every N seconds:
Minimum update interval is 1 second
Maximum allowed update interval is 1 day
Time suffixes are supported, e.g., 30s, 1m, 2h, 1d
A user macro can be used in this field
Defaults to seconds if a suffix is not used (600 = 10m)
Can be set to 0 (never checked) if a custom interval exists with a non-zero value
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 45
UPDATE INTERVAL
Update interval specifies the time between item checks:
All checks are distributed equally over time
This design is implemented to avoid data collection spikes
10 seconds 10 seconds
time
Incoming traffic 08:17:24 08:17:34 08:17:44 08:17:54
Outgoing traffic 08:17:30 08:17:40 08:17:50 08:18:00
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 46
FLEXIBLE INTERVALS
Flexible intervals allow to redefine the default update interval for specific time
periods:
Interval the update interval for the specified time period
Period the time period when the flexible interval is active
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 47
SCHEDULED INTERVALS
Scheduling intervals are used to additionally check items at specific times:
Independent checking schedule, which is executed in parallel to "Update interval" checks
If update interval is set to 0, only scheduled checks will be executed
Zabbix server time zone is used
Scheduled
check
10 seconds
time
06:59:34 06:59:44 06:59:54 07:00:04
07:00:00
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 48
SCHEDULED INTERVALS
A scheduling interval is defined as:
md<filter>wd<filter>h<filter>m<filter>s<filter>
md month days 1-31
wd week days 1-7
h hours 0-23
m minutes 0-59
s seconds 0-59
<filter> is defined as: [<from>[-<to>]][/<step>]
Examples:
wd1-5h9 - every Monday till Friday at 9:00
h9m/30;h10 - execute at 9:00, 9:30, 10:00
h9-10m10-40/30 - execute at 9:10, 9:40, 10:10, 10:40
md1wd1h9m30 - every 1st day of each month at 9:30 if it is Monday
! Massive use of scheduled items can cause big spikes on monitored environment!
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 49
CUSTOM INTERVALS
Custom intervals can be used:
For all passive checks
As active checks only for Zabbix agent 2
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 50
EXECUTE NOW
Pressing Execute now will perform an extra item check on demand:
The actual data collection may be slightly delayed (a few seconds) after pressing the button
The value will be collected and processed as usual
Will work locally or through active/passive proxies
Can be executed for multiple items at once
Active items (Zabbix agent active, trapper, etc.) cannot be forcibly executed
Status of the execution request will be reported (This does not mean successful execution!)
Execute
now
time
06:20:00 06:30:00 06:40:00 06:50:00
06:45:03
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 51
PRACTICAL SETUP
1) Define flexible update intervals for the CPU load item
Nighttime (00:00 - 06:00) once per minute
Weekends (Saturday, Sunday) once per 5 minutes
2) Create a new item to monitor swapped in pages with scheduled interval
Once per hour exactly at the beginning of the hour
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 10 minutes Practical task No: 12 52
Preprocessing
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 30 minutes 53
PREPROCESSING
Preprocessing allows to define transformation rules for the received item values:
One or several transformations are possible
Transformations are executed in the order in which they are defined
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 54
PREPROCESSING STEPS
Preprocessing steps are defined in a separate tab of the item configuration form:
The number of steps is displayed in the tab
The order of execution can be changed by dragging and dropping
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 55
CUSTOM ON FAIL
If a preprocessing step fails multiple scenarios are possible:
Error handling can be introduced using "custom on fail" scenarios
Otherwise, the item will become unsupported, and no more steps will be processed
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 56
PREPOCESSING INTERNALS
Every collected value goes through preprocessing queue:
Data are passed to preprocessing manager and placed into preprocessing queue
Preprocessing manager assigns tasks from the preprocessing queue to workers
Preprocessing workers are performing the preprocessing steps
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 57
Preprocessing steps
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 30 minutes 58
CUSTOM MULTIPLIER
Multiply the value by the specified integer or floating-point value:
User macro can be used to specify the multiplier
Scientific notation is supported (e.g. 1e+70)
24 * 0.125 = 3
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 59
SIMPLE CHANGE
Simple change calculates the difference between the current value and the
previous value:
Formula: value - previous value 135 - 80 = 55
Speed per second calculates the result based on the two values and time:
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 60
SPEED PER SECOND
The following Zabbix agent keys report back metrics as counters:
net.if.in, net.if.out, net.if.total
system.cpu.intr, system.cpu.switches
system.swap.in, system.swap.out
Many other data collectors (e.g. SNMP) can also report data as counters
Without change per second With change per second
preprocessing step preprocessing step
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 61
REGULAR EXPRESSIONS
Regular expression captures the matched text into a numbered group:
Zabbix supports PCRE (Perl Compatible Regular Expressions) format
Both PCRE and PCRE2 libraries are supported starting from Zabbix 6.0
Capturing
groups \0 = Mem: 1827 840 75 \1 = 1827 \2 = 840 \3 = 75
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 62
REGULAR EXPRESSIONS
In Zabbix frontend, two fields must be specified:
Pattern - regular expression
Output - capturing group Regex pattern Capturing group
Result can be
tested from
the frontend
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 63
DISCARD UNCHANGED
Discard unchanged
Time Values Discard unchanged Explanation
with heartbeat 30s
00:00 0 0 0
00:05 0 No value because same as previous
00:10 0
00:15 1 1 1 Received different value
00:20 1
00:25 1
00:30 1
00:35 1
00:40 0 0 0 Received different value
00:45 0
00:50 0
00:55 0
30s
01:00 0
01:05 0
01:10 0 0 Value written because of heartbeat 30s
01:15 0
01:20 1 1 1 Received different value
01:25 1
01:30 0 0 0 Received different value
01:35 0
01:40 0
30s
01:45 0
01:50 0
01:55 0
02:00 0 0 Value written because of heartbeat 30s
02:05 0
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 64
CHECK FOR NOT SUPPORTED VALUE
Check if there was an error in collecting item value:
Normally that would lead to the item turning unsupported
Modify that behaviour by specifying the "Custom on fail" error-handling options
This step is always executed as the first preprocessing step
Timeout 0 0
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 65
PREPROCESSING COURSES
Preprocessing steps are covered in other Zabbix courses:
Zabbix 6.0 Certified Professional course:
XML Xpath
JSONPath
Prometheus patterns
Conversion to JSON
i https://www.zabbix.com/training?language=english#training_courses
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 66
PRACTICAL SETUP
1) Create two new items on Training-VM-XX host to monitor network traffic:
Incoming network traffic
Outgoing network traffic
2) Assign preprocessing steps to the items:
Monitor speed per second
Convert bytes to bits
3) Check that items are reporting correct data
4) Update "swapped in pages" item to report pages per hour
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 15 minutes Practical task No: 13 67
Not supported items
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 10 minutes 68
NOT SUPPORTED ITEMS
Items may become "Not supported" under multiple scenarios:
On data collection time:
Wrong item key or parameters
Timeout, communication error
Wrong credentials or permission problems
Data collection errors can be corrected by "check for not supported value" preprocessing step
In preprocessing steps
Failed regular expression, XML Xpath or JSONPath, incorrect Prometheus pattern
Arithmetical operations with character data
If a step fails, no more steps will be processed
Use "custom on fail" options to override errors
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 69
NOT SUPPORTED ERROR CORRECTION
Error can be fixed with Error can be fixed with Error cannot be fixed
"Check for not supported "Custom on fail" option
item" preprocessing step
Unsupported item key Preprocessing step failed Cannot write char to integer
Timeout
Wrong password
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 70
NOT SUPPORTED ITEMS
Not supported items may degrade Zabbix performance:
Not supported items will be checked on every item update interval
Data collectors will be busy trying to collect nonworking items
Errors like timeouts may keep data collectors busy for significant time
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 71
Item testing
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 10 minutes 72
ITEM TESTING
Zabbix can test any passive item before creating it:
Item key and other required parameters must be entered correctly
Testing is performed by Zabbix server/proxy or agent same as in a real monitoring setup
A test can be executed before creating the item
Only testing of the item configuration will be performed, the result is not stored
Received value is not saved into the database
Problem detection is not performed with this value
Test request
Result
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 73
ITEM TESTING
Testing can be performed by pressing Test button on the Item configuration
form
The button will be grayed out for item types that cannot be tested (active checks, icmp
ping)
Test values can be entered manually or received from the host
Get value will only get a raw value
Get value and test will emulate writing the value to the database
Get value from host Enter value manually
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 74
PREPROCESSING TESTING
Preprocessing steps also can be tested:
Using values received from the host or entered manually (will be preserved)
For some preprocessing steps, two values are required
Tests are performed by Zabbix server and will match actual results
Final result
Click on error
for details
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 75
Triggers
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 30 minutes 76
TRIGGER DEFINITION
Triggers are logical expressions that "evaluate" data gathered by items:
Trigger expressions allow to define a threshold of what state of data is "not acceptable"
avg(/production server/system.cpu.load,5m)>2
If the incoming data surpass the acceptable state, a trigger changes status to PROBLEM
The expression may include a combination of multiple functions and multiple thresholds
Most trigger functions are evaluated based on history data
Some trigger functions for long-term analytics use trend data (trendavg(), trendcount(), etc.)
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 77
TRIGGER EXPRESSIONS
Trigger expressions have new syntax in Zabbix 6.0:
Expression uses a function that is applied to the item with some parameters
The function result is compared to the threshold, using an operator and a constant.
function(/host/key,<additional parameters>)<operator><constant>
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 78
CREATING TRIGGER
Triggers are created directly on a host or on a template (recommended):
Go to Configuration -> Hosts / Templates
Click on Triggers for selected Host / Template
Press Create trigger or click on an existing trigger name to update the configuration
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 79
TRIGGER NAME
Trigger name:
Trigger name is used to generate name of the Problem
If trigger name is changed, it will not affect already created problems
Not recommended to include host name or latest values in the trigger name, because:
Host name is already displayed in the Host field (sortable)
Latest values are already displayed in the Operational data field
Examples:
/etc/passwd has been changed
Getting closer to process limit (over 80% used)
Zabbix agent is not available (for 3m)
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 80
MACROS IN TRIGGER NAME
Using macros in the trigger name can create dynamic problem names:
Supported macros:
{HOST.HOST}, {HOST.NAME}
{HOST.DNS}, {HOST.IP}, {HOST.CONN}, {HOST.PORT}
{ITEM.VALUE}, {ITEM.LASTVALUE}, {ITEM.LOG*}
User macros {$MACRO}
Examples
Zabbix agent is not available for {$AGENT.TIMEOUT}
{HOST.NAME} has been restarted (uptime < {$MIN.HOST.UPTIME})
Duplicated
host name
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 81
EVENT NAME
Event name can redefine the problem name generated by a trigger:
By default, the event name is the same as the trigger name
Can be used to build detailed problem names containing aggregated data
The same set of macros is supported as in the trigger name, plus:
{TIME} Current time in hh:mm:ss format
{?EXPRESSION} Expression macros
Event name
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 82
EXPRESSION MACROS
Expression macros have the following syntax
{?expression}
{?avg(/Production server/system.cpu.load,1h)}
{?avg(//system.cpu.load,1h)}
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 83
MACRO FUNCTIONS
The output of the macro can be modified using macro function:
fmtnum (<digits>)
digits - the number of digits after decimal point
i https://www.zabbix.com/documentation/6.0/en/manual/config/macros/macro_functions
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 84
OPERATIONAL DATA
Operational data is used to display live values on the Problems page:
Macros in trigger name will resolve to values at the time of problem creation
Macros in the operational data will display the very latest information dynamically
The same set of macros is supported as in trigger name
If undefined, will display {ITEM.LASTVALUE} from all items used in expressions
Multiple values
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 85
DISPLAY OPERATIONAL DATA
Operational data must be enabled on the Problems page:
Operational data
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 86
DISPLAYING ITEM VALUE
Macros can be used to display item value:
{ITEM.VALUE} the at-the-time-of-event value
{ITEM.LASTVALUE} the most recent value
1000
900
{ITEM.LASTVALUE}
800
{ITEM.VALUE}
700
600
500
400
300
200
100
0
9:00:00 9:00:10 9:00:20 9:00:30 9:00:40 9:00:50 9:01:00 9:01:10 9:01:20 9:01:30 9:01:40 9:01:50 9:02:00
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 87
INDEX IN MACRO NAMES
Index can be used to specify first, second, etc. item in a trigger configuration
{ITEM.VALUE<1-9>} the at-the-time-of-event value of the Nth item in the trigger expression
{ITEM.LASTVALUE<1-9>} the most recent value of the Nth item in the trigger expression
1000
900 {ITEM.VALUE1}
{ITEM.LASTVALUE1}
800
700
600
500
400
300
{ITEM.VALUE2}
{ITEM.LASTVALUE2}
200
100
0
9:00:00 9:00:10 9:00:20 9:00:30 9:00:40 9:00:50 9:01:00 9:01:10 9:01:20 9:01:30 9:01:40 9:01:50 9:02:00
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 88
TRIGGER SEVERITIES
One of the six severities can be assigned to a trigger:
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 89
RESOLVING PROBLEMS
Problems may be resolved using different scenarios:
By using the trigger expression only
Trigger expression = FALSE
By specifying additional recovery expression
Trigger expression = FALSE and recovery expression = TRUE
By using manual close of the problem
Manual close option must be enabled in the trigger configuration
! Recovery expression will not have any effect if trigger expression is still TRUE!
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 90
USING RECOVERY EXPRESSION
Recovery expression may reduce trigger flapping:
Once a problem is detected, a different expression is used for recovery
Both Trigger and Recovery expressions are used for OK event calculation
3.5
2.5
2
Trigger
expression
1.5
Recovery
1
expression
0.5
0
9:00:00 9:00:10 9:00:20 9:00:30 9:00:40 9:00:50 9:01:00 9:01:10 9:01:20 9:01:30 9:01:40 9:01:50 9:02:00
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 91
RECOVERY EXPRESSION EXAMPLE
Trigger
expression
Recovery
expression
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 92
MANUAL CLOSE
Manual close will close any existing problem immediately:
The trigger will be recalculated on the next item update
A new problem will be opened if the trigger expression is still true
Manual close
09:00:45
PROBLEM PROBLEM
6
5.5
5
4.5
4
3.5
3
2.5
2
1.5
1
0.5
0
9:00:00 9:00:10 9:00:20 9:00:30 9:00:40 9:00:50 9:01:00 9:01:10 9:01:20 9:01:30 9:01:40
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 93
PRACTICAL SETUP
1) On the host "Training-VM-XX":
Create a user macro for high CPU load (>1.5)
Create a trigger to detect high CPU load with a Warning severity
2) Use "cat /dev/urandom | md5sum" command
3) Wait for problem to be detected
Show operational data for the problem
4) On the host "Training-VM-XX":
Create a user macro for CPU recovery (<0.75)
Add a recovery expression to the trigger
5) Stop the "cat /dev/urandom | md5sum" by pressing CTRL+C
6) Watch Problems page for Operational data values
7) Wait for problem to be closed
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 15 minutes Practical task No: 14 94
Problems
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 15 minutes 95
PROBLEM DETECTION
Problem detection in Zabbix is based on:
Data collection at defined intervals using items
Evaluation of collected data using triggers
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 96
EVENTS
Each time the trigger changes its state, a trigger event is generated:
The event contains details of the trigger state change
The date and time when the change has happened
The new state of the trigger
Problem
PROBLEM EVENT
Recovery
OK EVENT
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 97
PROBLEMS
Problems are generated based on the events:
Problem event will create a new problem
Recovery event will resolve the problem
6.00
5.00
4.00
3.00
Trigger 2.00
CPU load > 2
1.00
0.00
09:00:00 09:00:10 09:00:20 09:00:30 09:00:40 09:00:50 09:01:00
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 100
PROBLEMS PAGE
The main part of the Problems page contains the list of current problems:
The representation of problems depends on a global filter:
Recent problems open problems and problems resolved in the last 5 minutes are displayed
Problems only open problems are displayed
History custom history period for open and resolved problems can be specified
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 101
PROBLEM UPDATE
Status of a problem can be changed by:
Adding a text message
Changing problem severity
Acknowledging
Manually closing (if allowed)
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 102
PROBLEM DISPLAYING OPTIONS
Problem displaying options can be adjusted:
Go to the Administration > General > Trigger displaying options:
Redefine event status colors
Change problem displaying options
Change trigger severity names and colors
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 103
PRACTICAL SETUP
1) Use "cat /dev/urandom | md5sum" command to generate a problem
2) Acknowledge the problem with a message and change problem severity
3) Allow manual close in the trigger configuration
4) Close the problem using manual close
5) Watch how the problem is detected again soon
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 10 minutes Practical task No: 15 104
Trigger functions
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 15 minutes 105
FUNCTIONS
Zabbix supports almost 100 different functions:
Aggregate functions avg, count, min, max, sum, kurtosis etc.
Bitwise functions bitand, bitlshift, bitnot, bitor, bitrshift, bitxor
Date and time functions date, dayofmonth, dayofweek, now, time
History functions last, first, change, logseverity, monoinc, nodata, etc.
Trend-based functions trendavg, trendcount, trendmax, trendmin, trendsum
Mathematical functions abs, cos, sin, tan, ceil, floor, degrees, e, exp, log, rand, etc.
Operator functions in, between
Prediction functions forecast, timeleft
String functions ascii, bitlength, char, concat, find, left, length, trim, mid etc.
Foreach functions avg_foreach, last_foreach, sum_foreach (calculated items only)
Advanced functions and absolute time shift periods are discussed in ZCP 6.0
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 106
FUNCTION PARAMETERS
Most of the functions require one or multiple parameters:
/host/key is a common mandatory first parameter for history functions
last(/prod/system.cpu.load)
min(/prod/vm.memory.size[free],1h)
count(/prod/log[/var/log/myApp.log],10m,"like","error" )
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 107
TIME PERIODS
Most of numeric functions accept time or number of values as a parameter:
Seconds will be used if no time suffix is specified
Time suffixes may be used to specify time units (10s, 5m, 1h, etc.)
If preceded by a hashtag #, the parameter indicates the number of values (#5, #10, etc.)
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 108
FUNCTION PARAMETERS
Example:
Item update interval: 5s
Item collected every minute at 00, 05, 10, 15 ,etc.
max(/host/key,1m)
min(/host/key,#10)
avg(/host/key,10)
time
20 25 30 35 40 45 50 55 00 05 10 15 20 25 30 35 40 45
09:05:00 09:05:45
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 109
MATHEMATICAL OPERATIONS
Mathematical operations can be applied to the trigger functions:
To the result of trigger function
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 110
FUNCTION PARAMETERS
Aggregate functions will accept other expressions as function parameters:
function(function_a(),function_b(),...)
Function beginning with host and item key will use time period as parameter
function1 function2
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 111
OPERATORS
The following operators are supported for triggers:
Unary minus - (change the sign of an operand)
Mathematical operations ( +, -, *, / )
Compare (<, <=, >, >=, =, <>)
Logical operators (and, or, not)
Case-sensitive and must be in lowercase
Must be surrounded by spaces or parentheses.
Notes:
Most operators expect numerical variables
Operators = or <> can be used to compare strings
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 112
FUNCTION COMPARE
When building trigger expressions, it is possible to compare function against:
Fixed value
User macro
last(/node1/hw.macaddr) = last(/node2/hw.macaddr)
Result of calculation
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 113
RELATIVE TIMESHIFT
An optional time shift is supported in the time parameter:
This parameter allows to reference the data from a period of time in the past
Time shift starts with now (the current time), followed by:
+N<time unit> to add N time units
-N<time unit> to subtract N time units
avg(/host/key,4h:now-1d)
Complex expressions using multiple time units in the calculation are supported
avg(/host/key,6h:now-1d+8h)
6h:now-16h
4h:now-1d 6h:now-1d+8h 4h
time
22 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 2 3 4 5 6
Yesterday Today Now
2021-10-20 2021-10-21 2021-10-21 06:00
i https://www.zabbix.com/documentation/6.0/en/manual/config/triggers/expression
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 114
LAST FUNCTION
The last() function returns the last received value:
The time period is not supported
last(/host/key)
Using hashtag # will denote the Nth previous value
last(/host/key)
last(/host/key,#4) last(/host/key,#3) last(/host/key,#2) last(/host/key,#1)
time
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 115
FUNCTION LAST()
Function last() is very sensitive:
Every received value which exceeds the threshold will generate a new alert
This can lead to "trigger flapping"
4.5
3.5
2.5
1.5
0.5
0
9:00:00 9:00:10 9:00:20 9:00:30 9:00:40 9:00:50 9:01:00 9:01:10 9:01:20 9:01:30 9:01:40 9:01:50 9:02:00
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 116
FUNCTION MIN()
Function min() is a simple way to reduce false problem detection:
Minimum value must drop below the threshold for some time period to detect a problem
The problem will resolve immediately
30 seconds PROBLEM
5
4.5
3.5
1.5
0.5
0
9:00:00 9:00:10 9:00:20 9:00:30 9:00:40 9:00:50 9:01:00 9:01:10 9:01:20 9:01:30 9:01:40 9:01:50 9:02:00
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 117
FUNCTION MAX()
Function max() may be used to detect availability issues:
Multiple availability checks in a row must fail to detect a problem
30 seconds PROBLEM
1.5
0.5
0
9:00:00 9:00:10 9:00:20 9:00:30 9:00:40 9:00:50 9:01:00 9:01:10 9:01:20 9:01:30 9:01:40 9:01:50 9:02:00
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 118
FUNCTION COUNT()
Function count() is another option:
More than one anomaly will be required to detect a problem
1 minute PROBLEM
3.5
2.5
1.5
0.5
0
9:00:00 9:00:10 9:00:20 9:00:30 9:00:40 9:00:50 9:01:00 9:01:10 9:01:20 9:01:30 9:01:40 9:01:50 9:02:00
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 119
MONOTONIC FUNCTIONS
Monotonic functions can be used to monitor queues or disk space:
monoinc() detects monotonic increase of values collected
monodec() detects monotonic decrease of values collected
60 seconds PROBLEM
1100
1000
900
800
700
600
500
400
300
200
9:00:00 9:00:10 9:00:20 9:00:30 9:00:40 9:00:50 9:01:00 9:01:10 9:01:20 9:01:30 9:01:40 9:01:50 9:02:00
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 120
PRACTICAL SETUP
1) On the host "Training-VM-XX":
Replace last() function for CPU load triggers with a minimum for 1 minute
2) Use "cat /dev/urandom | md5sum" command to test triggers
3) Create a new trigger to compare memory usage:
Compare average free memory for current hour with average free memory for previous hour
Generate alert if the free memory has decreased by more than 25%
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 10 minutes Practical task No: 16 121
Time-based functions
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 15 minutes 122
TIME-BASED FUNCTIONS
All time-based functions are recalculated every 30 seconds:
If both time-based and non-time-based functions are used in an expression, it is
recalculated when a new value is received and additionally every 30 seconds
Recalculation schedule is distributed evenly between all time-based functions
Example trigger is recalculated:
every 10 seconds based on the item update interval
additionally, every 30 seconds because time-based function is used in the expression
30 seconds
2
1.5
0.5
0
9:00:00 9:00:10 9:00:20 9:00:30 9:00:40 9:00:50 9:01:00 9:01:10 9:01:20 9:01:30 9:01:40 9:01:50 9:02:00
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 123
DATE AND TIME FUNCTIONS
All date and time functions are time-based:
date current date in YYYYMMDD format
time current time in HHMMSS format
dayofweek current day of week 1-7 (Mon - 1, Sun - 7)
dayofmonth current day of month 1-31
now current time in HHMMSS format
These functions can be used to specify time periods from trigger calculation
Detect problems only on weekends
min(/host/system.cpu.load,30s) > 2 and dayofweek() > 5
Ignore scheduled backups between 01:00:00 and 03:00:00
avg(/host/system.cpu.util[,iowait],5m) > 5 and (time() < 010000 or time() > 030000)
! All date and time functions use Zabbix server time zone!
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 124
NODATA() FUNCTION
Time-based history function checks for no data received:
nodata(/host/key,time period,<mode>)
Time period should not be less than 30 seconds (nodata(0) is not allowed)
Returns:
1 - if no data received during the defined period of time
0 - otherwise
The 'nodata' triggers monitored by proxy are, by default, sensitive to proxy availability
They will not fire if the data is expected from a proxy, which is currently offline
"strict" mode will ignore proxy availability
nodata()
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 125
NODATA EXAMPLE
Function nodata() can be used to detect:
Zabbix agent availability (agent.ping item never returns 0)
The problem is
Changes in the log files monitored by Zabbix resolved
immediately when
Data received (or not received) on the regular intervals the data arrives
0
9:01:15 9:02:15 9:03:15 9:04:15 9:05:15 9:06:15 9:07:15
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 126
NOTES
Zabbix server time zone is used to calculate time-based functions
User time zone settings may differ from Zabbix server time zone
Time-based functions in triggers with multiple event generation mode will create
a new problem every 30 seconds
The trigger will be evaluated every 30 seconds even if there isn't any new data received
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 127
PRACTICAL SETUP
1) On the "Training-VM-XX active checks" host
Create Zabbix agent ping item with the 10 second update interval
Create a trigger to check agent ping last value
2) Stop Zabbix agent on your virtual machine
3) Wait 1 minute to test if the trigger detects a problem
4) On the Training-VM-XX active checks host:
Replace the last() trigger function with no data received for 1 minute
5) Wait 1 minute to test if the trigger detects a problem
6) Start Zabbix agent on your virtual machine
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 10 minutes Practical task No: 17 128
TRIGGER DEPENDENCIES
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 10 minutes 129
TRIGGER DEPENDENCIES
Dependencies can be defined between multiple triggers:
Problems will be suppressed if the trigger they depend on is in the PROBLEM state
Zabbix does not support dependencies between hosts directly
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 130
TRIGGERS - DEPENDENCIES
It is possible to create complex architecture with multi-level dependency:
Multiple levels:
Server A > Switch 1 > Router Server A Server B Server C Server D
Multiple dependencies:
Switch 1 > Router
Switch 1 Switch 2
Switch 2 > Router
Router
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 131
DEPENDENT TRIGGER EVALUATION
Dependent trigger will only be re-evaluated when:
Parent trigger has changed its state to "OK"
A new value is received for item used in dependent trigger expression
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved Theory 132
PRACTICAL SETUP
1) On the host "Training-VM-XX":
Create user macro for very high CPU load ( >2.5) with a "High" severity
Create a trigger to detect very high CPU load
2) Create a dependency between triggers for high and very high CPU load
3) Use "yes > /dev/null" command to test this setup
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 10 minutes Practical task No: 18 133
QUESTIONS?
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved 134
Time for a break :)
Zabbix 6.0 Certified Specialist ● Day 2 © 2022 by Zabbix. All rights reserved