This is a translation of the original English documentation page. Help us make it better.

2 アイテムの値の保存前処理

概要

保存前処理を行うことで、受け取った項目の値の変換ルールを定義することができます。
データベースに保存する前に、1つまたは複数の変換を行うことができます。

変換は定義された順番に実行されます。
保存前処理はZabbixサーバまたはプロキシ(プロキシでアイテムを監視している場合)で実行されます。

保存前処理に渡される値はすべて文字列型であり、(アイテムの設定で定義された)目的の値の型への変換は、
保存前処理パイプラインの最後に実行されることに注意してください。
ただし、変換は対応する保存前処理工程で必要とされる場合に行われることもあります。
詳細は保存前処理の詳細をご参照ください。

使用例も併せてご参照ください。

設定

保存前処理のルールは、アイテム設定保存前処理タブで定義します。

保存前処理のいずれかに失敗すると、アイテムは取得不可 となります。 ただし、サポートされている変換の 失敗時のカスタマイズ オプションを使用して、カスタムのエラー処理を指定した場合はこの限りではありません。

ログアイテムの場合、ログメタデータ(値なし)は常にアイテムの取得不可状態をリセットし、再びサポートされるようにします。

ユーザーマクロおよびユーザーマクロのコンテキストは、アイテム保存前処理のパラメータやJavaScriptのコード内でサポートされています。

マクロをその値で置き換える場合、コンテキストは無視されます。 マクロの値はそのままコードに挿入されるため、JavaScriptのコードに値を配置する前に追加のエスケープを行うことはできません。 このため、場合によってはJavaScriptエラーが発生する可能性があります。

