I am pretty new to the Prometheus and not sure how I am going to ping the endpoint with authentication. Not sure my problem could be solved by built-in prometheus configs, let me describe the flow I would like to achieve:
(1) send http POST with {username, password} to api endpoint company.com/auth
(2) should retrieve {access_tokens, refresh_token...} of Bearer token type
(3) preserve this access_token and direct to other pages. All the other endpoints should only be pinged, if the access_token is already there and correct.
(4)After authentication, it should still send the http request at some frequency and output the metrics just as the blackbox-exporter do.
Basically I am trying to mimic the same procedure for sequence of API calls in Postman tests. I've seen config of blackbox-exporter of basic_auth and bearer_token, but not sure how to actually setup the params and how to redirect to other pages.
(Should I set the basic_auth username and password according to (1)? Where the token is returned? And should I replace the token to bearer_token?)
Any guidance on this would be great! I am pretty new to the whole process, sorry if the question is too fundamental or ambiguous. Thanks in advance and really appreciate any help!
Step 2/3 requires running Javascript, which the Blackbox exporter cannot do.
The Blackbox exporter will follow redirects automatically, use URL parameters, and send bearer tokens but you need to know what you want to send in advance. You might have some luck with https://github.com/mattbostock/webdriver_exporter, you could write your own exporter, or look for a simpler blackbox test that the blackbox exporter can execute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With