Ad Widget

Collapse

json data and preprocessiong regex for text substituion in Discorvery rule

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nel23FX
    Junior Member
    • Feb 2021
    • 10

    #1

    json data and preprocessiong regex for text substituion in Discorvery rule

    hello,

    using Zabbix 4.4

    I have a discovery rule

    discovery[{#SNMPVALUE},IF-MIB::ifDescr]

    for a device that retrieve json structured data like

    [{"{#SNMPINDEX}":"1","{#SNMPVALUE}":"eth_base"},{"{ #SNMPINDEX}":"2","{#SNMPVALUE}":"eth0"}}]

    I wan't to substitute "eth_base" with "interface toto" and "eth0" with "interface titi"

    How can I do it with regexp preprocessing rule ?
  • Andycole
    Junior Member
    • Jun 2021
    • 1

    #2
    Information may be a plain number, a string, some text, JSON arrays, or even SQL queries. ... So, data preprocessing is used not only in machine learning, but for ... a regular expression to extract the word 'error', then replace it with '0', ... to JSON and then put your CSV yo use in a low-level discovery rule.

    Comment

    • Nel23FX
      Junior Member
      • Feb 2021
      • 10

      #3
      I don't understand what you are talking about.

      I have made it with a javascript preprocessing rule.

      But I thought I could do it whit regexp.


      In fact I'm talking about a SNMP discovery in a template rule in order to create item prototype.

      In the discovery rule of the template the SNMP OID is :

      discovery[{#SNMPVALUE},IF-MIB::ifDescr]

      and it generate a json structured string : [{"{#SNMPINDEX}":"1","{#SNMPVALUE}":"eth_base"}, {"{ #SNMPINDEX}":"2","{#SNMPVALUE}":"eth0"}}] for my switch

      I want to substitue "eth_base" to WAN1 for example. So when Item prototype generate Item they will be named as WAN1 instead of eth_base by using the preprocessed {#SNMPVALUE} value.

      Does regexp preprocessing works fine to do it? and what to write ? ^*eth_base$ output: "WAN1" ? Javascript rules but I want to use regexp

      Comment

      Working...