Regex in Zabbix 4.2 Web Scenario

Asked

Viewed 415 times

0

How to recover values with regex from the return of a web scenario in Zabbix that calls an API. Web Scenario is for testing web pages and Apis in Zabbix.

I already have the regular expression that recovers the value and according to the Zabbix documentation, I just need to pass the expression this way: regex: w{54} documentation, but it does not recover the Answer, it does not understand the expression. Below the step setting:

Error:

Error: error in step variables "{access_token}=regex:[A-Za-z0-9]{54} {be}=Bearer ": cannot extract the value of "{access_token}" from response

Return of the API, from which I need to recover the access_token:

inserir a descrição da imagem aqui

PRINT-CONFIGURAÇÃO-SCENARIO

  • put the part of the code referring to the error. So it is easier to understand and help you

  • so there’s no code itself, it’s td configured in Zabbix, I added the API’s Sponse, maybe that’s what you meant.

1 answer

0


After analyzing the documentation and finding a very scrotum example: inserir a descrição da imagem aqui

And finding q is not like this example, rs. Anyway it helped me, note that after the content="(.. has this parenthesis and that’s when I took the test and it worked, but look how was the final result:

inserir a descrição da imagem aqui

My rule of speech is: \w{54} and I tested as the documentation below, that it should be like this: regex:access_token is (\w{54}), but that doesn’t work, at least for my case:

inserir a descrição da imagem aqui

Summary: Use regex this way: regex:"(\w{54})" remembering that we are talking about the Zabbix Web Scenario and its regular expression should be inside the parentheses.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.