Ad Widget

Collapse

How to add email alert if URL show error.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rahullinux
    Junior Member
    • Nov 2019
    • 13

    #1

    How to add email alert if URL show error.

    I have configured a web scenario and 100 web URL's in it. I have to configure a trigger that if any URL is down we get an email alert. Please help on this.
  • valentins.grins
    Member
    • Nov 2019
    • 38

    #2
    Hello,

    In order to add email alert you must create a trigger action. This action will be executed when trigger state changes from OK to PROBLEM state and back(see documentation https://www.zabbix.com/documentation...cations/action). You can add additional conditions for actions basing on trigger name, tags and etc if you want to have a dedicated notification for web scenario failures.
    However actions will not be executed if proper trigger is not configured. One of the web scenario triggers example from documentation(https://www.zabbix.com/documentation...toring/items):
    To create a “Web scenario failed” trigger with a useful problem description in the trigger name, you can define a trigger with name:

    Web scenario "Scenario" failed: {ITEM.VALUE}
    and trigger expression:

    Code:
    {host:web.test.error[Scenario].strlen()}>0 and {host:web.test.fail[Scenario].last()}>0
    Make sure to replace 'Scenario' with the real name of your scenario.

    Comment

    • thetinkergnome
      Junior Member
      • Nov 2019
      • 7

      #3
      Are you asking what expression you need in the trigger or how to generate the emails or both?

      Here is what I use for a Web Scenario trigger on one of our sites.

      Code:
      {WebsiteTemplate:web.test.fail[{$URL} Availibility].last(60)}>0
      I have the scenario set to look for a specific substring on the page the given URL returns and if it gets a 200 response. If it does not get a 200 response from the website for more than 60 seconds then it fails the Availability check and the trigger fires

      Comment

      • Rahullinux
        Junior Member
        • Nov 2019
        • 13

        #4
        I have one web scenario in the scenario I have 100 URLs. I have configured the one trigger for it that I am able to get alert if URL in problem state. I want to know that I have to create 100 triggers or One
        the trigger is sufficient for 100 URLs. Please help on this.

        Comment

        • valentins.grins
          Member
          • Nov 2019
          • 38

          #5
          Rahullinux,

          You don't need to create a 100 trigger. You may use this trigger expression:
          {host:web.test.fail[Scenario].last()}>0 It returns 0 if all web scenario steps were successful. In case if any failed then it returns number of failed step.

          Comment

          • Rahullinux
            Junior Member
            • Nov 2019
            • 13

            #6
            Valentines Thanks for your reply.
            I have configured the trigger and I have also received the alert but the issue I don't get the name of URL which is down. So it great if you tell how can I will get the URL name in an email:-
            Problem started at 03:14:53 on 2019.11.06 Problem name: url monitor Host: test Severity: Warning Original problem ID: 1225 Can you help on this

            Comment

            • valentins.grins
              Member
              • Nov 2019
              • 38

              #7
              You can try this option.
              Put two expressions for the trigger
              Code:
               
               {host:web.test.error[Scenario].strlen()}>0 and {host:web.test.fail[Scenario].last()}>0
              Then add following to the Trigger description:
              Scenario step: {ITEM.VALUE2} //Last value of second item in trigger expression
              Error description: {ITEM.VALUE1} //Last value of first item in trigger expression

              Then in action you can use macro {TRIGGER.DESCRIPTION} which will populate your notification with number of step that failed and error message received.

              Comment

              • Rahullinux
                Junior Member
                • Nov 2019
                • 13

                #8
                Can you explain me how we can add trigger description. I am not able to add it.

                Comment

                • valentins.grins
                  Member
                  • Nov 2019
                  • 38

                  #9
                  Can you please share configuration of your trigger? Maybe you can make a screenshot?

                  Comment

                  • Rahullinux
                    Junior Member
                    • Nov 2019
                    • 13

                    #10
                    Please find the configuration in the attachment
                    Attached Files

                    Comment

                    • valentins.grins
                      Member
                      • Nov 2019
                      • 38

                      #11
                      Do you have the Description field at very bottom of trigger configuration? I don't see the whole configuration on your screenshot.

                      Put these two lines into description field.

                      Code:
                      Scenario step: {ITEM.VALUE2}
                      Error description: {ITEM.VALUE1}

                      Comment

                      • Rahullinux
                        Junior Member
                        • Nov 2019
                        • 13

                        #12
                        Please see the description field in the screenshot. Suggest me this correct me configuration:-
                        Attached Files

                        Comment

                        • valentins.grins
                          Member
                          • Nov 2019
                          • 38

                          #13
                          Yes, now add {TRIGGER.DESCRIPTION} to message of your action. See sample attached.
                          Attached Files

                          Comment

                          • Rahullinux
                            Junior Member
                            • Nov 2019
                            • 13

                            #14
                            I had configured the settings mentioned by you. I have received the email but I have received the error message and but not able to received URL name which is facing issue. Please check screenshot for reference
                            Attached Files

                            Comment

                            • valentins.grins
                              Member
                              • Nov 2019
                              • 38

                              #15
                              Rahullinux,

                              As far as i know there is no opportunity to get the exact URL but you can see the failed step(2) and then go to Web Scenario configuration, locate this step and see the URL and other parameters applied to this step.

                              Comment

                              Working...