This page is a collection of trigger examples.
Examples are sorted by use case:
Zabbix agent on the host has been unavailable for 5 minutes.
Data item: zabbix[host,agent,available]
Alternative method:
No data has been received from Zabbix agent for 5 minutes.
Data item: agent.ping
Zabbix proxy data lags behind Zabbix server time by 1 minute.
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])=0The expression is true when both SMTP servers are down.
Data item: net.tcp.service
The expression is true if the host is unreachable by ping more than 5 times in the last 30 minutes.
Data item: icmpping
A negative change in the system uptime value indicates a reboot.
Data item: system.uptime
/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.
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 will fire if the query result deviates from what it normally returns:
Data item: net.dns.record[192.0.2.0,{$WEBSITE_NAME},{$DNS_RESOURCE_RECORD_TYPE},2,1], with macros defined as:
Create an alert if Ubuntu version is different on different hosts. Note how operands here are functions that return strings.
Data item: vfs.file.contents
The trigger will fire if client local time and Zabbix server time differs by more than 10 seconds.
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.
The expression is true if Zabbix agent has beta version. Zabbix agent needs to be upgraded.
Data item: agent.version
The operational state (up/down/unknown) of eth0 has changed more than 5 times in an hour.
Data item: vfs.file.contents
The expression is true when the number of received bytes on eth0 within the last five minutes was always over 100 kilobytes. Someone is probably downloading a large file.
Data item: net.if.in[eth0,bytes]
Problem expression:
The trigger will fire if free disk space is consistently (5 minutes) below 10 GB.
Recovery expression:
The problem gets resolved when free disk space is consistently (10 minutes) above 40 GB.
Data item: vfs.fs.size
The trigger will fire 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.
The trigger will fire when 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 will analyze 5 minutes of data and trigger only if CPU load was never under 2. Additionally, these triggers will 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)>=2The processor load is too high on at least two of the three hosts. Data item: system.cpu.load
The trigger will fire if the average load today tops the average load of the same hour yesterday (using time shift as now-1d) more than two times.
Data item: system.cpu.load
Load on the Exchange server increased by more than 10% last month
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 will fire 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.
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.