manual:regular_expressions

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manual:regular_expressions [2019/06/11 13:11]
martins-v punctuation fix
manual:regular_expressions [2021/05/12 05:45] (current)
martins-v new trigger syntax (ZBXNEXT-6451)
Line 32: Line 32:
 The **Expressions** tab allows to set the regular expression name and add subexpressions. ​ The **Expressions** tab allows to set the regular expression name and add subexpressions. ​
  
-{{manual:​regular_expressions:​regexp_expr.png?600|}}+{{manual:​regular_expressions:​global_regexp.png|}}
  
 All mandatory input fields are marked with a red asterisk. ​ All mandatory input fields are marked with a red asterisk. ​
Line 44: Line 44:
 |//Case sensitive// ||A checkbox to specify whether a regular expression is sensitive to capitalization of letters. ​ | |//Case sensitive// ||A checkbox to specify whether a regular expression is sensitive to capitalization of letters. ​ |
  
-Since 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.+forward slash (/) in the expression is treated literally, rather than a delimiter. This way it is possible to save expressions containing a slash, ​without errors.
  
 <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>​ <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>​
  
-== Default global regular expressions ==+In the **Test** tab the regular expression and its subexpressions can be tested by providing a test string. 
 + 
 +{{manual:​regular_expressions:​global_regexp_b.png|}} 
 + 
 +Results show the status of each subexpression and total custom expression status.  
 + 
 +Total custom expression status is defined as //Combined result//. If several sub expressions are defined Zabbix uses AND logical operator to calculate //Combined result//. It means that if at least one Result is False //Combined result// has also False status.  
 + 
 +=== Default global regular expressions ​===
  
 Zabbix comes with several global regular expression in its default dataset. Zabbix comes with several global regular expression in its default dataset.
Line 97: Line 105:
  
 <note important>​ **g** modifier can't be specified in line. The list of available modifiers can be found in [[https://​www.pcre.org/​original/​doc/​html/​pcresyntax.html#​SEC16|pcresyntax man page]]. For more information about PCRE syntax please refer to [[https://​www.pcre.org/​original/​doc/​html/​pcrepattern.html|PCRE HTML documentation]]. ​ </​note>​ <note important>​ **g** modifier can't be specified in line. The list of available modifiers can be found in [[https://​www.pcre.org/​original/​doc/​html/​pcresyntax.html#​SEC16|pcresyntax man page]]. For more information about PCRE syntax please refer to [[https://​www.pcre.org/​original/​doc/​html/​pcrepattern.html|PCRE HTML documentation]]. ​ </​note>​
- 
-== More complex example == 
- 
-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?​600|}} 
- 
-Results show the status of each subexpression and total custom expression status. ​ 
- 
-Total custom expression status is defined as //Combined result//. If several sub expressions are defined Zabbix uses AND logical operator to calculate //Combined result//. It means that if at least one Result is False //Combined result// has also False status. ​ 
  
 === Regular expression support by location === === Regular expression support by location ===
Line 124: Line 122:
 |:::​|system.hw.macaddr[] |:::​|:::​|''​interface''​ parameter| |:::​|system.hw.macaddr[] |:::​|:::​|''​interface''​ parameter|
 |:::​|system.sw.packages[]|:::​|:::​|''​package''​ parameter| |:::​|system.sw.packages[]|:::​|:::​|''​package''​ parameter|
-|:::​|vfs.dir.count[] ​    ​|:::​|:::​|''​regex_incl'' ​and ''​regex_excl''​ parameters| +|:::​|vfs.dir.count[] ​    ​|:::​|:::​|''​regex_incl''​''​regex_excl'',​ ''​regex_excl_dir''​ parameters| 
-|:::​|vfs.dir.size[] ​     |:::​|:::​|''​regex_incl'' ​and ''​regex_excl''​ parameters|+|:::​|vfs.dir.size[] ​     |:::​|:::​|''​regex_incl''​''​regex_excl'',​ ''​regex_excl_dir''​ parameters|
 |:::​|vfs.file.regexp[] ​  ​|:::​|:::​|''​regexp''​ parameter| |:::​|vfs.file.regexp[] ​  ​|:::​|:::​|''​regexp''​ parameter|
 |:::​|vfs.file.regmatch[] |:::​|:::​|:::​| |:::​|vfs.file.regmatch[] |:::​|:::​|:::​|
