Ad Widget

Collapse

User macro in trapper item does not expand

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hansv
    Junior Member
    • Jun 2011
    • 3

    #1

    User macro in trapper item does not expand

    Hi there,

    I've setup a template with a user macro like so:

    {$PROCNAME} => zabbix_agentd

    In the template I've created a couple of items. One is of type zabbix-agent, having this key:

    sw.proc.status.procname[{$PROCNAME}]

    This fires a script that is defined as a UserParameter. The script does some work (gathers stats in /proc for a process (zabbix_agentd, in this example)) and sends data back with zabbix_sender.

    The rest of the items in the template are set up as type zabbix-trapper, like so:

    sw.proc.utime[{$PROCNAME}]
    sw.proc.rss[{$PROCNAME}]

    Now, the sw.proc.status.procname[{$PROCNAME}] expands to sw.proc.status.procname[zabbix_agentd], according to the server debug log.

    As soon as it queries the client, the client sends its data, like so:

    - sw.proc.utime[zabbix_agentd] 168
    - ...

    The server responds with:
    info":"Processed 0 Failed 9 ...

    I suspect that the macro isn't being expanded here, as I thought it would.

    When I change this item to:
    sw.proc.utime[{$PROCNAME}]
    to this:
    sw.proc.utime[zabbix_agentd]

    The server responds with:
    info":"Processed 1 Failed 8 ...

    So, it does work when the key parameter is set to a static value, instead of a user macro.

    Is this intentional, or am I hitting a bug?

    Edit: I'm using v1.8.4

    Cheers,
    - hans
    Last edited by hansv; 30-06-2011, 13:18. Reason: Addendum
  • FonTim
    Junior Member
    • Jan 2013
    • 15

    #2
    I'm seeing the same issue on 2.2 still - did you get any resolution to this?

    Comment

    • steveboyson
      Senior Member
      • Jul 2013
      • 582

      #3
      Works here , both in 2.0.10 and 2.2.1

      (just a question: you are not using {$PROCNAME} within your script, right? What happens if you send the value manually via "zabbix-send"?)

      Comment

      • FonTim
        Junior Member
        • Jan 2013
        • 15

        #4
        Not the OP, but I raised a ZBX bug about this, and it got marked as a duplicate of a previous Won't Fix ticket.



        As you can see by my examples, I manually send with zabbix_sender and item with key trap.test[macro] with the server trapper item key trap.test[{$MACROTEST}] and {$MACROTEST} = macro in the host user macros.

        on the ticket, richlv suggests using LLD instead, so I am making my script emit the nessicary JSON items that it will later populate with zabbix_sender...

        Comment

        Working...