Ad Widget

Collapse

Send web scenario step response in email

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tadija
    Junior Member
    • Feb 2022
    • 1

    #1

    Send web scenario step response in email

    Hello, first of all thank you guys for all the hard work and advice you are providing!

    tl dr:
    Is there a way to send the response the web scenario received in the alert email?

    I've check the trigger macros but could not find a thing to use: https://www.zabbix.com/documentation...onfig/macros?s

    Why do I need this?

    I'm monitoring an application which exposes a health-check API endpoint which returns a JSON object with about 6 properties providing app health info. I'd like to get alerted if the app reports any issues on this API.

    I've set up the web scenario and triggers that send me emails at the right event and it all seems to be working fine. Email are coming, grafs are being drawn - great! Even the problem resolution condition is working fine.

    Since I don't want too many requests to be sent to the API and because I'm using a low check interval (5 sec) I configured the web scenario to use only ONE step which uses a regex to parse the response and check all 6 JSON params. If everything is working fine I'm always expecting the same result.

    "All is fine" response example:
    Code:
    { "foo":true, "bar":false }
    The step regex looks like :
    Code:
    "^.*foo":true.*bar":false.*$"
    With this setup when the "web scenario step failed" email arrives I get the info that something is not right, but I do not know which property is wrong i.e. is foo wrong or is bar wrong or both - all I know is that something in the response is not as expected

    I've considered adding more web scenario steps, one for each response property, but I'd like to avoid sending that many requests every 5 sec.

    Seeing the response that the web scenario step received when it failed would work perfectly.

    Tnx,
    Tadija
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    I would create "http agent" check for that API call and extract all parameters into dependent items. Not use web scenario at all.
    When you create triggers based on those items you can use {ITEM.VALUE<x>} macros to display data in trigger name etc...

    Comment

    Working...