diff options
author | Andris Zeila <andris.zeila@zabbix.com> | 2018-10-19 14:03:43 +0300 |
---|---|---|
committer | Andris Zeila <andris.zeila@zabbix.com> | 2018-10-19 14:03:43 +0300 |
commit | 755091f798cc252aa5ea437b6d8ad7c444ffba89 (patch) | |
tree | f1c9326a1e0059a0f39df41a1edbbb6dbf4b6f45 /tests | |
parent | 4a41d695e07d9364d1730c8442b7cf0a753ebc0e (diff) |
........S. [ZBXNEXT-4724] added error extraction preprocessing options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/zabbix_server/preprocessor/zbx_item_preproc.yaml | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/tests/zabbix_server/preprocessor/zbx_item_preproc.yaml b/tests/zabbix_server/preprocessor/zbx_item_preproc.yaml index 8ed7a0f0680..d1c5f09ca4f 100644 --- a/tests/zabbix_server/preprocessor/zbx_item_preproc.yaml +++ b/tests/zabbix_server/preprocessor/zbx_item_preproc.yaml @@ -1127,6 +1127,154 @@ in: out: return: FAIL error: custom error +--- +test case: jsonerror(x, $.error) +in: + value: + value_type: ITEM_VALUE_TYPE_STR + time: 2017-10-29 03:15:00 +03:00 + data: x + step: + type: ZBX_PREPROC_ERROR_FIELD_JSON + params: $.error +out: + return: SUCCEED + value: x +--- +test case: jsonerror({"error":"error message"}, $error) +in: + value: + value_type: ITEM_VALUE_TYPE_STR + time: 2017-10-29 03:15:00 +03:00 + data: |- + {"error":"error message"} + step: + type: ZBX_PREPROC_ERROR_FIELD_JSON + params: $error +out: + return: FAIL +--- +test case: jsonerror({"data":"123"}, $.error) +in: + value: + value_type: ITEM_VALUE_TYPE_STR + time: 2017-10-29 03:15:00 +03:00 + data: |- + {"data":"123"} + step: + type: ZBX_PREPROC_ERROR_FIELD_JSON + params: $.error +out: + return: SUCCEED + value: |- + {"data":"123"} +--- +test case: jsonerror({"error":"error message"}, $.error) +in: + value: + value_type: ITEM_VALUE_TYPE_STR + time: 2017-10-29 03:15:00 +03:00 + data: |- + {"error":"error message"} + step: + type: ZBX_PREPROC_ERROR_FIELD_JSON + params: $.error +out: + return: FAIL + error: error message +--- +test case: xmlerror(x, //error) +in: + value: + value_type: ITEM_VALUE_TYPE_STR + time: 2017-10-29 03:15:00 +03:00 + data: x + step: + type: ZBX_PREPROC_ERROR_FIELD_XML + params: //error +out: + return: SUCCEED + value: x +--- +test case: xmlerror(<a><error>custom error</error></a>, "//text(") +in: + value: + value_type: ITEM_VALUE_TYPE_STR + time: 2017-10-29 03:15:00 +03:00 + data: <a><error>custom error</error></a> + step: + type: ZBX_PREPROC_ERROR_FIELD_XML + params: //text( +out: + return: FAIL +--- +test case: xmlerror(<a><error>custom error</error></a>, "//error/text()") +in: + value: + value_type: ITEM_VALUE_TYPE_STR + time: 2017-10-29 03:15:00 +03:00 + data: <a><error>custom error</error></a> + step: + type: ZBX_PREPROC_ERROR_FIELD_XML + params: //error/text() +out: + return: FAIL + error: custom error +--- +test case: xmlerror(<a><value>1</value></a>, "//error/text()") +in: + value: + value_type: ITEM_VALUE_TYPE_STR + time: 2017-10-29 03:15:00 +03:00 + data: <a><value>1</value></a> + step: + type: ZBX_PREPROC_ERROR_FIELD_XML + params: //error/text() +out: + return: SUCCEED + value: <a><value>1</value></a> +--- +test case: regexerror("error:123, "error:([0-9+)") +in: + value: + value_type: ITEM_VALUE_TYPE_STR + time: 2017-10-29 03:15:00 +03:00 + data: error:123 + step: + type: ZBX_PREPROC_ERROR_FIELD_REGEX + params: ([0-9+) +out: + return: FAIL +--- +test case: regexerror("error:123, "error:([0-9]+)") +in: + value: + value_type: ITEM_VALUE_TYPE_STR + time: 2017-10-29 03:15:00 +03:00 + data: error:123 + step: + type: ZBX_PREPROC_ERROR_FIELD_REGEX + params: |- + error:([0-9]+) + \1 +out: + return: FAIL + error: 123 +--- +test case: regexerror("value:123, "error:([0-9]+)") +in: + value: + value_type: ITEM_VALUE_TYPE_STR + time: 2017-10-29 03:15:00 +03:00 + data: value:123 + step: + type: ZBX_PREPROC_ERROR_FIELD_REGEX + params: |- + error:([0-9]+) + \1 +out: + return: SUCCEED + value: value:123 ... |