Ad Widget

Collapse

Action variables for failed webscenario

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bitsofinfo
    Junior Member
    • May 2018
    • 2

    #1

    Action variables for failed webscenario

    I have a single host "myhost", with one webscenario "test1".

    This has a single step that checks a URL for a 200

    The trigger has an expressions fires when status is <> 0, and recovers when = 0

    This trigger is bound to an Action with the following message:

    The messages template displays this:

    Trigger: {TRIGGER.NAME}
    Trigger status: {TRIGGER.STATUS}
    Trigger severity: {TRIGGER.SEVERITY}
    Trigger URL: {TRIGGER.URL}

    Item values:

    1. {ITEM.NAME1} ({HOST.NAME1}:{ITEM.KEY1}): {ITEM.VALUE1}
    2. {ITEM.NAME2} ({HOST.NAME2}:{ITEM.KEY2}): {ITEM.VALUE2}
    3. {ITEM.NAME3} ({HOST.NAME3}:{ITEM.KEY3}): {ITEM.VALUE3}

    Original event ID: {EVENT.ID}

    However the actual message looks like this

    PROBLEM: test1trigger: Trigger: test1trigger

    Trigger status: PROBLEM
    Trigger severity: High
    Trigger URL:

    Item values:

    1. Failed step of scenario "test1". (myhost:web.test.fail[test1]): 1
    2. *UNKNOWN* (*UNKNOWN*:*UNKNOWN*): *UNKNOWN*
    3. *UNKNOWN* (*UNKNOWN*:*UNKNOWN*): *UNKNOWN*

    Original event
    The above is pretty worthless.

    I need to show the URL of the step, the response code, the time of the request at a minimum.

    How can I do this?

    I read both of the following pages and still feel clueless. This seems overly complex




  • aigars.kadikis
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2018
    • 208

    #2
    Hi,

    This is not possible with built-in tools in web monitoring.
    One workaround is to create an external script for example 'url-response.sh' with content:
    Code:
     #!/bin/bash
    curl -o /dev/null -s -w %{http_code} $1
    Configure item like this:
    Click image for larger version

Name:	url-response-sh.png
Views:	221
Size:	47.1 KB
ID:	359340

    Then create trigger expression:
    Code:
    {custom web mon:url-response.sh[https://www.zabbix.com/forum/zabbix-help1].last()}<>200
    After this, you will be able to extract URL in email using {ITEM.NAME1} macro.
    There is also an advantage to use this scenario: you can use LLD feature to discover your URLs.

    Regards,

    Comment

    Working...