[ZBXNEXT-2212] Make global regular expressions insertable into other regular expressions Created: 2014 Mar 18 Updated: 2014 Mar 20 |
|
Status: | Open |
Project: | ZABBIX FEATURE REQUESTS |
Component/s: | Server (S) |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | New Feature Request | Priority: | Minor |
Reporter: | Robin Roevens | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 1 |
Labels: | globalregexps, regexps | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Description |
It would be a great feature to be able to use global defined regular expressions (Administration -> General -> Regular Expressions) inside any local regular expressions so that it becomes possible to locally extend the global regular expression. The global regular expression will act as some kind of include file. For example: Which is now used as filter in a templated Windows Services LLD-item : However sometimes it is necessary to exclude certain services on host-level, hence defining a filter as such: Filter macro: {#SVCNAME} regexp: @Windows Services Blacklist|^service1$|^service2$ Here the @Windows Services Blacklist-keyword could be replaced by "^spupdsvc$|^TBS$|^Sysmonlog$" creating the local regexp: "^spupdsvc$|^TBS$|^Sysmonlog$|^service1$|^service2$" to be evaluated (see also this forum discussion: https://www.zabbix.com/forum/showthread.php?t=44002 ) This kind of feature could also be an answer to ZBXNEXT-481 making it possible to construct a regexp of global regexps: This feature would make the regexp engine and LLD filtering a lot more powerful and flexible. |
Comments |
Comment by Oleksii Zagorskyi [ 2014 Mar 19 ] |
You said:
but that's not truth because you used [Result is FALSE] mode in global regexp. About LLD filtering - you probably don't know about |
Comment by Robin Roevens [ 2014 Mar 19 ] |
You're right about the negation and the only way to perform negation in zabbix without the use of negative lookbehinds and lookaheads forming very complex regexes, not sure if supported by Posix ERE. I completely overlooked the fact that the filter field expects a TRUE to have a value accepted not to have it filtered out. Result is TRUE in my example would make my example valid (but not doing what it was intended for). I indeed did not know about Additionally an ability to use some kind of zabbix-specific regexps syntax allowing one to simulate the current global expressions behaviour in a local regexps could also be very handy for use in trigger expressions. to get this boolean negation only available in global regexps or !{^spupdsvc$}|{^TBS$} This, in combination with the ability to combine global regexps with local ones would correct my previous erroneous example like this: regexp: @Windows Services Blacklist|!{^service1$}|!{^service2$} Then of course also usable in item or trigger expressions where |
Comment by Oleksii Zagorskyi [ 2014 Mar 19 ] |
Thanks for the nice discussion! Your idea is interesting and probably is fresh. |
Comment by Robin Roevens [ 2014 Mar 20 ] |
Using PCRE, as suggested engine in Not really easy to read or construct (in my opinion), but possible, so using PCRE on both front-end and back-end as suggested in So going back to my example combined regexp |