This page is a collection of trigger examples.
Examples are sorted by use case:
This trigger fires if Zabbix agent on the host has been unavailable for 5 minutes.
Function: max
Data item: zabbix[host,agent,available]
Alternative:
This trigger fires if no data has been received from Zabbix agent for 5 minutes.
Function: nodata
Data item: agent.ping
This trigger fires if Zabbix proxy data lags behind Zabbix server time by 1 minute.
Function: fuzzytime
Data item: zabbix[proxy,{$PROXY_NAME},lastaccess]
last(/smtp1.example.com/net.tcp.service[smtp])=0 and last(/smtp2.example.com/net.tcp.service[smtp])=0This trigger fires if both SMTP servers are down.
Function: last
Data item: net.tcp.service
This trigger fires if the host is unreachable by ping more than 5 times in the last 30 minutes.
Function: count
Data item: icmpping
This trigger fires if a negative change in the system uptime value is encountered (indicating a reboot).
Function: change
Data item: system.uptime
This trigger fires if /etc/passwd has been changed. The expression is true when the previous /etc/passwd checksum differs from the most recent one. Similar expressions could be useful to monitor changes in important files, such as /etc/passwd, /etc/inetd.conf, /kernel, etc.
Function: last
Data item: vfs.file.cksum
last(/Zabbix server/net.dns.record[192.0.2.0,{$WEBSITE_NAME},{$DNS_RESOURCE_RECORD_TYPE},2,1])<>"{$WEBSITE_NAME} {$DNS_RESOURCE_RECORD_TYPE} 0 mail.{$WEBSITE_NAME}"Notice the quotes around the second operand.
This trigger fires if the query result is not equal to what it normally returns:
Function: last
Data item: net.dns.record[192.0.2.0,{$WEBSITE_NAME},{$DNS_RESOURCE_RECORD_TYPE},2,1], with macros defined as:
This trigger fires if the Ubuntu version is different on different hosts. Note how operands here are functions that return strings.
Function: last
Data item: vfs.file.contents
The trigger fires if the client local time and Zabbix server time differs by more than 10 seconds.
Function: fuzzytime
Data item: system.localtime
Note that system.localtime must be configured as a passive check for Zabbix agent; on Zabbix agent 2 it may be configured as an active check.
This trigger fires if Zabbix agent has beta version. Zabbix agent needs to be upgraded.
Function: find
Data item: agent.version
This trigger fires if the operational state (up/down/unknown) of eth0 has changed more than 5 times in an hour.
Function: changecount
Data item: vfs.file.contents
This trigger fires if the number of received bytes on eth0 within the last five minutes was always over 100 kilobytes. Someone is probably downloading a large file.
Function: min
Data item: net.if.in[eth0,bytes]
The trigger fires if free disk space is consistently (5 minutes) below 10 GB.
You can also define a recovery expression:
The problem gets resolved only when free disk space is consistently (10 minutes) above 40 GB.
Function: min
Data item: vfs.fs.size
The trigger fires if free storage (in allocation units) drops below 10 percent. Notice the value of another item being used to get an adaptive trigger threshold, applicable to discovered storage of various size. Function: last
The trigger fires when the average processor load has been above 5 for one minute.
Variations:
min(/host/system.cpu.load[all,avg1],5m)>2 and not (dayofweek()=7 and time()>230000) and not (dayofweek()=1 and time()<010000)Such triggers analyze 5 minutes of data and trigger only if CPU load is never under 2. Additionally, these triggers fire:
(last(/host/system.cpu.load[all,avg1])>5) + (last(/host2/system.cpu.load[all,avg1])>5) + (last(/host3/system.cpu.load[all,avg1])>5)>=2This trigger fires if the processor load is too high on at least two of the three hosts.
Functions: last, min, dayofweek, time
Data item: system.cpu.load
The trigger fires if the average load today tops the average load of the same hour yesterday (using time shift as now-1d) more than two times.
Function: avg
Data item: system.cpu.load
This trigger fires if the CPU load on the host increased by more than 10% last month
Function: trendavg
Data item: system.cpu.load
You may also use the Event name field in trigger configuration to build a meaningful alert message, for example to receive something like
"Load of Exchange server increased by 24% in July (0.69) comparing to June (0.56)"
the event name must be defined as:
Load of {HOST.HOST} server increased by {{?100*trendavg(//system.cpu.load,1M:now/M)/trendavg(//system.cpu.load,1M:now/M-1M)}.fmtnum(0)}% in {{TIME}.fmttime(%B,-1M)} ({{?trendavg(//system.cpu.load,1M:now/M)}.fmtnum(2)}) comparing to {{TIME}.fmttime(%B,-2M)} ({{?trendavg(//system.cpu.load,1M:now/M-1M)}.fmtnum(2)})It is also useful to allow manual closing in trigger configuration for this kind of problem.
The trigger fires if /tmp/hello content is equal to the string defined in {$HELLO_MACRO}:
Alternatively, you can compare to the string directly:
Notice how the special characters (\\ and ") characters are escaped when the string gets compared directly.
Function: last
Data item: vfs.file.contents
Have a trigger expression example that might be useful to others? Use the Example suggestion form to send it to Zabbix developers.