Type
Transformation Description
Text
Regular expression Match the value to the <pattern> regular expression and replace value with <output>. The regular expression supports extraction of maximum 10 captured groups with the \N sequence. Failure to match the input value will make the item unsupported.
Parameters:
pattern - regular expression
output - output formatting template. An \N (where N=1…9) escape sequence is replaced with the Nth matched group. A \0 escape sequence is replaced with the matched text.
Please refer to regular expressions section for some existing examples.
If you mark the Custom on fail checkbox, the item will not become unsupported in case of failed preprocessing step and it is possible to specify custom error handling options: either to discard the value, set a specified value or set a specified error message.
Replace Find the search string and replace it with another (or nothing). All occurrences of the search string will be replaced.
Parameters:
search string - the string to find and replace, case-sensitive (required)
replacement - the string to replace the search string with. The replacement string may also be empty effectively allowing to delete the search string when found.
It is possible to use escape sequences to search for or replace line breaks, carriage return, tabs and spaces "\n \r \t \s"; backslash can be escaped as "\\" and escape sequences can be escaped as "\\n". Escaping of line breaks, carriage return, tabs is automatically done during low-level discovery.
Trim Remove specified characters from the beginning and end of the value.
Right trim Remove specified characters from the end of the value.
Left trim Remove specified characters from the beginning of the value.
Structured data
XML XPath Extract value or fragment from XML data using XPath functionality.
For this option to work, Zabbix server must be compiled with libxml support.
Examples:
number(/document/item/value) will extract 10 from <document><item><value>10</value></item></document>
number(/document/item/@attribute) will extract 10 from <document><item attribute="10"></item></document>
/document/item will extract <item><value>10</value></item> from <document><item><value>10</value></item></document>
Note that namespaces are not supported.
If you mark the Custom on fail checkbox, the item will not become unsupported in case of failed preprocessing step and it is possible to specify custom error-handling options: either to discard the value, set a specified value or set a specified error message.
JSON Path Extract value or fragment from JSON data using JSONPath functionality.
If you mark the Custom on fail checkbox, the item will not become unsupported in case of failed preprocessing step and it is possible to specify custom error-handling options: either to discard the value, set a specified value or set a specified error message.
CSV to JSON Convert CSV file data into JSON format.
For more information, see: CSV to JSON preprocessing.
XML to JSON Convert data in XML format to JSON.
For more information, see: Serialization rules.
If you mark the Custom on fail checkbox, the item will not become unsupported in case of failed preprocessing step and it is possible to specify custom error-handling options: either to discard the value, set a specified value or set a specified error message.
Arithmetic
Custom multiplier Multiply the value by the specified integer or floating-point value.
Use this option to convert values received in KB, MBps, etc into B, Bps. Otherwise Zabbix cannot correctly set prefixes (K, M, G etc).
Note that if the item type of information is Numeric (unsigned), incoming values with a fractional part will be trimmed (i.e. '0.9' will become '0') before the custom multiplier is applied.
Supported: scientific notation, for example, 1e+70 (since version 2.2); user macros and LLD macros (since version 4.0); strings that include macros, for example, {#MACRO}e+10, {$MACRO1}e+{$MACRO2}(since version 5.2.3)
The macros must resolve to an integer or a floating-point number.
If you mark the Custom on fail checkbox, the item will not become unsupported in case of failed preprocessing step and it is possible to specify custom error handling options: either to discard the value, set a specified value, or set a specified error message.
Change
Simple change Calculate the difference between the current and previous value.
Evaluated as value-prev_value, where
value - current value; prev_value - previously received value
This setting can be useful to measure a constantly growing value. If the current value is smaller than the previous value, Zabbix discards that difference (stores nothing) and waits for another value.
Only one change operation per item is allowed.
If you mark the Custom on fail checkbox, the item will not become unsupported in case of failed preprocessing step and it is possible to specify custom error handling options: either to discard the value, set a specified value, or set a specified error message.
Change per second Calculate the value change (difference between the current and previous value) speed per second.
Evaluated as (value-prev_value)/(time-prev_time), where
value - current value; prev_value - previously received value; time - current timestamp; prev_time - timestamp of previous value.
This setting is extremely useful to get speed per second for a constantly growing value. If the current value is smaller than the previous value, Zabbix discards that difference (stores nothing) and waits for another value. This helps to work correctly with, for instance, a wrapping (overflow) of 32-bit SNMP counters.
Note: As this calculation may produce floating-point numbers, it is recommended to set the 'Type of information' to Numeric (float), even if the incoming raw values are integers. This is especially relevant for small numbers where the decimal part matters. If the floating-point values are large and may exceed the 'float' field length in which case the entire value may be lost, it is actually suggested to use Numeric (unsigned) and thus trim only the decimal part.
Only one change operation per item is allowed.
If you mark the Custom on fail checkbox, the item will not become unsupported in case of failed preprocessing step and it is possible to specify custom error handling options: either to discard the value, set a specified value, or set a specified error message.
Numeral systems
Boolean to decimal Convert the value from boolean format to decimal. The textual representation is translated into either 0 or 1. Thus, 'TRUE' is stored as 1 and 'FALSE' is stored as 0. All values are matched in a case-insensitive way. Currently recognized values are, for:
TRUE - true, t, yes, y, on, up, running, enabled, available, ok, master
FALSE - false, f, no, n, off, down, unused, disabled, unavailable, err, slave
Additionally, any non-zero numeric value is considered to be TRUE and zero is considered to be FALSE.
If you mark the Custom on fail checkbox, the item will not become unsupported in case of failed preprocessing step and it is possible to specify custom error handling options: either to discard the value, set a specified value, or set a specified error message.
Octal to decimal Convert the value from octal format to decimal.
If you mark the Custom on fail checkbox, the item will not become unsupported in case of failed preprocessing step and it is possible to specify custom error handling options: either to discard the value, set a specified value, or set a specified error message.
Hexadecimal to decimal Convert the value from hexadecimal format to decimal.
If you mark the Custom on fail checkbox, the item will not become unsupported in case of failed preprocessing step and it is possible to specify custom error handling options: either to discard the value, set a specified value, or set a specified error message.
Custom scripts
JavaScript Enter JavaScript code in the block that appears when clicking in the parameter field or on a pencil icon.
Note that available JavaScript length depends on the database used.
For more information, see: Javascript preprocessing.
Validation
In range Define a range that a value should be in by specifying minimum/maximum values (inclusive).
Numeric values are accepted (including any number of digits, optional decimal part and optional exponential part, negative values). User macros and low-level discovery macros can be used. The minimum value should be less than the maximum.
At least one value must exist.
If you mark the Custom on fail checkbox, the item will not become unsupported in case of failed preprocessing step and it is possible to specify custom error handling options: either to discard the value, set a specified value, or set a specified error message.
Matches regular expression Specify a regular expression that a value must match.
If you mark the Custom on fail checkbox, the item will not become unsupported in case of failed preprocessing step and it is possible to specify custom error handling options: either to discard the value, set a specified value, or set a specified error message.
Does not match regular expression Specify a regular expression that a value must not match.
If you mark the Custom on fail checkbox, the item will not become unsupported in case of failed preprocessing step and it is possible to specify custom error handling options: either to discard the value, set a specified value, or set a specified error message.
Check for error in JSON Check for an application-level error message located at JSONpath. Stop processing if succeeded and the message is not empty; otherwise, continue processing with the value that was before this preprocessing step. Note that these external service errors are reported to the user as is, without adding preprocessing step information.
No error will be reported in case of failing to parse invalid JSON.
If you mark the Custom on fail checkbox, the item will not become unsupported in case of failed preprocessing step and it is possible to specify custom error handling options: either to discard the value, set a specified value, or set a specified error message.
Check for error in XML Check for an application-level error message located at XPath. Stop processing if succeeded and the message is not empty; otherwise, continue processing with the value that was before this preprocessing step. Note that these external service errors are reported to the user as is, without adding preprocessing step information.
No error will be reported in case of failing to parse invalid XML.
If you mark the Custom on fail checkbox, the item will not become unsupported in case of failed preprocessing step and it is possible to specify custom error handling options: either to discard the value, set a specified value, or set a specified error message.
Check for error using a regular expression Check for an application-level error message using a regular expression. Stop processing if succeeded and the message is not empty; otherwise, continue processing with the value that was before this preprocessing step. Note that these external service errors are reported to the user as is, without adding preprocessing step information.
Parameters:
pattern - regular expression
output - output formatting template. An \N (where N=1…9) escape sequence is replaced with the Nth matched group. A \0 escape sequence is replaced with the matched text.
If you mark the Custom on fail checkbox, the item will not become unsupported in case of failed preprocessing step and it is possible to specify custom error handling options: either to discard the value, set a specified value, or set a specified error message.
Check for not supported value Check if there was an error in retrieving item value. Normally that would lead to the item turning unsupported, but you may modify that behavior by specifying the Custom on fail error-handling options: to discard the value, to set a specified value (in this case the item will stay supported and the value can be used in triggers) or set a specified error message. Note that for this preprocessing step, the Custom on fail checkbox is grayed out and always marked.
This step is always executed as the first preprocessing step and is placed above all others after saving changes to the item. It can be used only once.
Supported since 5.2.0.
Throttling
Discard unchanged Discard a value if it has not changed.
If a value is discarded, it is not saved in the database and Zabbix server has no knowledge that this value was received. No trigger expressions will be evaluated, as a result, no problems for related triggers will be created/resolved. Functions will work only based on data that is actually saved in the database. As trends are built based on data in the database, if there is no value saved for an hour then there will also be no trends data for that hour.
Only one throttling option can be specified for an item.
Note that it is possible for items monitored by Zabbix proxy that very small value differences (less than 0.000001) are correctly not discarded by proxy, but are stored in the history as the same value if the Zabbix server database has not been upgraded.
Discard unchanged with heartbeat Discard a value if it has not changed within the defined time period (in seconds).
Positive integer values are supported to specify the seconds (minimum - 1 second). Time suffixes can be used in this field (e.g. 30s, 1m, 2h, 1d). User macros and low-level discovery macros can be used in this field.
If a value is discarded, it is not saved in the database and Zabbix server has no knowledge that this value was received. No trigger expressions will be evaluated, as a result, no problems for related triggers will be created/resolved. Functions will work only based on data that is actually saved in the database. As trends are built based on data in the database, if there is no value saved for an hour then there will also be no trends data for that hour.
Only one throttling option can be specified for an item.
Note that it is possible for items monitored by Zabbix proxy that very small value differences (less than 0.000001) are correctly not discarded by proxy, but are stored in the history as the same value if the Zabbix server database has not been upgraded.
Prometheus
Prometheus pattern Use the following query to extract required data from Prometheus metrics.
See Prometheus checks for more details.
Prometheus to JSON Convert required Prometheus metrics to JSON.
See Prometheus checks for more details.

保存前処理のステップの変更と調整のために、Zabbixは必要に応じて新しい値を計算/比較するために、最後の値を覚えておく必要があります。これらの以前の値は保存前処理マネージャによって処理されます。Zabbixサーバまたはプロキシを再起動した場合、または保存前処理ステップを変更した場合、Zabbixは最後の値を記憶し、必要に応じて新しい値を計算/比較します。

  • 差分1秒あたりの差分 ステップの場合、次の値は無視されます。
    次の値は、変化量を計算する前の値がないため、無視されます。
  • 変更がなければ破棄指定病内に変化がなければ破棄ステップの場合、
    次の値は、たとえ破棄される必要があったとしても、破棄されることはありません。

アイテムのデータ型パラメータは、少なくとも1つの保存前処理工程が定義されている場合、タブの下部に表示されます。
必要であれば、保存前処理タブを開いたまま情報の種類を変更することができます。
アイテムの作成 を参照してください。

カスタム倍率を使用する場合、または値を 1秒当たりの差分 として保存する場合、数値(整数)に設定されている項目で、計算結果の値が実際には浮動小数点数であっても、小数点以下を切り捨てて整数値として格納することで、正しい値として扱われます。

Supported transformations

All supported transformations are listed below. Click on the transformation name to see full details about it.

Name Description Type
Regular expression Match the value to the regular expression and replace with the required output. Text
Replace Find the search string and replace it with another (or nothing).
Trim Remove specified characters from the beginning and end of the value.
Right trim Remove specified characters from the end of the value.
Left trim Remove specified characters from the beginning of the value.
XML XPath Extract value or fragment from XML data using XPath functionality. Structured data
JSON Path Extract value or fragment from JSON data using JSONPath functionality.
CSV to JSON Convert CSV file data into JSON format.
XML to JSON Convert data in XML format to JSON.
SNMP walk value Extract value by the specified OID/MIB name. SNMP
SNMP walk to JSON Convert SNMP values to JSON.
Custom multiplier Multiply the value by the specified integer or floating-point value. Arithmetic
Simple change Calculate the difference between the current and previous value. Change
Change per second Calculate the value change (difference between the current and previous value) speed per second.
Boolean to decimal Convert the value from boolean format to decimal. Numeral systems
Octal to decimal Convert the value from octal format to decimal.
Hexadecimal to decimal Convert the value from hexadecimal format to decimal.
JavaScript Enter JavaScript code. Custom scripts
In range Define a range that a value should be in. Validation
Matches regular expression Specify a regular expression that a value must match.
Does not match regular expression Specify a regular expression that a value must not match.
Check for error in JSON Check for an application-level error message located at JSONPath.
Check for error in XML Check for an application-level error message located at XPath.
Check for error using a regular expression Check for an application-level error message using a regular expression.
Check for not supported value Check if there was an error in retrieving item value.
Discard unchanged Discard a value if it has not changed. Throttling
Discard unchanged with heartbeat Discard a value if it has not changed within the defined time period.
Prometheus pattern Use the following query to extract the required data from Prometheus metrics. Prometheus
Prometheus to JSON Convert the required Prometheus metrics to JSON.

Note that for Change and Throttling preprocessing steps, Zabbix has to remember the last value to calculate/compare the new value as required. These previous values are handled by the preprocessing manager. If Zabbix server or proxy is restarted or there is any change made to preprocessing steps, the last value of the corresponding item is reset, resulting in:

  • for Simple change, Change per second steps - the next value will be ignored because there is no previous value to calculate the change from;
  • for Discard unchanged, Discard unchanged with heartbeat steps - the next value will never be discarded, even if it should have been because of discarding rules.
Regular expression

Match the value to the regular expression and replace with the required output.

Parameters:

  • pattern - the regular expression;
  • output - the output formatting template. An \N (where N=1…9) escape sequence is replaced with the Nth matched group. A \0 escape sequence is replaced with the matched text.

Comments:

  • A failure to match the input value will make the item unsupported;
  • The regular expression supports extraction of maximum 10 captured groups with the \N sequence;
  • If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.
  • Please refer to regular expressions section for some existing examples.
Replace

Find the search string and replace it with another (or nothing).

Parameters:

  • search string - the string to find and replace, case-sensitive (required);
  • replacement - the string to replace the search string with. The replacement string may also be empty effectively allowing to delete the search string when found.

Comments:

  • All occurrences of the search string will be replaced;
  • It is possible to use escape sequences to search for or replace line breaks, carriage return, tabs and spaces "\n \r \t \s"; backslash can be escaped as "\\" and escape sequences can be escaped as "\\n";
  • Escaping of line breaks, carriage return, tabs is automatically done during low-level discovery.
Trim

Remove specified characters from the beginning and end of the value.

Right trim

Remove specified characters from the end of the value.

Left trim

Remove specified characters from the beginning of the value.

XML XPath

Extract value or fragment from XML data using XPath functionality.

Comments:

  • For this option to work, Zabbix server (or Zabbix proxy) must be compiled with libxml support;
  • Namespaces are not supported;
  • If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.

Examples:

number(/document/item/value) #will extract '10' from <document><item><value>10</value></item></document>
       number(/document/item/@attribute) #will extract '10' from <document><item attribute="10"></item></document>
       /document/item #will extract '<item><value>10</value></item>' from <document><item><value>10</value></item></document>
JSON Path

Extract value or fragment from JSON data using JSONPath functionality.

If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.

CSV to JSON

Convert CSV file data into JSON format.

For more information, see: CSV to JSON preprocessing.

XML to JSON

Convert data in XML format to JSON.

For more information, see: Serialization rules.

If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.

SNMP walk value

Extract value by the specified OID/MIB name and apply formatting options:

  • Unchanged - return hex-string as unescaped hex string;
  • UTF-8 from hex-STRING - convert hex-string to UTF-8 string;
  • MAC from hex-STRING - validate hex-string as MAC address and return a proper MAC address string (where ' ' are replaced by ':');
  • Integer from BITS - convert the first 8 bytes of a bit string expressed as a sequence of hex characters (e.g., "1A 2B 3C 4D") into a 64-bit unsigned integer. In bit strings longer than 8 bytes, consequent bytes will be ignored.

If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.

SNMP walk to JSON

Convert SNMP values to JSON.

Specify a field name in the JSON and the corresponding SNMP OID path. Field values will be populated by values in the specified SNMP OID path.

Comments:

  • Similar value formatting options as in the SNMP walk value step are available;
  • You may use this preprocessing step for SNMP OID discovery;
  • If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.
SNMP get value

Apply formatting options to the SNMP get value:

  • UTF-8 from Hex-STRING - convert hex-string to UTF-8 string;
  • MAC from Hex-STRING - validate hex-string as MAC address and return a proper MAC address string (where ' ' are replaced by ':');
  • Integer from BITS - convert the first 8 bytes of a bit string expressed as a sequence of hex characters (e.g., "1A 2B 3C 4D") into a 64-bit unsigned integer. In bit strings longer than 8 bytes, consequent bytes will be ignored.

If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.

Custom multiplier

Multiply the value by the specified integer or floating-point value.

Comments:

  • Use this option to convert values received in KB, MBps, etc., into B, Bps. Otherwise, Zabbix cannot correctly set prefixes (K, M, G, etc.).
  • Note that if the item type of information is Numeric (unsigned), incoming values with a fractional part will be trimmed (i.e., '0.9' will become '0') before the custom multiplier is applied;
  • If you use a custom multiplier or store value as Change per second for items with the type of information set to Numeric (unsigned) and the resulting calculated value is actually a float number, the calculated value is still accepted as a correct one by trimming the decimal part and storing the value as an integer;
  • Supported: scientific notation, for example, 1e+70; user macros and LLD macros; strings that include macros, for example, {#MACRO}e+10, {$MACRO1}e+{$MACRO2}. The macros must resolve to an integer or a floating-point number.
  • If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.
Simple change

Calculate the difference between the current and previous value.

Comments:

  • This step can be useful to measure a constantly growing value;
  • Evaluated as value-prev_value, where value - the current value; prev_value - the previously received value;
  • Only one change operation per item ("Simple change" or "Change per second") is allowed;
  • If the current value is smaller than the previous value, Zabbix discards that difference (stores nothing) and waits for another value;
  • If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.
Change per second

Calculate the value change (difference between the current and previous value) speed per second.

Comments:

  • This step is extremely useful to get the speed per second of a constantly growing value;
  • As this calculation may produce floating-point numbers, it is recommended to set the 'Type of information' to Numeric (float), even if the incoming raw values are integers. This is especially relevant for small numbers where the decimal part matters. If the floating-point values are large and may exceed the 'float' field length in which case the entire value may be lost, it is actually suggested to use Numeric (unsigned) and thus trim only the decimal part.
  • Evaluated as (value-prev_value)/(time-prev_time), where value - the current value; prev_value - the previously received value; time - the current timestamp; prev_time - the timestamp of the previous value;
  • Only one change operation per item ("Simple change" or "Change per second") is allowed;
  • If the current value is smaller than the previous value, Zabbix discards that difference (stores nothing) and waits for another value. This helps to work correctly with, for instance, a wrapping (overflow) of 32-bit SNMP counters.
  • If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.
Boolean to decimal

Convert the value from boolean format to decimal.

Comments:

  • The textual representation is translated into either 0 or 1. Thus, 'TRUE' is stored as 1 and 'FALSE' is stored as 0. All values are matched in a case-insensitive way. Currently recognized values are, for TRUE - true, t, yes, y, on, up, running, enabled, available, ok, master; for FALSE - false, f, no, n, off, down, unused, disabled, unavailable, err, slave. Additionally, any non-zero numeric value is considered to be TRUE and zero is considered to be FALSE.
  • If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.
Octal to decimal

Convert the value from octal format to decimal.

If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.

Hexadecimal to decimal

Convert the value from hexadecimal format to decimal.

If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.

JavaScript

Enter JavaScript code in the block that appears when clicking in the parameter field or on the pencil icon.

Comments:

In range

Define a range that a value should be in by specifying minimum/maximum values (inclusive).

Comments:

  • Numeric values are accepted (including any number of digits, optional decimal part and optional exponential part, negative values);
  • The minimum value should be less than the maximum;
  • At least one value must exist;
  • User macros and low-level discovery macros can be used;
  • If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.
Matches regular expression

Specify a regular expression that a value must match.

If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.

Does not match regular expression

Specify a regular expression that a value must not match.

If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.

Check for error in JSON

Check for an application-level error message located at JSONPath. Stop processing if succeeded and the message is not empty; otherwise, continue processing with the value that was before this preprocessing step.

Comments:

  • These external service errors are reported to the user as is, without adding preprocessing step information;
  • No error will be reported in case of failing to parse invalid JSON;
  • If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.
Check for error in XML

Check for an application-level error message located at XPath. Stop processing if succeeded and the message is not empty; otherwise, continue processing with the value that was before this preprocessing step.

Comments:

  • These external service errors are reported to the user as is, without adding preprocessing step information;
  • No error will be reported in case of failing to parse invalid XML;
  • If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.
Check for error using a regular expression

Check for an application-level error message using a regular expression. Stop processing if succeeded and the message is not empty; otherwise, continue processing with the value that was before this preprocessing step.

Parameters:

  • pattern - the regular expression;
  • output - the output formatting template. An \N (where N=1…9) escape sequence is replaced with the Nth matched group. A \0 escape sequence is replaced with the matched text.

Comments:

  • These external service errors are reported to the user as is, without adding preprocessing step information;
  • If you mark the Custom on fail checkbox, it is possible to select custom error-handling options: either to discard the value, set a specified value, or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected.
Check for not supported value

Check if there was an error in retrieving item value.

Comments:

  • Normally that would lead to the item becoming unsupported, but you may modify that behavior by specifying the Custom on fail error-handling options: to discard the value, to set a specified value (that can also be used in triggers) or set a specified error message. In case of a failed preprocessing step, the item will not become unsupported if the option to discard the value or set a specified value is selected. Note that for this preprocessing step, the Custom on fail checkbox is grayed out and always marked.
  • This step is always executed as the first preprocessing step and is placed above all others after saving changes to the item. It can be used only once.
Discard unchanged

Discard a value if it has not changed.

Comments:

  • If a value is discarded, it is not saved in the database and Zabbix server has no knowledge that this value was received. No trigger expressions will be evaluated, as a result, no problems for related triggers will be created/resolved. Functions will work only based on data that is actually saved in the database. As trends are built based on data in the database, if there is no value saved for an hour then there will also be no trends data for that hour.
  • Only one throttling option can be specified per item.
Discard unchanged with heartbeat

Discard a value if it has not changed within the defined time period (in seconds).

Comments:

  • Positive integer values are supported to specify the seconds (minimum - 1 second);
  • Time suffixes can be used (e.g., 30s, 1m, 2h, 1d);
  • User macros and low-level discovery macros can be used;
  • If a value is discarded, it is not saved in the database and Zabbix server has no knowledge that this value was received. No trigger expressions will be evaluated, as a result, no problems for related triggers will be created/resolved. Functions will work only based on data that is actually saved in the database. As trends are built based on data in the database, if there is no value saved for an hour then there will also be no trends data for that hour.
  • Only one throttling option can be specified per item.
Prometheus pattern

Use the following query to extract the required data from Prometheus metrics.

See Prometheus checks for more details.

Prometheus to JSON

Convert the required Prometheus metrics to JSON.

See Prometheus checks for more details.

Macro support

User macros and user macros with context are supported in the preprocessing parameters, including JavaScript code.

The macro context is ignored when a macro is replaced with its value. The macro value is inserted in the code as is, it is not possible to add additional escaping before placing the value in the JavaScript code. Please be advised that this can cause JavaScript errors in some cases.

Testing

See preprocessing testing.