The preprocess mapping uses an xpath expression to separate a message into multiple messages. This mapping is the first one to be applied. The attributes that need to be set in a preprocess mapping are:

Attribute

Required

Description

from

Y

Defines the field name before mapping. To indicate the key needs to be preprocessed, it needs to include the suffix "[*]"

to

Y

Defines the field name after mapping.

precedence

N

Defines the precedence used when mapping.

Function typeYDefines the function type of the mapping. Needs to be "Message functions".

Function

Y

Defines the type of mapping. Needs to be "Preprocess".

The following example has one message with a result array in it. The preprocess mapping splits this message into multiple messages at the result element.

 

Image 1. Zabbix mapper with a preprocess mapping and other mappings. 

To test the mapper, wait a few seconds until the preprocess is applied. Then, use the Message section to view a test result message. The Test message (source message) will show an already preprocessed message.

The message before preprocessing (as gotten from Zabbix):

{
"jsonrpc": "2.0",
"result": [
{
"itemid": "23316",
"key_": "vm.memory.size[available]",
"name": "Available memory",
"type": "0",
"value_type": "3",
"units": "B",
"description": "Available memory is defined as free+cached+buffers memory.",
"hosts": [
{
"hostid": "10084",
"host": "acet-zabbix01",
"name": "acet-zabbix01"
}
],
"interfaces": [
{
"interfaceid": "1",
"ip": "127.0.0.1"
}
],
"lastclock": "1521460956",
"lastvalue": "3541180416"
},
{
"itemid": "23305",
"key_": "system.cpu.util[,system]",
"name": "CPU $2 time",
"type": "0",
"value_type": "0",
"units": "%",
"description": "The time the CPU has spent running the kernel and its processes.",
"hosts": [
{
"hostid": "10084",
"host": "acet-zabbix01",
"name": "acet-zabbix01"
}
],
"interfaces": [
{
"interfaceid": "1",
"ip": "127.0.0.1"
}
],
"lastclock": "1521460945",
"lastvalue": "0.1086"
}
]
}
JS

First message after preprocessing:

{
"jsonrpc": "2.0",
"result": {
"itemid": "23316",
"key_": "vm.memory.size[available]",
"name": "Available memory",
"type": "0",
"value_type": "3",
"units": "B",
"description": "Available memory is defined as free+cached+buffers memory.",
"hosts": [
{
"hostid": "10084",
"host": "acet-zabbix01",
"name": "acet-zabbix01"
}
],
"interfaces": [
{
"interfaceid": "1",
"ip": "127.0.0.1"
}
],
"lastclock": "1521460956",
"lastvalue": "3541180416"
}
JS

Second message after preprocessing:

{
"jsonrpc": "2.0",
"result":
{
"itemid": "23305",
"key_": "system.cpu.util[,system]",
"name": "CPU $2 time",
"type": "0",
"value_type": "0",
"units": "%",
"description": "The time the CPU has spent running the kernel and its processes.",
"hosts": [
{
"hostid": "10084",
"host": "acet-zabbix01",
"name": "acet-zabbix01"
}
],
"interfaces": [
{
"interfaceid": "1",
"ip": "127.0.0.1"
}
],
"lastclock": "1521460945",
"lastvalue": "0.1086"
}
JS