Zabbix preprocessing: Difference between revisions

From DWIKI
Tony (talk | contribs)
Created page with "=Get data from a file= Item vfs.file.contents[/some/file] ==regular expression== ([0-9]+)\s+([0-9]+)\s+([0-9x]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\n [\4, \5, \6, \7]"
Tag: wikieditor
 
Tony (talk | contribs)
Tag: wikieditor
 
(3 intermediate revisions by the same user not shown)
Line 5: Line 5:
  ([0-9]+)\s+([0-9]+)\s+([0-9x]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\n  
  ([0-9]+)\s+([0-9]+)\s+([0-9x]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\n  
  [\4, \5, \6, \7]
  [\4, \5, \6, \7]
=LLD=
==LLD with javascript and CSV to JSON==
* https://www.zabbix.com/documentation/current/en/manual/config/items/preprocessing/csv_to_json
===Regular expression===
^ *(node0 .*)    \1
===Javascript===
var s=value.trim().split(/\s+/);
    var len = s.length;
    var ret = "{#NODE}";
    for ( i = 0;i < len;i++) {
        ret = ret + "\n";
        ret = ret + i;
    }
  return ret;
===CSV to JSON===
With header
=Javascript=
=FAQ=
==cannot perform regular expression "xx" match for value of type "string": pattern does not match==
[[Category:Zabbix]]

Latest revision as of 08:04, 13 April 2026

Get data from a file

Item

vfs.file.contents[/some/file]

regular expression

([0-9]+)\s+([0-9]+)\s+([0-9x]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\n 
[\4, \5, \6, \7]


LLD

LLD with javascript and CSV to JSON

Regular expression

^ *(node0 .*)     \1

Javascript

var s=value.trim().split(/\s+/);
   var len = s.length;
   var ret = "{#NODE}";
   for ( i = 0;i < len;i++) {
       ret = ret + "\n";
       ret = ret + i;
   }
 return ret;

CSV to JSON

With header

Javascript

FAQ

cannot perform regular expression "xx" match for value of type "string": pattern does not match