Ad Widget

Collapse

One trigger for multiple web scenarios

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gabo
    Junior Member
    • Mar 2019
    • 11

    #1

    One trigger for multiple web scenarios

    Hi,

    I have a host with multiple web scenarios (128 web scenarios), each one with a single step. I would like to create a trigger for all the web scenarios of that host, for example:

    If the response time for any of the scenarios is over X than...

    I'm trying to find a simple way to have it done, but I didn't find much information on the web.

    Any ideas about what will be the best way with the least effort to have it done?

    What I don't want is to create a trigger for each web scenario
  • dimir
    Zabbix developer
    • Apr 2011
    • 1080

    #2
    You could have a web scenario with a trigger in a Template. You would still have a trigger for each scenario but you wouldn't have to create one each time.

    Comment

    • gabo
      Junior Member
      • Mar 2019
      • 11

      #3

      Yes, but as I create a unique triggers for all web scenarios, the name of the web scenarios are different with different steps

      Comment

      • dimir
        Zabbix developer
        • Apr 2011
        • 1080

        #4
        You can use host macros to define the actual URL you are testing and use those macros in item Name, Key and/or other parameters. E. g, create template "Template Web Monitoring". Add web scenario:

        Code:
        Web scenario: Availability of ${URL}
        Create step:
        Code:
        Step: Check {$URL}
        URL: {$URL}
        Create trigger:
        Code:
        Name: {$URL} responded with over $1 seconds
        Expression: {Template Web Monitoring:web.test.time[Availability of {$URL},Status of {$URL},resp].last()}>3
        Now create some host, link that Template to this host and on that host define a macro:
        {$URL} = http://example.com

        Now for each URL you want to monitor create host, link the template to it and define a host macro.

        Comment

        • gabo
          Junior Member
          • Mar 2019
          • 11

          #5

          I thought so, but I have 178 URLs to monitor, should I have 178 items with 178 triggers?

          {$URL} = http://example.com
          {$URL1} = http://example.com1
          {$URL2} = http://example.com2
          {$URL}3 = http://example.com3

          ¿?

          Comment

          • LenR
            Senior Member
            • Sep 2009
            • 1005

            #6
            I have some scripts to help with the way I chose to do this.

            The first command, passed a Zabbix host name, dns name and port, does a nslookup and adds another host interface. By adding a host interface, you can use Zabbix search to fine the dns name or ip address.

            The second command, passed a Zabbix host name, builds items, web tests and triggers for all non-primary interfaces on a host.

            If you want to look it's here: https://github.com/rugenl/zabbix-api

            Comment

            • dimir
              Zabbix developer
              • Apr 2011
              • 1080

              #7
              Originally posted by gabo
              I thought so, but I have 178 URLs to monitor, should I have 178 items with 178 triggers?

              {$URL} = http://example.com
              {$URL1} = http://example.com1
              {$URL2} = http://example.com2
              {$URL}3 = http://example.com3

              ¿?
              No, you have a template, that has one item with {$URL} and one trigger with {$URL}. And the {$URL} is not defined on the Template. Then, when you link a template to hostX you add a macro {$URL}=http://example.com1 on the hostX. Then, when you link a template to hostY you add a macro {$URL}=http://example.com2 on the hostY. And so on.

              Comment

              • fcovecino
                Junior Member
                • Feb 2021
                • 1

                #8
                Hello,

                I was trying to do exactly what you were trying, and following your guidance found a way I believe is easier:
                • Instead of creating the template for web scenario and trigger using {$URL} and then setting a host for each website, and on each host add a macro to setup a value for {$URL}, just create the template using https://{HOST.NAME}... as long as you use the FQDN as host name, no macros or value setups are needed... just create the host and link the template.

                Hope this helps

                Comment

                • roma
                  Junior Member
                  • Feb 2021
                  • 2

                  #9
                  Originally posted by gabo
                  Hi,

                  I have a host with multiple web scenarios (128 web scenarios), each one with a single step. I would like to create a trigger for all the web scenarios of that host, for example:

                  If the response time for any of the scenarios is over X than...

                  I'm trying to find a simple way to have it done, but I didn't find much information on the web. omegle

                  Any ideas about what will be the best way with the least effort to have it done?

                  What I don't want is to create a trigger for each web scenario
                  Hello, dear

                  I was also trying to implement exactly the same that you were trying, and below your guidance found a way I believe is easier:
                  • Instead of designing a template for web scenario and trigger using {$URL} and then setting a host for each website, and on each host add a macro to setup a value for {$URL}, just create the template using HTTPS://{HOST.NAME}. as long as you use the FQDN as host name, no macros or value setups are needed... just create the host and link the template.

                  Hope this one helps you.

                  Comment

                  • lparolari
                    Junior Member
                    • Apr 2021
                    • 1

                    #10
                    Hello! Sorry for the intrusion.

                    I'm in the same situation as gabo: I have an host and multiple websites on that host that I want to monitor.

                    Up to now, the solutions to this problem (at least the ones cited in this thread) can be summarized as follows:
                    1. create a template which monitors a web page using the URL provided by host's name as roma proposed, and
                    2. create a template which monitors a web page using the URL provided by macros as dimir proposed.
                    In my opinion, even if both work they are not the best solutions for two main reasons. First of all we need to create one host per website, but this is not a big problem. The big problem is that in this way one and only one website can be monitored through the host we created. So if I need to monitor two web pages on a website, let's say the homepage and the private area, I need to create two separate hosts.

                    Did you found a way to fix this?

                    I mean, probably the simplest solution is to attach the "webpage monitoring template" multiple times to a single host, but this does not work because of the macro which can be defined once. Is there a workaround to this problem?

                    Thank you.
                    Last edited by lparolari; 23-04-2021, 10:05.

                    Comment

                    • shivshakti
                      Junior Member
                      • Apr 2021
                      • 2

                      #11
                      Originally posted by roma

                      Hello, dear

                      I was also trying to implement exactly the same that you were trying, and below your guidance found a way I believe is easier:
                      • Instead of designing a template for web scenario and trigger using {$URL} and then setting a host for each website, and on each host add a macro to setup a value for {$URL}, just create the template using HTTPS://{HOST.NAME}. as long as you use the FQDN as host name, no macros or value setups are needed omegle ... just create the host and link the template.

                      Hope this one helps you.
                      thank you! for the reply. it's a great answer for now.

                      Comment

                      Working...