Ad Widget

Collapse

web monitoring with regex

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • millerlu
    Junior Member
    • Jan 2020
    • 4

    #1

    web monitoring with regex

    I am trying to setup web monitoring where I need to capture the value of the output in step 1 to use in step 2. It looks like I can do that with regex and have it set a variable but I am having problems making it work.
    When I test this via curl my part of my output looks like this:
    ms":[{"accessId":"d8b9b11e-bc8c-4a81-b7c0-5ca345c9fe0b","exp
    That access ID is what I want to capture to a variable.
    I tried doing something like this:
    {accessId} = regex:name="accessId" content="(accessId":"(.*)",))"

    But Zabbix says it can't extract the value of accessId from the output. What do I need to do in order to get this to match?
    Thanks,
    Luke

  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    The web monitoring documentation could definitely use additional examples for how to capture page contents in various formats. The real-world example is a great start, but leaves unanswered questions for many, I think.

    Do either of these regexes work to capture the part you want?

    Code:
    regex:"accessId":"([^"]+)"
    Code:
    regex:name="accessId" content="([^"]+)"

    Comment

    • millerlu
      Junior Member
      • Jan 2020
      • 4

      #3
      I got it working with this:

      Code:
      regex:accessId":"([0-9a-z-]+)
      I agree that more examples would be helpful. I was thinking I needed the name and content parts when I really don't.

      Thanks,
      Luke

      Comment

      Working...