zabbix_export:
  version: '7.4'
  template_groups:
    - uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
      name: Templates/Applications
  templates:
    - uuid: 7693ae5298b045aabbcab812664c11f1
      template: 'Website by Browser with Login BR'
      name: 'Website by Browser with Login BR'
      description: |
        The template to monitor a website's availability and performance on the website by Browser.
        
        Zabbix server uses a web browser to perform navigation and collect performance metrics.
        
        Generated by official Zabbix template tool "Templator"
      groups:
        - name: Templates/Applications
      items:
        - uuid: 5319b27f89414abc89b0f85c37e4a732
          name: 'Website {$WEBSITE.DOMAIN} Duration'
          type: DEPENDENT
          key: website.duration
          history: 1w
          value_type: FLOAT
          units: s
          description: 'Session duration from session creation to result retrieval.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.duration
              error_handler: DISCARD_VALUE
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
        - uuid: fb78f17d470d480a92fafaaa0b83156c
          name: 'Website {$WEBSITE.DOMAIN} Get data'
          type: BROWSER
          key: website.get.data
          delay: '{$WEBSITE.GET.DATA.INTERVAL}'
          history: 1w
          value_type: TEXT
          params: |
            var browser;
            
            const Website = {
                params: {},
            
                setParams(params) {
                    ['scheme', 'domain','width', 'height','user','passwd','login_button'].forEach(function (field) {
                        if (typeof params !== 'object' || !params[field]) {
                            throw new Error('Required param is not set: ' + field + '.');
                        }
                    });
                    this.params = params;
                },
            
                getOptions(browser) {
                    switch ((browser || '').trim().toLowerCase()) {
                        case 'firefox':
                            return Browser.firefoxOptions();
                        case 'safari':
                            return Browser.safariOptions();
                        case 'edge':
                            return Browser.edgeOptions();
                        default:
                            return Browser.chromeOptions();
                    }
                },
            
                getPerformance() {
                    browser = new Browser(Website.getOptions(Website.params.browser));
                    const url = Website.params.scheme + '://' + Website.params.domain + '/' + Website.params.path
                    const screenshot = '';
                    browser.setScreenSize(Number(Website.params.width), Number(Website.params.height))
                    browser.navigate(url);
            
                    browser.setSessionTimeout(10000);
            
                    browser.setElementWaitTimeout(10000);
            
                    browser.collectPerfEntries("open page");
            
                    //Zabbix.sleep(10000);
            
                    if ( Website.params.user_field ) {
            
                        //Zabbix.log(2, '[Script JS] ['+ url +'] Passo 1: Esperando 10s para carregar campo de usuario...');
            			//Zabbix.sleep(20000);
            
                        Zabbix.log(2, '[Script JS] ['+ url +'] Passo 1: Procurando campo usuario (' + Website.params.user_field + ')');
                        var el = browser.findElement(Website.params.user_field_strategy, Website.params.user_field);
                        if (el === null) {
                            throw Error("01 - cannot find user input field");
                        }     
                        el.sendKeys(Website.params.user);
            
                    }
            
                    if ( Website.params.passwd_field ) {
            
            			Zabbix.log(2, '[Script JS] ['+ url +'] Passo Opcional: Procurando senha na tela 1...');
            
                        var el = browser.findElement(Website.params.passwd_field_strategy, Website.params.passwd_field);
                        if (el === null) {
                            throw Error("02 - cannot find password input field");
                        }
                        el.sendKeys(Website.params.passwd);
            
                    }
            
                    if ( Website.params.login_button ) {
            
                        Zabbix.log(2, '[Script JS] ['+ url +'] Passo 2: Clicando no botao Avancar...');
            
                        var el = browser.findElement(Website.params.login_button_strategy, Website.params.login_button);
                        if (el === null) {
                            throw Error("03 - cannot find login button");
                        }
                        el.click();
            
                    }
            
                    if ( Website.params.user_field2 ) {
            
                        var el = browser.findElement(Website.params.user_field2_strategy, Website.params.user_field2);
                        if (el === null) {
                            throw Error("04 - cannot find name input field");
                        }
                        el.sendKeys(Website.params.user);
            
                    }
            
                    if ( Website.params.passwd_field2 ) {
            
                        Zabbix.sleep(1000);
                        var el = browser.findElement(Website.params.passwd_field2_strategy, Website.params.passwd_field2);
                        if (el === null) {
                            throw Error("04.1 - cannot find password input field 2");
                        }
                        el.sendKeys(Website.params.passwd);
            
                    }
            
                    if ( Website.params.login_button2 ) {
            
                        var el = browser.findElement(Website.params.login_button2_strategy, Website.params.login_button2);
                        if (el === null) {
                            throw Error("05 - cannot find login button 2");
                        }
                        el.click();   
            
                    }
            
                    if ( Website.params.text_stay_signed_in ) {
                        //Zabbix.sleep(10000);
                        var el = browser.findElement("xpath", "//div[contains(text(),'"+Website.params.text_stay_signed_in+"')]");
                        if (el === null) {
                            throw Error("04.2 - cannot find stay signed in string: "+Website.params.text_stay_signed_in);
                        } else {
            
                            var el = browser.findElement(Website.params.text_stay_signed_in_button_strategy, Website.params.text_stay_signed_in_button);
                            if (el === null) {
                                throw Error("04.3 - cannot find stay signed in login button");
                            } else {
                                el.click();
                            }
            
            			}
            
                    }
            
                    if ( Website.params.passwd_field3 ) {
            
                        Zabbix.sleep(1000);
                        //browser.setElementWaitTimeout(10000);
                        var el = browser.findElement(Website.params.passwd_field3_strategy, Website.params.passwd_field3);
                        if (el === null) {
                            throw Error("06 - cannot find password input field 3");
                        }
                        el.sendKeys(Website.params.passwd);
            
                    }
            
                    if ( Website.params.login_button3 ) {
            
                        Zabbix.sleep(5000);
                        //browser.setElementWaitTimeout(10000);
                        var el = browser.findElement(Website.params.login_button3_strategy, Website.params.login_button3);
                        if (el === null) {
                            throw Error("07 - cannot find login button 3");
                        }  
                        el.click();
            
                    }
            
                    if ( Website.params.text_stay_signed_in2 ) {
                        //Zabbix.sleep(10000);
                        var el = browser.findElement("xpath", "//div[contains(text(),'"+Website.params.text_stay_signed_in2+"')]");
                        if (el === null) {
                            throw Error("04.2 - cannot find stay signed in string: "+Website.params.text_stay_signed_in2);
                        } else {
            
                            var el = browser.findElement(Website.params.text_stay_signed_in_button_strategy, Website.params.text_stay_signed_in_button);
                            if (el === null) {
                                throw Error("04.3 - cannot find stay signed in login button");
                            } else {
                                el.click();
                            }
            
            			}
            
                    }
            
                    if ( Website.params.login_button4 ) {
            
                        Zabbix.sleep(1000);
                        //browser.setElementWaitTimeout(10000);
                        var el = browser.findElement(Website.params.login_button4_strategy, Website.params.login_button4);
                        if (el === null) {
                            throw Error("08 - cannot find login button 4");
                        }  
                        el.click();
            
                    }
            
                    browser.collectPerfEntries("login");
            
                    Zabbix.sleep(Website.params.sleep_timeout);
            
                    if ( Website.params.search_string ) {
                        //Zabbix.sleep(15000);
                        //browser.setElementWaitTimeout(10000);
                        var el = browser.findElement("xpath", "//*[contains(text(),'"+Website.params.search_string+"')]");
                        if (el === null) {
                            throw Error("09 - cannot find search string");
                        }
            
                    }
            
                    if ( Website.params.user_img ) {
            
                        var el = browser.findElement("css selector", Website.params.user_img);
                        if (el === null) {
                            throw Error("10 - cannot find User image");
                        }
                        el.click();
                    }
            
                    if ( Website.params.link_text_signout ) {
            
                        var el = browser.findElement("link text", Website.params.link_text_signout);
                        if (el === null) {
                            throw Error("11 - cannot find Sign out");
                        }
                        el.click();
            
                        el = browser.findElement("xpath", Website.params.user_field);
                        if (el === null) {
                            throw Error("12 - cannot find name input field");
                        }
            
                        browser.collectPerfEntries("logout");
            
                    }    
            
                    screenshot = browser.getScreenshot();
                    const result = browser.getResult();
                    result.screenshot = screenshot;
            
                    return JSON.stringify(result);
                }
            };
            
            try {
                Website.setParams(JSON.parse(value));
                return Website.getPerformance();
            
            } catch (error) {
                error += (String(error).endsWith('.')) ? '' : '.';
                Zabbix.log(3, '[ Website get metrics] ERROR: ' + error);
                const screenshot = browser.getScreenshot();
                return JSON.stringify({ 'error': error, 'screenshot': screenshot });
            }
          description: 'Returns the JSON with performance counters of the requested website.'
          timeout: 180s
          parameters:
            - name: browser
              value: '{$WEBSITE.BROWSER}'
            - name: domain
              value: '{$WEBSITE.DOMAIN}'
            - name: height
              value: '{$WEBSITE.SCREEN.HEIGHT}'
            - name: link_text_signout
              value: '{$WEBSITE.LINK.TEXT.SIGNOUT}'
            - name: login_button
              value: '{$WEBSITE.LOGIN.BUTTON}'
            - name: login_button2
              value: '{$WEBSITE.LOGIN.BUTTON2}'
            - name: login_button2_strategy
              value: '{$WEBSITE.LOGIN.BUTTON2.STRATEGY}'
            - name: login_button3
              value: '{$WEBSITE.LOGIN.BUTTON3}'
            - name: login_button3_strategy
              value: '{$WEBSITE.LOGIN.BUTTON3.STRATEGY}'
            - name: login_button4
              value: '{$WEBSITE.LOGIN.BUTTON4}'
            - name: login_button4_strategy
              value: '{$WEBSITE.LOGIN.BUTTON4.STRATEGY}'
            - name: login_button_strategy
              value: '{$WEBSITE.LOGIN.BUTTON.STRATEGY}'
            - name: passwd
              value: '{$WEBSITE.PASSWD}'
            - name: passwd_field
              value: '{$WEBSITE.PASSWD.FIELD}'
            - name: passwd_field2
              value: '{$WEBSITE.PASSWD.FIELD2}'
            - name: passwd_field2_strategy
              value: '{$WEBSITE.PASSWD.FIELD2.STRATEGY}'
            - name: passwd_field3
              value: '{$WEBSITE.PASSWD.FIELD3}'
            - name: passwd_field3_strategy
              value: '{$WEBSITE.PASSWD.FIELD3.STRATEGY}'
            - name: passwd_field_strategy
              value: '{$WEBSITE.PASSWD.FIELD.STRATEGY}'
            - name: path
              value: '{$WEBSITE.PATH}'
            - name: scheme
              value: '{$WEBSITE.SCHEME}'
            - name: search_string
              value: '{$WEBSITE.SEARCH.STRING}'
            - name: sleep_timeout
              value: '{$WEBSITE.SLEEP.TIMEOUT}'
            - name: text_stay_signed_in
              value: '{$WEBSITE.LOGIN.TEXT.STAY.SIGNED.IN}'
            - name: text_stay_signed_in2
              value: '{$WEBSITE.LOGIN.TEXT.STAY.SIGNED.IN2}'
            - name: text_stay_signed_in_button
              value: '{$WEBSITE.LOGIN.TEXT.STAY.SIGNED.IN.BUTTON}'
            - name: text_stay_signed_in_button_strategy
              value: '{$WEBSITE.LOGIN.TEXT.STAY.SIGNED.IN.BUTTON.STRATEGY}'
            - name: user
              value: '{$WEBSITE.USER}'
            - name: user_field
              value: '{$WEBSITE.USER.FIELD}'
            - name: user_field2
              value: '{$WEBSITE.USER.FIELD2}'
            - name: user_field2_strategy
              value: '{$WEBSITE.USER.FIELD2.STRATEGY}'
            - name: user_field_strategy
              value: '{$WEBSITE.USER.FIELD.STRATEGY}'
            - name: user_img
              value: '{$WEBSITE.USER.IMG}'
            - name: width
              value: '{$WEBSITE.SCREEN.WIDTH}'
          tags:
            - tag: component
              value: raw
        - uuid: 10255fb1a19e43f9b7f36b3368978e2f
          name: 'Get metrics check'
          type: DEPENDENT
          key: website.metrics.check
          history: 7d
          value_type: CHAR
          description: 'Check that the performance counters of the requested website data has been received correctly.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.error
              error_handler: CUSTOM_VALUE
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: status
          triggers:
            - uuid: d1797636061a4a5081a69cf5b4152367
              expression: '{$WEBSITE.TRIGGER.ENABLE}=1 and count(/Website by Browser with Login BR/website.metrics.check,#4,"like","Error")=4'
              name: 'Aplicacao {$WEBSITE.APP.NAME} indisponivel - {$WEBSITE.SCHEME}://{$WEBSITE.DOMAIN}/{$WEBSITE.PATH}'
              opdata: 'Current value: {ITEM.LASTVALUE1}'
              priority: HIGH
              description: '{ITEM.LASTVALUE}'
              tags:
                - tag: REGIONAL
                  value: '{$WEBSITE.REGIONAL}'
                - tag: scope
                  value: availability
        - uuid: dbb8c2637d8d48d9bddda3b7eb78a079
          name: 'Website {$WEBSITE.DOMAIN} Navigation DNS lookup time'
          type: DEPENDENT
          key: website.navigation.dns_lookup_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of time spent on DNS lookup (domainLookupEnd - domainLookupStart).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.navigation.dns_lookup_time
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: navigation
        - uuid: 3720d2ac75f54b7799e675c265d54744
          name: 'Website {$WEBSITE.DOMAIN} Navigation domContentLoaded time'
          type: DEPENDENT
          key: website.navigation.dom_content_loaded_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of time spent on DOM content loading (domContentLoadedEventEnd - domContentLoadedEventStart).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.navigation.dom_content_loading_time
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: navigation
        - uuid: 3ba5b88ee5ee47d6b41d08361b4104c9
          name: 'Website {$WEBSITE.DOMAIN} Navigation encodedBody size'
          type: DEPENDENT
          key: website.navigation.encoded_size
          value_type: FLOAT
          trends: '0'
          units: B
          description: 'Measuring of encoded size (encodedBodySize).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.navigation.encoded_size
              error_handler: DISCARD_VALUE
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: navigation
        - uuid: 84c18c36fed34d1095f126330f42a53e
          name: 'Website {$WEBSITE.DOMAIN} Navigation load event time'
          type: DEPENDENT
          key: website.navigation.load_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of load finished time (loadEventEnd).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.navigation.load_finished
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: navigation
          triggers:
            - uuid: 28ec8ce76964407da678c90aad350cee
              expression: '{$WEBSITE.TRIGGER.ENABLE}=1 and last(/Website by Browser with Login BR/website.navigation.load_time)>{$WEBSITE.NAVIGATION.LOAD.MAX.WARN}'
              name: 'Website navigation load event time is too slow'
              event_name: 'Website {$WEBSITE.DOMAIN} navigation load event time > {$WEBSITE.NAVIGATION.LOAD.MAX.WARN}'
              opdata: 'Current value: {ITEM.LASTVALUE1}'
              priority: WARNING
              dependencies:
                - name: 'Aplicacao {$WEBSITE.APP.NAME} indisponivel - {$WEBSITE.SCHEME}://{$WEBSITE.DOMAIN}/{$WEBSITE.PATH}'
                  expression: '{$WEBSITE.TRIGGER.ENABLE}=1 and count(/Website by Browser with Login BR/website.metrics.check,#4,"like","Error")=4'
              tags:
                - tag: REGIONAL
                  value: '{$WEBSITE.REGIONAL}'
                - tag: scope
                  value: notice
        - uuid: 3ebc266a4ad945d8854d71e7d61d4494
          name: 'Website {$WEBSITE.DOMAIN} Navigation request time'
          type: DEPENDENT
          key: website.navigation.request_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of time spend on the request (responseStart - requestStart).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.navigation.request_time
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: navigation
        - uuid: a13692478bec47bfacc5b61a2a0c7855
          name: 'Website {$WEBSITE.DOMAIN} Navigation resource fetch time'
          type: DEPENDENT
          key: website.navigation.resource_fetch_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of time spent to fetch the resource (without redirects) (responseEnd - fetchStart).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.navigation.resource_fetch_time
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: navigation
        - uuid: 92117514e1ae4182bf47c401ec18f444
          name: 'Website {$WEBSITE.DOMAIN} Navigation response time'
          type: DEPENDENT
          key: website.navigation.response_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of time spend on the response (responseEnd - responseStart).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.navigation.response_time
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: navigation
        - uuid: e90557c3da5a4b34a2c6c8c36d091635
          name: 'Website {$WEBSITE.DOMAIN} Navigation service worker processing time'
          type: DEPENDENT
          key: website.navigation.service_worker_processing_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of sum of time spend on browser''s service worker processing (fetchStart - workerStart).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.navigation.service_worker_processing_time
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: navigation
        - uuid: f7d87b2e56f6413ab835554cfcd937ce
          name: 'Website {$WEBSITE.DOMAIN} Navigation TCP handshake time'
          type: DEPENDENT
          key: website.navigation.tcp_handshake_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of time spent on TCP handshake (connectEnd - connectStart).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.navigation.tcp_handshake_time
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: navigation
        - uuid: 79ae0e133c584033b9c630a9203b5aa8
          name: 'Website {$WEBSITE.DOMAIN} Navigation TLS negotiation time'
          type: DEPENDENT
          key: website.navigation.tls_negotiation_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of time spent on TLS negotiation (requestStart - secureConnectionStart).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.navigation.tls_negotiation_time
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: navigation
        - uuid: 1e9f6d16c8a145a7b578111ffba8ea70
          name: 'Website {$WEBSITE.DOMAIN} Navigation decodedBody size'
          type: DEPENDENT
          key: website.navigation.total_size
          value_type: FLOAT
          trends: '0'
          units: B
          description: 'Measuring of total size (decodedBodySize).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.navigation.total_size
              error_handler: DISCARD_VALUE
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: navigation
        - uuid: 3841cc5efe4a460ba400c222049b900e
          name: 'Website {$WEBSITE.DOMAIN} Navigation transfer size'
          type: DEPENDENT
          key: website.navigation.transferred_size
          value_type: FLOAT
          trends: '0'
          units: B
          description: 'Measuring of transferred size (transferSize).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.navigation.transferred_size
              error_handler: DISCARD_VALUE
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: navigation
        - uuid: 0cd4305da0654ec5acc2f2959ffd74aa
          name: 'Website {$WEBSITE.DOMAIN} Resource DNS lookup time'
          type: DEPENDENT
          key: website.resource.dns_lookup_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of time spent on DNS lookup (domainLookupEnd - domainLookupStart).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.resource.dns_lookup_time
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: resource
        - uuid: 09d02d53e323474c9e30c37b4f00b9ec
          name: 'Website {$WEBSITE.DOMAIN} Resource domContentLoaded time'
          type: DEPENDENT
          key: website.resource.dom_content_loaded_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of time spent on DOM content loading (domContentLoadedEventEnd - domContentLoadedEventStart).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.resource.dom_content_loading_time
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: resource
        - uuid: f8d1cb3bc39d460abd6364c5c134e9ba
          name: 'Website {$WEBSITE.DOMAIN} Resource encodedBody size'
          type: DEPENDENT
          key: website.resource.encoded_size
          value_type: FLOAT
          trends: '0'
          units: B
          description: 'Measuring of encoded size (encodedBodySize).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.resource.encoded_size
              error_handler: DISCARD_VALUE
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: resource
        - uuid: a701e1aa14a94e4dac2e11109d48ab5a
          name: 'Website {$WEBSITE.DOMAIN} Resource fetch time'
          type: DEPENDENT
          key: website.resource.fetch_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of time spent to fetch the resource (without redirects) (responseEnd - fetchStart).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.resource.resource_fetch_time
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: resource
        - uuid: 818f225141674310be9f6e934b9e071a
          name: 'Website {$WEBSITE.DOMAIN} Resource load event time'
          type: DEPENDENT
          key: website.resource.load_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of load finished time (loadEventEnd).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.resource.load_finished
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: resource
          triggers:
            - uuid: 7af896652fc946baaa0d2b26d225c61f
              expression: '{$WEBSITE.TRIGGER.ENABLE}=1 and last(/Website by Browser with Login BR/website.resource.load_time)>{$WEBSITE.RESOURCE.LOAD.MAX.WARN}'
              name: 'Website resource load event time is too slow'
              event_name: 'Website {$WEBSITE.DOMAIN} resource load event time > ''{$WEBSITE.RESOURCE.LOAD.MAX.WARN}'''
              opdata: 'Current value: {ITEM.LASTVALUE1}'
              priority: WARNING
              dependencies:
                - name: 'Aplicacao {$WEBSITE.APP.NAME} indisponivel - {$WEBSITE.SCHEME}://{$WEBSITE.DOMAIN}/{$WEBSITE.PATH}'
                  expression: '{$WEBSITE.TRIGGER.ENABLE}=1 and count(/Website by Browser with Login BR/website.metrics.check,#4,"like","Error")=4'
              tags:
                - tag: REGIONAL
                  value: '{$WEBSITE.REGIONAL}'
                - tag: scope
                  value: notice
        - uuid: 7b92613fa5e64e76addffb0e4e3efa7a
          name: 'Website {$WEBSITE.DOMAIN} Resource request time'
          type: DEPENDENT
          key: website.resource.request_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of time spend on the request (responseStart - requestStart).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.resource.request_time
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: resource
        - uuid: 91bf9e81b998456d8a14ef3348ae2ab0
          name: 'Website {$WEBSITE.DOMAIN} Resource response time'
          type: DEPENDENT
          key: website.resource.response_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of time spend on the response (responseEnd - responseStart).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.resource.response_time
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: resource
        - uuid: c6976f3a7b984d1b8290b876287c75c3
          name: 'Website {$WEBSITE.DOMAIN} Resource service worker processing time'
          type: DEPENDENT
          key: website.resource.service_worker_processing_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of sum of time spend on browser''s service worker processing (fetchStart - workerStart).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.resource.service_worker_processing_time
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: resource
        - uuid: a7af7b6d5c5f49008100e612ed15fc88
          name: 'Website {$WEBSITE.DOMAIN} Resource TCP handshake time'
          type: DEPENDENT
          key: website.resource.tcp_handshake_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of time spent on TCP handshake (connectEnd - connectStart).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.resource.tcp_handshake_time
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: resource
        - uuid: 4f909395e87c4f9ca1112c3e13581319
          name: 'Website {$WEBSITE.DOMAIN} Resource TLS negotiation time'
          type: DEPENDENT
          key: website.resource.tls_negotiation_time
          value_type: FLOAT
          trends: '0'
          units: s
          description: 'Measuring of time spent on TLS negotiation (requestStart - secureConnectionStart).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.resource.tls_negotiation_time
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: resource
        - uuid: c7ac740587534a6c9e178bc1aceb9d8f
          name: 'Website {$WEBSITE.DOMAIN} Resource decodedBody size'
          type: DEPENDENT
          key: website.resource.total_size
          value_type: FLOAT
          trends: '0'
          units: B
          description: 'Measuring of total size (decodedBodySize).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.resource.total_size
              error_handler: DISCARD_VALUE
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: resource
        - uuid: 6b6ec7d4e1bf4da79ebb01303a96fd40
          name: 'Website {$WEBSITE.DOMAIN} Resource transfer size'
          type: DEPENDENT
          key: website.resource.transferred_size
          value_type: FLOAT
          trends: '0'
          units: B
          description: 'Measuring of transferred size (transferSize).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.performance_data.summary.resource.transferred_size
              error_handler: DISCARD_VALUE
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
            - tag: performance
              value: resource
        - uuid: 14c26227f53d44c48f7f8214093283cb
          name: 'Website {$WEBSITE.DOMAIN} Screenshot'
          type: DEPENDENT
          key: website.screenshot
          value_type: BINARY
          description: 'Website {$WEBSITE.DOMAIN} screenshot.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.screenshot
              error_handler: DISCARD_VALUE
          master_item:
            key: website.get.data
          tags:
            - tag: component
              value: application
      tags:
        - tag: class
          value: application
        - tag: target
          value: browser
      macros:
        - macro: '{$WEBSITE.APP.NAME}'
          value: '{HOST.HOST}'
          description: 'Nome da aplicacao'
        - macro: '{$WEBSITE.BROWSER}'
          value: chrome
          description: 'Browser to be used for data collection.'
        - macro: '{$WEBSITE.DOMAIN}'
          value: www.login.microsoftonline.com
          description: 'The domain name.'
        - macro: '{$WEBSITE.GET.DATA.INTERVAL}'
          value: 5m
          description: 'Update interval for get raw data item.'
        - macro: '{$WEBSITE.LINK.TEXT.SIGNOUT}'
          description: 'Identificado do link de logout na pagina'
        - macro: '{$WEBSITE.LOGIN.BUTTON}'
          value: '//button[@id=''enter'']'
          description: 'Botao de login'
        - macro: '{$WEBSITE.LOGIN.BUTTON.STRATEGY}'
          value: xpath
        - macro: '{$WEBSITE.LOGIN.BUTTON2}'
          description: 'Botão de login na segunda pagina'
        - macro: '{$WEBSITE.LOGIN.BUTTON2.STRATEGY}'
          value: xpath
        - macro: '{$WEBSITE.LOGIN.BUTTON3}'
        - macro: '{$WEBSITE.LOGIN.BUTTON3.STRATEGY}'
          value: xpath
        - macro: '{$WEBSITE.LOGIN.BUTTON4}'
        - macro: '{$WEBSITE.LOGIN.BUTTON4.STRATEGY}'
          value: xpath
        - macro: '{$WEBSITE.LOGIN.TEXT.STAY.SIGNED.IN}'
          description: 'Stay signed in'
        - macro: '{$WEBSITE.LOGIN.TEXT.STAY.SIGNED.IN.BUTTON}'
          value: '#idBtn_Back'
        - macro: '{$WEBSITE.LOGIN.TEXT.STAY.SIGNED.IN.BUTTON.STRATEGY}'
          value: 'css selector'
        - macro: '{$WEBSITE.LOGIN.TEXT.STAY.SIGNED.IN2}'
        - macro: '{$WEBSITE.NAVIGATION.LOAD.MAX.WARN}'
          value: '5'
          description: 'The maximum browser response time expressed in seconds for a trigger expression.'
        - macro: '{$WEBSITE.PASSWD}'
          value: passwd
          description: 'Alterar para a senha de login no site'
        - macro: '{$WEBSITE.PASSWD.FIELD}'
          value: '//input[@id=''password'']'
          description: 'Campo no HTML para preencher a senha'
        - macro: '{$WEBSITE.PASSWD.FIELD.STRATEGY}'
          value: xpath
        - macro: '{$WEBSITE.PASSWD.FIELD2}'
          description: 'Campos de password na segunda pagina'
        - macro: '{$WEBSITE.PASSWD.FIELD2.STRATEGY}'
          value: 'css selector'
        - macro: '{$WEBSITE.PASSWD.FIELD3}'
          description: 'Campos de password na terceira pagina'
        - macro: '{$WEBSITE.PASSWD.FIELD3.STRATEGY}'
          value: xpath
        - macro: '{$WEBSITE.PATH}'
          description: 'The path to resource.'
        - macro: '{$WEBSITE.REGIONAL}'
          value: SEM-INC
        - macro: '{$WEBSITE.RESOURCE.LOAD.MAX.WARN}'
          value: '5'
          description: 'The maximum browser response time expressed in seconds for a trigger expression.'
        - macro: '{$WEBSITE.SCHEME}'
          value: https
          description: 'The request scheme, which may be either HTTP or HTTPS.'
        - macro: '{$WEBSITE.SCREEN.HEIGHT}'
          value: '1080'
          description: 'Screen size height in pixels, used for screenshot.'
        - macro: '{$WEBSITE.SCREEN.WIDTH}'
          value: '1920'
          description: 'Screen size width in pixels, used for screenshot.'
        - macro: '{$WEBSITE.SEARCH.STRING}'
        - macro: '{$WEBSITE.SLEEP.TIMEOUT}'
          value: '1000'
          description: 'Timeout para carregar a pagina apos o login'
        - macro: '{$WEBSITE.TRIGGER.ENABLE}'
          value: '0'
        - macro: '{$WEBSITE.USER}'
          value: user
          description: 'Alterar para o usuario de login no site'
        - macro: '{$WEBSITE.USER.FIELD}'
          value: '//input[@id=''name'']'
          description: 'Campo no HTML para preencher o username'
        - macro: '{$WEBSITE.USER.FIELD.STRATEGY}'
          value: xpath
        - macro: '{$WEBSITE.USER.FIELD2}'
          description: 'Campo de login na segunda pagina'
        - macro: '{$WEBSITE.USER.FIELD2.STRATEGY}'
          value: xpath
        - macro: '{$WEBSITE.USER.IMG}'
      dashboards:
        - uuid: 10904d92b712401d9a39ea1c992be081
          name: 'Website overview'
          pages:
            - name: Screenshots
              widgets:
                - type: itemhistory
                  name: Screenshots
                  width: '16'
                  height: '10'
                  hide_header: 'YES'
                  fields:
                    - type: ITEM
                      name: columns.0.itemid
                      value:
                        host: 'Website by Browser with Login BR'
                        key: website.screenshot
                    - type: STRING
                      name: columns.0.name
                      value: Screenshot
                    - type: INTEGER
                      name: columns.0.show_thumbnail
                      value: '1'
                    - type: INTEGER
                      name: layout
                      value: '1'
                    - type: STRING
                      name: reference
                      value: MBTYI
                    - type: INTEGER
                      name: show_timestamp
                      value: '1'
                - type: problems
                  name: Problems
                  x: '16'
                  width: '54'
                  fields:
                    - type: STRING
                      name: reference
                      value: CEXAL
                    - type: INTEGER
                      name: show
                      value: '3'
                    - type: INTEGER
                      name: show_opdata
                      value: '1'
                    - type: INTEGER
                      name: show_suppressed
                      value: '1'
                - type: svggraph
                  name: 'Duration (s)'
                  x: '16'
                  'y': '2'
                  width: '28'
                  height: '5'
                  fields:
                    - type: STRING
                      name: ds.0.color
                      value: 0080FF
                    - type: INTEGER
                      name: ds.0.fill
                      value: '4'
                    - type: STRING
                      name: ds.0.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Duration'
                    - type: INTEGER
                      name: ds.0.width
                      value: '2'
                    - type: INTEGER
                      name: legend_statistic
                      value: '1'
                    - type: STRING
                      name: reference
                      value: QRUSS
                    - type: INTEGER
                      name: righty
                      value: '0'
                    - type: INTEGER
                      name: severities.0
                      value: '2'
                    - type: INTEGER
                      name: severities.1
                      value: '3'
                    - type: INTEGER
                      name: severities.2
                      value: '4'
                    - type: INTEGER
                      name: severities.3
                      value: '5'
                    - type: INTEGER
                      name: show_problems
                      value: '1'
                - type: svggraph
                  name: 'Load time'
                  x: '16'
                  'y': '7'
                  width: '28'
                  height: '5'
                  fields:
                    - type: STRING
                      name: ds.0.color
                      value: FF465C
                    - type: INTEGER
                      name: ds.0.fill
                      value: '4'
                    - type: STRING
                      name: ds.0.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Navigation load event time'
                    - type: INTEGER
                      name: ds.0.width
                      value: '2'
                    - type: INTEGER
                      name: ds.1.axisy
                      value: '1'
                    - type: STRING
                      name: ds.1.color
                      value: FFD54F
                    - type: INTEGER
                      name: ds.1.fill
                      value: '4'
                    - type: STRING
                      name: ds.1.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Resource load event time'
                    - type: INTEGER
                      name: ds.1.missingdatafunc
                      value: '1'
                    - type: INTEGER
                      name: ds.1.width
                      value: '2'
                    - type: INTEGER
                      name: legend_statistic
                      value: '1'
                    - type: STRING
                      name: reference
                      value: OVVDR
                    - type: INTEGER
                      name: severities.0
                      value: '2'
                    - type: INTEGER
                      name: severities.1
                      value: '3'
                    - type: INTEGER
                      name: severities.2
                      value: '4'
                    - type: INTEGER
                      name: severities.3
                      value: '5'
                    - type: INTEGER
                      name: show_problems
                      value: '1'
                - type: svggraph
                  name: 'Navigation timing'
                  x: '16'
                  'y': '12'
                  width: '28'
                  height: '5'
                  fields:
                    - type: STRING
                      name: ds.0.color
                      value: FF7043
                    - type: STRING
                      name: ds.0.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Navigation resource fetch time'
                    - type: STRING
                      name: ds.1.color
                      value: FFD54F
                    - type: STRING
                      name: ds.1.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Navigation DNS lookup time'
                    - type: STRING
                      name: ds.2.color
                      value: 546E7A
                    - type: STRING
                      name: ds.2.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Navigation TCP handshake time'
                    - type: STRING
                      name: ds.3.color
                      value: FF465C
                    - type: STRING
                      name: ds.3.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Navigation TLS negotiation time'
                    - type: STRING
                      name: ds.4.color
                      value: 3949AB
                    - type: STRING
                      name: ds.4.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Navigation request time'
                    - type: STRING
                      name: ds.5.color
                      value: 388E3C
                    - type: STRING
                      name: ds.5.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Navigation response time'
                    - type: INTEGER
                      name: legend_statistic
                      value: '1'
                    - type: STRING
                      name: reference
                      value: FBLXC
                    - type: INTEGER
                      name: righty
                      value: '0'
                - type: svggraph
                  name: 'Navigation size'
                  x: '44'
                  'y': '2'
                  width: '28'
                  height: '5'
                  fields:
                    - type: STRING
                      name: ds.0.color
                      value: '666699'
                    - type: STRING
                      name: ds.0.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Navigation decodedBody size'
                    - type: INTEGER
                      name: ds.0.type
                      value: '3'
                    - type: STRING
                      name: ds.1.color
                      value: FFD54F
                    - type: STRING
                      name: ds.1.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Navigation encodedBody size'
                    - type: INTEGER
                      name: ds.1.type
                      value: '3'
                    - type: STRING
                      name: ds.2.color
                      value: 0EC9AC
                    - type: STRING
                      name: ds.2.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Navigation transfer size'
                    - type: INTEGER
                      name: ds.2.type
                      value: '3'
                    - type: INTEGER
                      name: legend_statistic
                      value: '1'
                    - type: STRING
                      name: reference
                      value: PXXYQ
                    - type: INTEGER
                      name: righty
                      value: '0'
                    - type: INTEGER
                      name: severities.0
                      value: '2'
                    - type: INTEGER
                      name: severities.1
                      value: '3'
                    - type: INTEGER
                      name: severities.2
                      value: '4'
                    - type: INTEGER
                      name: severities.3
                      value: '5'
                    - type: INTEGER
                      name: show_problems
                      value: '1'
                - type: svggraph
                  name: 'Resource timing'
                  x: '44'
                  'y': '7'
                  width: '28'
                  height: '5'
                  fields:
                    - type: STRING
                      name: ds.0.color
                      value: FF8000
                    - type: STRING
                      name: ds.0.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Resource resource fetch time'
                    - type: STRING
                      name: ds.1.color
                      value: FF465C
                    - type: STRING
                      name: ds.1.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Resource DNS lookup time'
                    - type: STRING
                      name: ds.2.color
                      value: FFD54F
                    - type: STRING
                      name: ds.2.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Resource TCP handshake time'
                    - type: STRING
                      name: ds.3.color
                      value: 0EC9AC
                    - type: STRING
                      name: ds.3.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Resource TLS negotiation time'
                    - type: STRING
                      name: ds.4.color
                      value: 524BBC
                    - type: STRING
                      name: ds.4.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Resource request time'
                    - type: STRING
                      name: ds.5.color
                      value: ED1248
                    - type: STRING
                      name: ds.5.items.0
                      value: 'Website {$WEBSITE.DOMAIN} Resource response time'
                    - type: INTEGER
                      name: legend_statistic
                      value: '1'
                    - type: STRING
                      name: reference
                      value: ZLUHM
                    - type: INTEGER
                      name: righty
                      value: '0'
  graphs:
    - uuid: 04829e71a8cd45418371a061d08dd400
      name: 'Performance Navigation Timing'
      graph_items:
        - color: 199C0D
          item:
            host: 'Website by Browser with Login BR'
            key: website.navigation.dns_lookup_time
        - sortorder: '1'
          color: F63100
          item:
            host: 'Website by Browser with Login BR'
            key: website.navigation.tcp_handshake_time
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Website by Browser with Login BR'
            key: website.navigation.tls_negotiation_time
        - sortorder: '3'
          color: F7941D
          item:
            host: 'Website by Browser with Login BR'
            key: website.navigation.dom_content_loaded_time
        - sortorder: '4'
          color: FC6EA3
          item:
            host: 'Website by Browser with Login BR'
            key: website.navigation.resource_fetch_time
        - sortorder: '5'
          color: 6C59DC
          item:
            host: 'Website by Browser with Login BR'
            key: website.navigation.service_worker_processing_time
        - sortorder: '6'
          color: C7A72D
          item:
            host: 'Website by Browser with Login BR'
            key: website.navigation.request_time
        - sortorder: '7'
          color: BA2A5D
          item:
            host: 'Website by Browser with Login BR'
            key: website.navigation.response_time
    - uuid: 852dae6e7d614ba684ec6570e6ece72e
      name: 'Performance Resource Timing'
      graph_items:
        - color: 199C0D
          item:
            host: 'Website by Browser with Login BR'
            key: website.resource.dns_lookup_time
        - sortorder: '1'
          color: F63100
          item:
            host: 'Website by Browser with Login BR'
            key: website.resource.tcp_handshake_time
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Website by Browser with Login BR'
            key: website.resource.tls_negotiation_time
        - sortorder: '3'
          color: F7941D
          item:
            host: 'Website by Browser with Login BR'
            key: website.resource.dom_content_loaded_time
        - sortorder: '4'
          color: FC6EA3
          item:
            host: 'Website by Browser with Login BR'
            key: website.resource.fetch_time
        - sortorder: '5'
          color: 6C59DC
          item:
            host: 'Website by Browser with Login BR'
            key: website.resource.service_worker_processing_time
        - sortorder: '6'
          color: C7A72D
          item:
            host: 'Website by Browser with Login BR'
            key: website.resource.request_time
        - sortorder: '7'
          color: BA2A5D
          item:
            host: 'Website by Browser with Login BR'
            key: website.resource.response_time
