implement replaceAlias() function, #287
This commit is contained in:
@@ -158,3 +158,35 @@ Examples:
|
||||
```
|
||||
setAlias(Zabbix busy [a-zA-Z]+)
|
||||
```
|
||||
|
||||
### replaceAlias
|
||||
```
|
||||
replaceAlias(pattern, newAlias)
|
||||
```
|
||||
|
||||
Replace metric name using pattern. Pattern is regex or regular string. If regex is used, following special replacement patterns are supported:
|
||||
|
||||
|Pattern | Inserts|
|
||||
----------|---------
|
||||
|$$ | Inserts a "$". |
|
||||
|$& | Inserts the matched substring. |
|
||||
|$` | Inserts the portion of the string that precedes the matched substring. |
|
||||
|$' | Inserts the portion of the string that follows the matched substring. |
|
||||
|$n | Where n is a non-negative integer less than 100, inserts the nth parenthesized submatch string, provided the first argument was a RegExp object. |
|
||||
|
||||
For more detais see [String.prototype.replace()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) function.
|
||||
|
||||
Examples:
|
||||
```
|
||||
CPU system time
|
||||
replaceAlias(/CPU (.*) time/, $1) -> system
|
||||
|
||||
backend01: CPU system time
|
||||
replaceAlias(/CPU (.*) time/, $1) -> backend01: system
|
||||
|
||||
backend01: CPU system time
|
||||
replaceAlias(/.*CPU (.*) time/, $1) -> system
|
||||
|
||||
backend01: CPU system time
|
||||
replaceAlias(/(.*): CPU (.*) time/, $1 - $2) -> backend01 - system
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user