Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  2. ZBX-20977

Inconsistent behavior with resolving of user macros in webhook parameters names



    • Problem report
    • Status: Open
    • Trivial
    • Resolution: Unresolved
    • 6.0.5rc1, 6.2.0beta1
    • None
    • Server (S)


      Problem description: If user macros are used in webhook parameter name and webhook parameter value, then they are resolved when the webhook is triggered by an action, but are not resolved when webhook is trigerred in Test mode.
      For webhook parameter value this is no big deal, as the user can input its value by hand, but the webhook parameter name is used with a non-resolved user macro, and this cannot be changed in webhook test mode.

      Steps to reproduce:

      1. Create a host with an item and a trigger
      2. Create an Action that will send a notification when the created trigger goes in status problem.
      3. Create global user macro (for example: {$END}).
      4. Create webhook with Javascript = *Zabbix.Log(3, value); * and one of the parameters should use the created user macro both in its name and in its value (for example: name = URL {$END}, value = https://zabbix{$END}).
      5. Add all required message templates to this webhook.
      6. Add user media to Admin user that would use this webhook.
      7. Thigger the alarm in order for the webhook to get executed. Result - the macros are expanded both in the parameter name and value:
        1383489:20220429:172038.191 {"URL .com":"https://zabbix.com","HTTPProxy":"","To":"[email protected]","Subject":"Resolved in 41m 13s: Trapper trigger","Message":"Problem has been resolved at 17:20:34 on 2022.04.29\r\nProblem name: Trapper trigger\r\nProblem duration: 41m 13s\r\nHost: test\r\nSeverity: Warning\r\nOriginal problem ID: 35\r\n"}
      8. Open the list of Media types and press "Test" link for this webhook.
      9. Note that in the opened overlay dialog the user macro is not resolved in parameter name and in parameter value.
      10. Press test button and check log.

      Result: The user macro is not resolved in the record in the log file:

      1383490:20220429:172342.511 {"HTTPProxy":"","Message":"{ALERT.MESSAGE}","Subject":"{ALERT.SUBJECT}","To":"{ALERT.SENDTO}","URL {$END}":"https:\/\/zabbix{$END}"}

      Expected: Behavior in test mode should be the same as in actual webhook execution. From this point of view it looks like resolving user macros in webhook parameter names is a bad idea. I would suggest to restrict resolution of user macros in webhook parameter names.




            zabbix.dev Zabbix Development Team
            solonkins Sergejs Olonkins
            0 Vote for this issue
            2 Start watching this issue