This is the documentation page for an unsupported version of Zabbix.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.

5 CSV to JSON preprocessing


In this preprocessing step it is possible to convert CSV file data into JSON format. It's supported in:

  • items (item prototypes)
  • low-level discovery rules


To configure a CSV to JSON preprocessing step:

  • Go to the Preprocessing tab in item/discovery rule configuration
  • Click on Add
  • Select the CSV to JSON option

The first parameter allows to set a custom delimiter. Note that if the first line of CSV input starts with "Sep=" and is followed by a single UTF-8 character then that character will be used as the delimiter in case the first parameter is not set. If the first parameter is not set and a delimiter is not retrieved from the "Sep=" line, then a comma is used as a separator.

The second optional parameter allows to set a quotation symbol.

If the With header row checkbox is marked, the header line values will be interpreted as column names (see Header processing for more information).

If the Custom on fail checkbox is marked, the item will not become unsupported in case of a failed preprocessing step. Additionally custom error handling options may be set: discard the value, set a specified value or set a specified error message.

Header processing

The CSV file header line can be processed in two different ways:

  • If the With header row checkbox is marked - header line values are interpreted as column names. In this case the column names must be unique and the data row should not contain more columns than the header row;
  • If the With header row checkbox is not marked - the header line is interpreted as data. Column names are generated automatically (1,2,3,4...)

CSV file example:

Nr,Item name,Key,Qty
       1,active agent item,agent.hostname,33
       "2","passive agent item","agent.version","44"
       3,"active,passive agent items",,55

A quotation character within a quoted field in the input must be escaped by preceding it with another quotation character.

Processing header line

JSON output when a header line is expected:

             "Item name":"active agent item",
             "Item name":"passive agent item",
             "Item name":"active,passive agent items",

No header line processing

JSON output when a header line is not expected:

             "2":"Item name",
             "2":"active agent item",
             "2":"passive agent item",
             "2":"active,passive agent items",