Ad Widget

Collapse

How to monitor an endpoint protected by OAuth 2.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Viman
    Junior Member
    • Sep 2021
    • 2

    #1

    How to monitor an endpoint protected by OAuth 2.0

    Hello,

    Could anyone share a step-by-step process about how to:

    1. Send a HTTP POST request to an authorization endpoint.
    2. Read the response body and store the value of an acces_token
    3. Use that access token as an Auth to authenticate later requests to an HTTP endpoint

    I tried with Items HTTP Agent type however I cannot find a way to dynamically obtain an acces_token and use it on subsequent requests.

    Thank you,
    Vi
    Last edited by Viman; 08-10-2021, 16:55.
  • Boune
    Junior Member
    • Jul 2021
    • 13

    #2
    Hello Viman,

    i tried different method but the only way is to :

    - Write an "External Script" to get your token authentication , and then past it to an "Host Macro"
    - When you create a host you have to define a custom Macro like {$TOKEN} with blank value and define a macro {$HOSTID} with the HOSTID value at the end of the zabbix web page url. (exemple 10471) ( http://localhost/zabbix/hosts.php?fo...e&hostid=10471)
    - In this script you need to :
    - Make your HTTP POST Request and store the value you need.
    - Make Request to Zabbix API to get "HostMacroID" and store the value. You will need the HOSTID for this request
    - Then push the token value to the macro $Token with the previous HostMacroID value you get.

    Then in your item host configuration , call this external script.

    Sry for my english




    Comment

    Working...