Ad Widget

Collapse

Is there a way to apply .regsub() to an LLD macro during the discovery assignment?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mdella
    Junior Member
    • Apr 2024
    • 8

    #1

    Is there a way to apply .regsub() to an LLD macro during the discovery assignment?

    In my "SNMP walk to JSON", I'm setting several {#MACRO} that are pulled out for usage in my items. However I want to do a trim operation (or regex) to remove the last character of a couple of the macros (but in the OS that I'm scanning, it adds a "." to the end of the strings it downloads. Can't get the vendor to fix this but was wondering of I could do it in the discovery).

    Currently I'm doing this to all my tags since I can't seem to figure out how to do it at the macro creation point:
    {{#CIT.NAME}.regsub("^[-a-zA-Z0-9]+",\0)}

    Copying and pasting this into each and every Item/Trigger that I need it in seems wasteful when if I could do this right at the discovery point, then I could just use {#CIT.NAME} everywhere

    Marcos
Working...