I'm trying to configure health check using Items in Zabbix.
I use 2 items:
1) Item1 - "Type - HTTP agent". Making POST request with credentials to get response in JSON format with "access token". Then using preprocessing steps' JSON Path with parameters $
.
Checking Item1 in "Latest data" category I clearly see extracted token from JSON. I'm testing my GET request in attempt to authorize with this token from Item1 and it works well when using it manually.
2) Item2 - "Type - HTTP agent". I'm trying to get response body from GET request. Here I insert my health check URL and add into "headers" section "Authorization" "Bearer my_token_here".
Problem: My Bearer Token expires in 24 hours. I want to add my token into Item2 as variable. I tried a lot of options in headers: "Name:Authorization Value:Bearer {host.host:item.key.last()}".
Question: How to add last value "access token" from Item1 to "headers" section in form of "Name:Authorization Value:Bearer my_token_here"?
Error I'm getting from Item2 "Latest data":
{"error":{"code":"errorAuthorization","message":"U nauthorized","description":"Operation Failed. The authorization data is incorrect.","innerError":{"requestId":null,"date": "2020-03-15T18:33:44.2581078Z"}}}
I use 2 items:
1) Item1 - "Type - HTTP agent". Making POST request with credentials to get response in JSON format with "access token". Then using preprocessing steps' JSON Path with parameters $
Code:
.access_token
Checking Item1 in "Latest data" category I clearly see extracted token from JSON. I'm testing my GET request in attempt to authorize with this token from Item1 and it works well when using it manually.
2) Item2 - "Type - HTTP agent". I'm trying to get response body from GET request. Here I insert my health check URL and add into "headers" section "Authorization" "Bearer my_token_here".
Problem: My Bearer Token expires in 24 hours. I want to add my token into Item2 as variable. I tried a lot of options in headers: "Name:Authorization Value:Bearer {host.host:item.key.last()}".
Question: How to add last value "access token" from Item1 to "headers" section in form of "Name:Authorization Value:Bearer my_token_here"?
Error I'm getting from Item2 "Latest data":
{"error":{"code":"errorAuthorization","message":"U nauthorized","description":"Operation Failed. The authorization data is incorrect.","innerError":{"requestId":null,"date": "2020-03-15T18:33:44.2581078Z"}}}
Comment