Ad Widget

Collapse

Use output from 1 HTTP Agent Item in Another HTTP Agent Item

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chris5h
    Junior Member
    • Feb 2024
    • 1

    #1

    Use output from 1 HTTP Agent Item in Another HTTP Agent Item

    Hi everyone. New to Zabbix and trying to figure something out.

    I am trying to set up a series of HTTP Agent items to test various methods of an API endpoint. The first step is to hit an authorization endpoint to get an auth token, and then use that as the bearer token in all the other methods. I got that to work, but I do not know how to "reference" that value to the test of the items.

    I tried setting up a Macro, but I do not see any method of setting the Macros value within the item itself.

    I tried updating an Inventory field (i used "Type") with the authentication item, which did work in updating that field to the auth token, but when I tried using the field {INVENTORY.TYPE} inside of the second item, it sent it as a string literal (literally header was sent as "Authorization Bearer {INVENTORY.TYPE} ")

    Can anyone point me in the right direction here?

    Thanks in advance everyone.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    You cannot use one items value in other items parameters.. Your best option is probably to use script type item, and make those calls in JS there, so you can reference obtained token inside same script...

    Not every macro can be used whereever. you can see places where you can use them, here https://www.zabbix.com/documentation...ed_by_location

    Comment

    Working...