Ad Widget

Collapse

Cannot extract value of "{sid}" from response

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Zabo
    Junior Member
    • Dec 2019
    • 2

    #1

    Cannot extract value of "{sid}" from response

    In creating Web URL monitors that require login, whether on our internal apps, or in the Zabbix Documentation Real life scenario under Web Monitoring - We always with this error: Step "Login in" [2 of 5] failed: error in step variables "{sid}=regex:name="csrf-token" content="([0-9a-z]{16})"": cannot extract the value of "{sid}" from response. Is the regex supposed to be used identically to the Real life scenario documentation for Zabbix Front End? Or, will we need to alter that in some way? If we are to use the regex command as stated in the document, what might we have configured incorrectly to always receive this error? Any feedback will be appreciated. Thank you.
  • 1berto
    Senior Member
    • Sep 2018
    • 182

    #2
    1) Are you sure that your connection is working (can you read it using curl and the same parameters) ? If yes...
    2) Using sed in the response, the result is what you expect?
    3) I don't use web scenarios a log, but i think the double quotes in your example are ambiguous ...

    Comment

    • skione13
      Junior Member
      • Mar 2020
      • 3

      #3
      The documentation examples enclose the regex in quotes, I have since found out you shouldn't do this. At this point I went the route of parsing the value using a php script and then calling that script to get the form_key. I have a simple line: regex:[0-9a-zA-Z]{16}

      You can see the file retrieved here (this is for POC and will be locked down once I get it working): http://54.158.136.254/get-form-key.php

      To parse a value such as this: http://sanitized/get-form-key.php

      I verified the regex will get the value but zabbix is still showing:
      Error: error in step variables "{formkey}=regex:[0-9a-zA-Z]{16}": cannot extract the value of "{formkey}" from response
      It's really quite puzzling
      Last edited by skione13; 11-03-2020, 19:38.

      Comment


      • tim.mooney
        tim.mooney commented
        Editing a comment
        As I responded elsewhere, part of the problem with your specific regex is that you're not *capturing* anything. You have no ( ) anywhere, to capture (remember) the part that matched.

      • StevenColombia
        StevenColombia commented
        Editing a comment
        Hi, was you tried extract the value to the variable form_key to sign in?
    • skione13
      Junior Member
      • Mar 2020
      • 3

      #4
      Thanks Tim! I put the regex inside the parens and now I am getting an OK but I have tried various times using that, not sure what I was doing wrong. Also the examples in the web scenario section of the docs don't show this.

      Comment


      • StevenColombia
        StevenColombia commented
        Editing a comment
        Hi Skione, I'm try login and Thanks to this forum I was able to obtain the form_key and it does not show an error, but when validating a keyword on the page that is only displayed on it, it is not found, so I assume that it has not been logged in, could you help me?
    • tim.mooney
      Senior Member
      • Dec 2012
      • 1427

      #5
      The examples I see show using parens, both in https://www.zabbix.com/documentation...web_monitoring and in https://www.zabbix.com/documentation...toring/example .

      The web_monitoring section on "Variables" says specifically:

      At least one subgroup must be present so that the matched value can be extracted.

      Comment

      Working...