Human-readable constants

Using plain numeric constants is fine while we're dealing with small values. When an item collects data that is bigger, such as disk space or network traffic, such an approach becomes very tedious. You have to calculate the desired value, and from looking at it later, it is usually not obvious how large it really is. To help here, Zabbix supports so-called suffix multipliers in expressions—the abbreviations K, M, G, T, and so on are supported. This results in shorter and way more easy-to-read trigger expressions. For example, checking disk space for a host called host looks like this at first:

{host:vfs.fs.size[/,free].last()}<16106127360 

With suffix multipliers, it becomes this:

{host:vfs.fs.size[/,free].last()}<15G 

This is surely easier to read and modify if the need arises.

Another type of constant is time-based. So far, we've only used time in seconds for all the trigger functions, but that tends to be a bit unreadable. For example, 6 hours would be 21,600, and it just gets worse with longer periods. The following time-based suffixes are supported:

  • s: seconds
  • m: minutes
  • h: hours
  • d: days
  • w: weeks

The s suffix would simply be discarded, but all others would work as multipliers. Thus, 21,600 would become 6h, which is much more readable. The SSH service trigger example we looked at earlier would also be simpler:

{A test host:net.tcp.service[ssh].max(5m)}=0 

We have now covered the basics of triggers in Zabbix. There are many more functions that allow the evaluation of various conditions that you will want to use later on. The frontend function selector does not contain all of them, so sometimes you will have to look them up and construct the expression manually. For a full and up-to-date function list, refer to the official documentation at https://www.zabbix.com/documentation/4.0/manual/appendix/triggers/functions.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.218.254