Zabbix Documentation 2.4

3.04.04.2 (current)| In development:4.4 (devel)| Unsupported:1.82.02.22.43.23.4Guidelines

User Tools

Site Tools


manual:regular_expressions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

manual:regular_expressions [2018/03/14 11:01]
manual:regular_expressions [2016/09/23 08:17] (current)
martins-v mentioning that ordinary regexps may not start with '@'
Line 1: Line 1:
 +====== 11. Regular expressions ======
 +
 +=== Overview ===
 +
 +[[https://​en.wikipedia.org/​wiki/​Regular_expression#​POSIX_extended|POSIX extended regular expressions]] are supported in Zabbix.
 +
 +There are two ways of using regular expressions in Zabbix:
 +
 +  * manually entering a regular expression
 +  * using a global regular expression created in Zabbix
 +
 +=== Regular expressions ===
 +
 +You may manually enter a regular expression in supported places. Note that the expression may not start with @ because that symbol is used in Zabbix for referencing global regular expressions.
 +
 +=== Global regular expressions ===
 +
 +There is an advanced editor for creating and testing complex regular expressions in Zabbix frontend.
 +
 +Once a regular expression has been created this way, it can be used in several places in the frontend by referring to its name, prefixed with @, for example, //​@mycustomregexp//​.
 +
 +To create a global regular expression:
 +
 +  * Go to: //​Administration -> General//
 +  * Select //Regular expressions//​ from the dropdown
 +  * Click on //New regular expression//​
 +
 +The **Expressions** tab allows to set the regular expression name and add subexpressions. ​
 +
 +{{manual:​regular_expressions:​regexp_expr.png?​600|}}
 +
 +^Parameter^Description^
 +|//Name// |Set the regular expression name. Any Unicode characters are allowed. ​ |
 +|//​Expressions// ​ |Click on //Add// in the Expressions block to add a new subexpression. ​ |
 +
 +Starting with Zabbix 2.4.0, a forward slash (/) in the expression is treated literally, rather than a delimiter. This way it is possible to save expressions containing a slash, whereas previously it would produce an error.
 +
 +<note important>​A custom regular expression name in Zabbix may contain commas, spaces, etc. In those cases where that may lead to misinterpretation when referencing (for example, a comma in the parameter of an item key) the whole reference may be put in quotes like this: //”@My custom regexp for purpose1, purpose2”//​.\\ Regular expression names must not be quoted in other locations (for example, in LLD rule properties).</​note>​
 +
 +A custom regular expression may consist of multiple subexpressions,​ and it can be tested in the **Test** tab by providing a test string.
 +
 +{{manual:​regular_expressions:​regexp_test.png|}}
 +
 +Results show the status of each subexpression and total custom expression status. ​