Zabbix Documentation 5.0

3.04.05.0 (current)| In development:5.2 (devel)| Unsupported:1.82.02.22.43.23.44.24.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

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
manual:regular_expressions [2019/06/11 13:00]
martins-v formatting change
manual:regular_expressions [2020/06/09 08:45]
martins-v regular expression support in macro context (ZBXNEXT-3205)
Line 52: Line 52:
 Zabbix comes with several global regular expression in its default dataset. Zabbix comes with several global regular expression in its default dataset.
  
-^Global regexp^Expression^Description+^Name^Expression^Matches
-|//File systems for discovery// ​ |''​^(btrfs|ext2|ext3|ext4|jfs|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|refs|apfs|ntfs|fat32|zfs)$'' ​ |Matches ​"​btrfs"​ or "​ext2"​ or "​ext3"​ or "​ext4"​ or "​jfs"​ or "​reiser"​ or " xfs" or "​ffs"​ or "​ufs"​ or "​jfs"​ or "​jfs2"​ or "​vxfs"​ or "​hfs"​ or "​refs"​ or "​apfs"​ or "​ntfs"​ or "​fat32"​ or "​zfs" ​ | +|//File systems for discovery// ​ |''​^(btrfs|ext2|ext3|ext4|jfs|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|refs|apfs|ntfs|fat32|zfs)$'' ​ |%%"%%btrfs%%"%% or %%"%%ext2%%"%% or %%"%%ext3%%"%% or %%"%%ext4%%"%% or %%"%%jfs%%"%% or %%"%%reiser%%"%% or %%"%%xfs%%"%% or %%"%%ffs%%"%% or %%"%%ufs%%"%% or %%"%%jfs%%"%% or %%"%%jfs2%%"%% or %%"%%vxfs%%"%% or %%"%%hfs%%"%% or %%"%%refs%%"%% or %%"%%apfs%%"%% or %%"%%ntfs%%"%% or %%"%%fat32%%"%% or %%"%%zfs%%"%%  | 
-|//Network interfaces for discovery// ​ |''​^Software Loopback Interface'' ​ |Matches strings ​starting with "​Software Loopback Interface" ​ | +|//Network interfaces for discovery// ​ |''​^Software Loopback Interface'' ​ |Strings ​starting with %%"%%Software Loopback Interface%%"%%.  | 
-|  |''​^lo$'' ​ |Matches ​"​lo" ​ | +|  |''​^lo$'' ​ |%%"%%lo%%"%%  | 
-|  |''​^(In)?​[Ll]oop[Bb]ack[0-9._]*$'' ​ |Matches strings ​that optionally start with "​In",​ then have "​L"​ or "​l",​ then "​oop",​ then "​B"​ or "​b",​ then "​ack",​ which can be optionally followed by any number of digits, dots or underscores ​ | +|  |''​^(In)?​[Ll]oop[Bb]ack[0-9._]*$'' ​ |Strings ​that optionally start with %%"%%In%%"%%, then have %%"%%L%%"%% or %%"%%l%%"%%, then %%"%%oop%%"%%, then %%"%%B%%"%% or %%"%%b%%"%%, then %%"%%ack%%"%%, which can be optionally followed by any number of digits, dots or underscores | 
-|  |''​^NULL[0-9.]*$'' ​ |Matches strings ​starting with "​NULL"​ optionally followed by any number of digits or dots  | +|  |''​^NULL[0-9.]*$'' ​ |Strings ​starting with %%"%%NULL%%"%% optionally followed by any number of digits or dots | 
-|  |''​^[Ll]o[0-9.]*$'' ​ |Matches strings ​starting with "​Lo"​ or "​lo"​ and optionally followed by any number of digits or dots  | +|  |''​^[Ll]o[0-9.]*$'' ​ |Strings ​starting with %%"%%Lo%%"%% or %%"%%lo%%"%% and optionally followed by any number of digits or dots | 
-|  |''​^[Ss]ystem$'' ​ |Matches ​"​System"​ or "​system" ​ | +|  |''​^[Ss]ystem$'' ​ |%%"%%System%%"%% or %%"%%system%%"%%  | 
-|  |''​^Nu[0-9.]*$'' ​ |Matches strings staring ​with "​Nu"​ optionally followed by any number of digits or dots  | +|  |''​^Nu[0-9.]*$'' ​ |Strings starting ​with %%"%%Nu%%"%% optionally followed by any number of digits or dots | 
-|//Storage devices for SNMP discovery// ​ |''​^(Physical memory|Virtual memory|Memory buffers|Cached memory|Swap space)$'' ​ |Matches ​"​Physical memory"​ or "​Virtual memory"​ or "​Memory buffers"​ or "​Cached memory"​ or "Swap space" ​ | +|//Storage devices for SNMP discovery// ​ |''​^(Physical memory|Virtual memory|Memory buffers|Cached memory|Swap space)$'' ​ |%%"%%Physical memory%%"%% or %%"%%Virtual memory%%"%% or %%"%%Memory buffers%%"%% or %%"%%Cached memory%%"%% or %%"%%Swap space%%"%%  | 
-|//Windows service names for discovery// ​ |''​^(MMCSS|gupdate|SysmonLog|clr_optimization_v2.0.50727_32|clr_optimization_v4.0.30319_32)$'' ​ |Matches ​"​MMCSS"​ or "​gupdate"​ or "​SysmonLog"​ or strings like "​clr_optimization_v2.0.50727_32"​ and "​clr_optimization_v4.0.30319_32"​ where instead of dots you can put any character except newline. ​ | +|//Windows service names for discovery// ​ |''​^(MMCSS|gupdate|SysmonLog|clr_optimization_v2.0.50727_32|clr_optimization_v4.0.30319_32)$'' ​ |%%"%%MMCSS%%"%% or %%"%%gupdate%%"%% or %%"%%SysmonLog%%"%% or strings like %%"%%clr_optimization_v2.0.50727_32%%"%% and %%"%%clr_optimization_v4.0.30319_32%%"%% where instead of dots you can put any character except newline. ​ | 
-|//Windows service startup states for discovery// ​ |''​^(automatic|automatic delayed)$'' ​ |Matches ​"​automatic"​ or "​automatic delayed"​ |+|//Windows service startup states for discovery// ​ |''​^(automatic|automatic delayed)$'' ​ |%%"%%automatic%%"%% or %%"%%automatic delayed%%"%%  |
  
 === Examples === === Examples ===
Line 139: Line 139:
 |:::​|regexp() ​   |:::​|:::​|:::​| |:::​|regexp() ​   |:::​|:::​|:::​|
 |**[[:​manual/​discovery/​low_level_discovery#​discovery_rule_filter|Low-level discovery]]** ||Yes|Yes|//​Filter//​ field| |**[[:​manual/​discovery/​low_level_discovery#​discovery_rule_filter|Low-level discovery]]** ||Yes|Yes|//​Filter//​ field|
-|**[[:​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/​usermacros#​user_macro_context|User macro context]]** ​  ​||Yes|No |In macro context with a **regex:** prefix\\ Supported since Zabbix 5.0.2. ​ |
 |**[[:​manual/​config/​macros/​macro_functions|Macro functions]]**|^ ​ ^^^ |**[[:​manual/​config/​macros/​macro_functions|Macro functions]]**|^ ​ ^^^
 ^   ​|regsub() |Yes|No |''​pattern''​ parameter| ^   ​|regsub() |Yes|No |''​pattern''​ parameter|