Ad Widget

Collapse

Pre-processing string replacement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PeterZielony
    Senior Member
    • Nov 2022
    • 146

    #1

    Pre-processing string replacement

    Can't think of how it would be possible but I have a scenario where I got an item trapper that is receiving values from Windows task scheduler based on event IDs firewall with custom XML filtering (added/removed/modified)

    This is an example of the string (can modify it however I want)
    Firewall rule on test.host has been changed. Rule name: test. Current IP addresses: 127.0.0.1,8.8.8.8 Direction: Outbound. User: Zoidberg.The.Doctor

    Now I wanted to replace IPs with actual server names from Macro value pairs? Is it even possible w/o javascript? (i know macro doesn't work like that but just looking for another way)

    i wanted to have one list/macro with those IPs so I can match it with IPs using one list rather than listing "replace" preprocessing with 300+ IP:servers on template level


    if its not possible in zabbix i would have to write some ps script on host to replace them but again if we will need add one server Ill have to replace 300+hosts scripts files.
    or list ..replace In preprocessing 300 times..(not sure how zabbix will handle it)


    Side question .. can we use macro values in javascript?
    Last edited by PeterZielony; 05-07-2023, 13:39.

    Hiring in the UK? Drop a message
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    about macro in js - https://www.zabbix.com/documentation...ros-in-scripts

    Comment

    • PeterZielony
      Senior Member
      • Nov 2022
      • 146

      #3
      Originally posted by Hamardaban
      Thanks.

      So i could have a macro IP:HOSTNAME,IP2:HOSTNAME,etc.. like csv so i can easly modify it

      In js load it up, compare left side and replace with hostname with one macro in template.

      I guess that would do


      Hiring in the UK? Drop a message

      Comment

      • Hamardaban
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • May 2019
        • 2713

        #4
        Yes - such cases of working with macros have been met on the forum - everything works (if you know how to work with JS :-) )

        Comment

        Working...