Line 134: Line 132:
 |**[[:​manual/​appendix/​triggers/​functions|Trigger functions]]**|^ ​ ^^^ |**[[:​manual/​appendix/​triggers/​functions|Trigger functions]]**|^ ​ ^^^
 ^   ​|count() ​    ​|Yes|Yes|''​pattern''​ parameter if ''​operator''​ parameter is //regexp// or //​iregexp//​| ^   ​|count() ​    ​|Yes|Yes|''​pattern''​ parameter if ''​operator''​ parameter is //regexp// or //​iregexp//​|
-|:::​|logeventid()|:::|:::|''​pattern''​ parameter|+^   ​|find() ​     |Yes|Yes|''​pattern''​ parameter if ''​operator''​ parameter is //regexp// or //​iregexp//​| 
 +|:::​|logeventid()|Yes|Yes|''​pattern''​ parameter|
 |:::​|logsource() |:::​|:::​|:::​| |:::​|logsource() |:::​|:::​|:::​|
-|:::​|iregexp() ​  ​|:::​|:::​|:::​| +|**[[:​manual/​discovery/​low_level_discovery#​discovery_rule_filter|Low-level discovery]]** |^  ^^^ 
-|:::​|regexp() ​   |:::​|:::​|:::​| +^   ​|Filters ​   ​|Yes|Yes|//Regular expression// field 
-|**[[:​manual/​discovery/​low_level_discovery#​discovery_rule_filter|Low-level discovery]]** ||Yes|Yes|//​Filter// field| +|:::​|Overrides ​ |Yes|No |In //​matches//,​ //does not match// options for //​Operation//​ conditions
-|**[[:​manual/​config/​notifications/​action/​conditions|Action conditions]]** ||Yes|No|In //​matches//,​ //does not match// options for //Host name// and //Host metadata// ​auto-registration ​conditions|+|**[[:​manual/​config/​notifications/​action/​conditions|Action conditions]]** ||Yes|No|In //​matches//,​ //does not match// options for //Host name// and //Host metadata// ​autoregistration ​conditions|
 |**[[:​manual/​web_monitoring#​configuring_a_web_scenario|Web monitoring]]** ​  ​||Yes|No |//​Variables//​ with a **regex:** prefix\\ //Required string// field| |**[[:​manual/​web_monitoring#​configuring_a_web_scenario|Web monitoring]]** ​  ​||Yes|No |//​Variables//​ with a **regex:** prefix\\ //Required string// field|
 +|**[[manual:​config:​macros:​user_macros#​user_macro_context|User macro context]]** ​  ​||Yes|No |In macro context with a **regex:** prefix ​ |
 |**[[:​manual/​config/​macros/​macro_functions|Macro functions]]**|^ ​ ^^^ |**[[:​manual/​config/​macros/​macro_functions|Macro functions]]**|^ ​ ^^^
 ^   ​|regsub() |Yes|No |''​pattern''​ parameter| ^   ​|regsub() |Yes|No |''​pattern''​ parameter|
 |:::​|iregsub()|:::​|:::​|:::​| |:::​|iregsub()|:::​|:::​|:::​|
 |**[[:​manual/​web_interface/​frontend_sections/​administration/​general#​icon_mapping|Icon mapping]]** ||Yes|Yes|//​Expression//​ field| |**[[:​manual/​web_interface/​frontend_sections/​administration/​general#​icon_mapping|Icon mapping]]** ||Yes|Yes|//​Expression//​ field|
- 
- 
-