zabbix_export:
  version: '8.0'
  template_groups:
    - uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
      name: Templates/Applications
    - uuid: 748ad4d098d447d492bb935c907f652f
      name: Templates/Databases
    - uuid: e960332b3f6c46a1956486d4f3f99fce
      name: 'Templates/Server hardware'
  host_groups:
    - uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
      name: Applications
  templates:
    - uuid: 60a07fefce4f424692fee42bf1f63bd0
      template: 'GitHub organization by HTTP'
      name: 'GitHub organization by HTTP'
      description: |
        This template is designed for the effortless deployment of GitHub organization monitoring by Zabbix via GitHub REST API and doesn't require any external scripts.
        
        For more details about GitHub REST API, refer to the official documentation:
        https://docs.github.com/en/rest?apiVersion=2022-11-28
        
        Setup:
        
        1. Create an access token for monitoring
        
        One of the simplest ways to send authenticated requests is to use a personal access token - either a classic or a fine-grained one:
        https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api?apiVersion=2022-11-28#authenticating-with-a-personal-access-token
        
        You can create a new classic personal access token by following the instructions in the official documentation:
        https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic
        
        Additional information about OAuth scopes is available in the official documentation:
        https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes
        
        Note that authenticated users must have admin access to the repository and the "repo" scope must be set to get information about self-hosted runners:
        https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-a-repository
        
        In order gather "security" and "analysis" metrics for a repository the authenticated user must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository:
        https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-organization-repositories
        
        Fine-grained personal access token
        
        Alternatively, you can use a fine-grained personal access token:
        https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token
        
        In order to use fine-grained tokens to monitor organization-owned repositories, organizations must opt in to fine-grained personal access tokens and set up a personal access token policy:
        https://docs.github.com/en/organizations/managing-programmatic-access-to-your-organization/setting-a-personal-access-token-policy-for-your-organization
        
        The fine-grained token needs to have the following permissions set to provide access to the organization and repository resources:
        - "Actions" repository permissions (read);
        - "Administration" repository permissions (read);
        - "Contents" repository permissions (read);
        - "Issues" repository permissions (read);
        - "Metadata" repository permissions (read);
        - "Pull requests" repository permissions (read).
        
        2. Set the access token that you've created in step 1 in the "{$GITHUB.API.TOKEN}" macro
        3. Change the API URL in the "{$GITHUB.API.URL}" macro if needed (for self-hosted installations)
        4. Set the organization name in the "{$GITHUB.ORG.NAME}" macro
        5. Set the Copilot monitoring flag to "1" in the "{$GITHUB.COPILOT.USED}" macro if you want to gather Copilot metrics
        
        Note that the Copilot Metrics API access policy must be enabled for the organization. Only organization owners and owners and billing managers of the parent enterprise can view Copilot metrics.
        https://docs.github.com/en/rest/copilot/copilot-metrics?apiVersion=2022-11-28#get-copilot-metrics-for-an-organization
        
        OAuth app tokens and personal access tokens (classic) need either the "manage_billing:copilot", "read:org", or "read:enterprise" scopes to use this endpoint.
        
        The fine-grained token needs to have the following permissions set to provide access to Copilot metrics:
        - "GitHub Copilot Business" organization permissions (read);
        - "Administration" organization permissions (read).
        
        6. Set the LLD rule filters if needed
        
        Note: Update intervals and timeouts for script items can be changed individually via "{$GITHUB.INTERVAL}" and "{$GITHUB.TIMEOUT}" macros with context. Depending on the organization being monitored, it can be adjusted if needed (if you are exceeding rate limits, you can increase update intervals for some script items to stay within per hour request limits). But be aware that it may also affect the triggers (check whether the item is used in triggers and adjust thresholds and/or evaluation periods if needed).
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        This template is designed for the effortless deployment of GitHub organization monitoring by Zabbix via GitHub REST API and doesn't require any external scripts.
        
        For more details about GitHub REST API, refer to the [official documentation](https://docs.github.com/en/rest?apiVersion=2022-11-28).
        
        ## Setup
        
        Additional information is available in the official documentation:
        - [Regarding authentication](https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api?apiVersion=2022-11-28#about-authentication)
        - [Rate limits for the REST API](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28)
        
        1. **Create an access token for monitoring**
        
        One of the simplest ways to send authenticated requests is to use a [personal access token](https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api?apiVersion=2022-11-28#authenticating-with-a-personal-access-token) - either a classic or a fine-grained one.
        
        **Classic personal access token**
        
        You can create a new classic personal access token by following the [instructions in the official documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic).
        
        Additional information about OAuth scopes is available in the [official documentation](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes).
        
        Note that authenticated users must have admin access to the repository and the `repo` scope must be set to get information about [self-hosted runners](https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-a-repository).
        
        In order to gather [`security` and `analysis` metrics](https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-organization-repositories) for a repository the authenticated user must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository.
        
        **Fine-grained personal access token**
        
        Alternatively, you can use a [fine-grained personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token).
        
        In order to use fine-grained tokens to monitor organization-owned repositories, [organizations must opt in to fine-grained personal access tokens and set up a personal access token policy](https://docs.github.com/en/organizations/managing-programmatic-access-to-your-organization/setting-a-personal-access-token-policy-for-your-organization).
        
        The fine-grained token needs to have the following permissions set to provide access to the organization and repository resources:
        - "Actions" repository permissions (read);
        - "Administration" repository permissions (read);
        - "Contents" repository permissions (read);
        - "Issues" repository permissions (read);
        - "Metadata" repository permissions (read);
        - "Pull requests" repository permissions (read).
        
        2. **Set the access token** that you've created in step 1 in the `Access token` host wizard configuration field
        3. **Change the API URL** in the `API URL` host wizard configuration field if needed (for self-hosted installations)
        4. **Set the organization name** in the `Organization name` host wizard configuration field
        5. **Set the Copilot monitoring flag** by selecting the `Copilot monitoring` host wizard configuration checkbox
        
        Note that the Copilot Metrics API access policy must be enabled for the organization. Only organization owners and owners and billing managers of the parent enterprise can [view Copilot metrics](https://docs.github.com/en/rest/copilot/copilot-metrics?apiVersion=2022-11-28#get-copilot-metrics-for-an-organization).
        
        OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot`, `read:org`, or `read:enterprise` scopes to use this endpoint.
        
        The fine-grained token needs to have the following permissions set to provide access to Copilot metrics:
        - "GitHub Copilot Business" organization permissions (read);
        - "Administration" organization permissions (read).
        
        6. **Set the LLD rule filters** if needed:
        - Filter repositories by name: `{$GITHUB.REPO.NAME.MATCHES}`, `{$GITHUB.REPO.NAME.NOT_MATCHES}`;
        - Filter repositories by owner: `{$GITHUB.REPO.OWNER.MATCHES}`, `{$GITHUB.REPO.OWNER.NOT_MATCHES}`;
        - Filter Copilot IDE's by name: `{$GITHUB.COPILOT.IDE.NAME.MATCHES}`, `{$GITHUB.COPILOT.IDE.NAME.NOT_MATCHES}`;
        - Filter Copilot models by name: `{$GITHUB.COPILOT.MODEL.NAME.MATCHES}`, `{$GITHUB.COPILOT.MODEL.NAME.NOT_MATCHES}`;
        - Filter Copilot programming languages by name: `{$GITHUB.COPILOT.LANG.NAME.MATCHES}`, `{$GITHUB.COPILOT.LANG.NAME.NOT_MATCHES}`.
        
        Note: Update intervals and timeouts for script items can be changed individually via `Data update interval` and `API timeout` host wizard configuration fields with context. Depending on the organization being monitored, it can be adjusted if needed (if you are exceeding rate limits, you can increase update intervals for some script items to stay within per hour request limits). But be aware that it may also affect the triggers (check whether the item is used in triggers and adjust thresholds and/or evaluation periods if needed).
      vendor:
        name: Zabbix
        version: 8.0-1
      groups:
        - name: Templates/Applications
      items:
        - uuid: d3ebb4fa5d62435fb9566478774e3376
          name: 'Copilot active users'
          type: DEPENDENT
          key: github.org.copilot.active_users
          description: 'The number of users using Copilot.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.total_active_users
              error_handler: DISCARD_VALUE
          master_item:
            key: github.org.copilot.data_get
          tags:
            - tag: component
              value: copilot
        - uuid: 4d31b8157ca64ab581cfe641ce6c51cb
          name: 'Get copilot billing'
          type: SCRIPT
          key: github.org.copilot.billing_get
          delay: '{$GITHUB.INTERVAL:"get_copilot_billing"}'
          history: '0'
          value_type: TEXT
          params: |
            var github = {
            	params: {},
            
            	setParams: function (params, required) {
            		required = required || [];
            		required.concat(['api_url', 'user_agent', 'api_version', 'pagination_required', 'api_token']).forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined'
            				|| params[field] === '') {
            				throw 'Required parameter is not set: "' + field + '".';
            			}
            		});
            
            		github.params = params;
            
            		if (typeof github.params.api_url === 'string' && !github.params.api_url.endsWith('/')) {
            			github.params.api_url += '/';
            		}
            	},
            
            	apiRequest: function (url, pagination_required) {
            		const next_pattern = /<([^>]+)>;\s*rel="next"/i;
            		var request = new HttpRequest(),
            			response,
            			headers,
            			final_data = {
            				headers: {},
            				data: []
            			};
            
            		pagination_required = (typeof pagination_required !== 'undefined') ? pagination_required : 'true';
            
            		request.addHeader('User-Agent: ' + github.params.user_agent);
            		request.addHeader('Accept: application/vnd.github+json');
            		request.addHeader('X-GitHub-Api-Version: ' + github.params.api_version);
            		request.addHeader('Authorization: Bearer ' + github.params.api_token);
            
            		if (typeof github.params.http_proxy !== 'undefined' && github.params.http_proxy !== '') {
            			request.setProxy(github.params.http_proxy);
            			Zabbix.log(4, '[ GitHub Repo ] Using HTTP proxy: ' + github.params.http_proxy);
            		}
            
            		while (url) {
            			Zabbix.log(4, '[ GitHub Repo ] Sending request: ' + url);
            
            			response = request.get(url);
            
            			Zabbix.log(4, '[ GitHub Repo ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            			if (request.getStatus() < 200 || request.getStatus() >= 300) {
            				throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
            			}
            
            			try {
            				response = JSON.parse(response);
            			}
            			catch (error) {
            				throw 'Failed to parse response received from API. Check debug log for more information.';
            			}
            
            			var parsed_data = github.parseData(response);
            			final_data.data = final_data.data.concat(parsed_data);
            
            			headers = request.getHeaders();
            
            			url = ((headers.link || '').match(next_pattern) || [])[1];
            
            			if (pagination_required === 'false') {
            				url = '';
            			}
            		}
            
            		final_data.headers = request.getHeaders();
            
            		delete request;
            
            		return final_data;
            	},
            
            	parseData: function (response_data) {
            		if (!response_data) {
            			return [];
            		}
            
            		const normalization_required = "total_count" in response_data && !("url" in response_data);
            		if (!normalization_required) return response_data;
            
            		delete response_data.incomplete_results;
            		delete response_data.repository_selection;
            		delete response_data.total_count;
            
            		const namespaceKey = Object.keys(response_data)[0];
            		response_data = response_data[namespaceKey];
            
            		return response_data;
            	},
            
            	itemsCount: function (response_data) {
            		const last_page_number = /<[^>]+page=(\d+)>;\s*rel="last"/i;
            
            		if (response_data.headers.link){
            			return response_data.headers.link.match(last_page_number)[1];
            		}
            
            		return response_data.data.length;
            	}
            }
            
            try {
            	if ("{$GITHUB.COPILOT.USED}" !== "1") {
            		return '{}';
            	}
            
            	github.setParams(JSON.parse(value), ['org_name', 'api_query']);
            
            	var result = github.apiRequest(
            		github.params.api_url + github.params.api_query + '?' +
            		encodeURIComponent(github.params.query_params || ''),
            		github.params.pagination_required
            	);
            
            	return JSON.stringify(result);
            }
            catch (error) {
            	error += (String(error).endsWith('.')) ? '' : '.';
            	Zabbix.log(3, '[ GitHub Org ] ERROR: ' + error);
            	return JSON.stringify({ error: error });
            }
          description: |
            Get information about an organization's Copilot subscription, including seat breakdown and feature policies.
            
            Information about endpoint:
            https://docs.github.com/en/rest/copilot/copilot-user-management?apiVersion=2022-11-28#get-copilot-seat-information-and-settings-for-an-organization
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.data[0]'
              error_handler: DISCARD_VALUE
          timeout: '{$GITHUB.TIMEOUT:"get_copilot_billing"}'
          parameters:
            - name: api_query
              value: 'orgs/{$GITHUB.ORG.NAME}/copilot/billing'
            - name: api_token
              value: '{$GITHUB.API.TOKEN}'
            - name: api_url
              value: '{$GITHUB.API.URL}'
            - name: api_version
              value: '{$GITHUB.API_VERSION}'
            - name: http_proxy
              value: '{$GITHUB.HTTP_PROXY}'
            - name: org_name
              value: '{$GITHUB.ORG.NAME}'
            - name: pagination_required
              value: 'false'
            - name: user_agent
              value: '{$GITHUB.USER_AGENT}'
          tags:
            - tag: component
              value: raw
        - uuid: 6e78386c2660473a8ff626e78bf99879
          name: 'Get copilot billing check'
          type: DEPENDENT
          key: github.org.copilot.billing_get.check
          value_type: TEXT
          description: 'Data collection check.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.error
              error_handler: CUSTOM_VALUE
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: github.org.copilot.billing_get
          tags:
            - tag: component
              value: status
        - uuid: 98aff12047c64eea82410d88104232bf
          name: 'Get copilot data'
          type: SCRIPT
          key: github.org.copilot.data_get
          delay: '{$GITHUB.INTERVAL:"get_copilot_data"}'
          history: '0'
          value_type: TEXT
          params: |
            var github = {
            	params: {},
            
            	setParams: function (params, required) {
            		required = required || [];
            		required.concat(['api_url', 'user_agent', 'api_version', 'pagination_required', 'api_token']).forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined'
            				|| params[field] === '') {
            				throw 'Required parameter is not set: "' + field + '".';
            			}
            		});
            
            		github.params = params;
            
            		if (typeof github.params.api_url === 'string' && !github.params.api_url.endsWith('/')) {
            			github.params.api_url += '/';
            		}
            	},
            
            	apiRequest: function (url, pagination_required) {
            		const next_pattern = /<([^>]+)>;\s*rel="next"/i;
            		var request = new HttpRequest(),
            			response,
            			headers,
            			final_data = {
            				headers: {},
            				data: []
            			};
            
            		pagination_required = (typeof pagination_required !== 'undefined') ? pagination_required : 'true';
            
            		request.addHeader('User-Agent: ' + github.params.user_agent);
            		request.addHeader('Accept: application/vnd.github+json');
            		request.addHeader('X-GitHub-Api-Version: ' + github.params.api_version);
            		request.addHeader('Authorization: Bearer ' + github.params.api_token);
            
            		if (typeof github.params.http_proxy !== 'undefined' && github.params.http_proxy !== '') {
            			request.setProxy(github.params.http_proxy);
            			Zabbix.log(4, '[ GitHub Repo ] Using HTTP proxy: ' + github.params.http_proxy);
            		}
            
            		while (url) {
            			Zabbix.log(4, '[ GitHub Repo ] Sending request: ' + url);
            
            			response = request.get(url);
            
            			Zabbix.log(4, '[ GitHub Repo ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            			if (request.getStatus() < 200 || request.getStatus() >= 300) {
            				throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
            			}
            
            			try {
            				response = JSON.parse(response);
            			}
            			catch (error) {
            				throw 'Failed to parse response received from API. Check debug log for more information.';
            			}
            
            			var parsed_data = github.parseData(response);
            			final_data.data = final_data.data.concat(parsed_data);
            
            			headers = request.getHeaders();
            
            			url = ((headers.link || '').match(next_pattern) || [])[1];
            
            			if (pagination_required === 'false') {
            				url = '';
            			}
            		}
            
            		final_data.headers = request.getHeaders();
            
            		delete request;
            
            		return final_data;
            	},
            
            	parseData: function (response_data) {
            		if (!response_data) {
            			return [];
            		}
            
            		const normalization_required = "total_count" in response_data && !("url" in response_data);
            		if (!normalization_required) return response_data;
            
            		delete response_data.incomplete_results;
            		delete response_data.repository_selection;
            		delete response_data.total_count;
            
            		const namespaceKey = Object.keys(response_data)[0];
            		response_data = response_data[namespaceKey];
            
            		return response_data;
            	},
            
            	itemsCount: function (response_data) {
            		const last_page_number = /<[^>]+page=(\d+)>;\s*rel="last"/i;
            
            		if (response_data.headers.link){
            			return response_data.headers.link.match(last_page_number)[1];
            		}
            
            		return response_data.data.length;
            	}
            }
            
            try {
            	if ("{$GITHUB.COPILOT.USED}" !== "1") {
            		return '{}';
            	}
            
            	var now = new Date(),
            	since = new Date(now.getFullYear(), now.getMonth(), now.getDate()-1, 0).toISOString();
            
            	github.setParams(JSON.parse(value), ['org_name', 'api_query']);
            
            	var result = github.apiRequest(
            		github.params.api_url + github.params.api_query +
            		'?since=' + encodeURIComponent(since) + '&' + encodeURIComponent(github.params.query_params || ''),
            		github.params.pagination_required
            	);
            
            	return JSON.stringify(result);
            }
            catch (error) {
            	error += (String(error).endsWith('.')) ? '' : '.';
            	Zabbix.log(3, '[ GitHub Org ] ERROR: ' + error);
            	return JSON.stringify({ error: error });
            }
          description: |
            Get a breakdown of aggregated metrics for various GitHub Copilot features.
            
            Information about endpoint:
            https://docs.github.com/en/rest/copilot/copilot-metrics?apiVersion=2022-11-28#get-copilot-metrics-for-an-organization
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.data[0]'
              error_handler: DISCARD_VALUE
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          timeout: '{$GITHUB.TIMEOUT:"get_copilot_data"}'
          parameters:
            - name: api_query
              value: 'orgs/{$GITHUB.ORG.NAME}/copilot/metrics'
            - name: api_token
              value: '{$GITHUB.API.TOKEN}'
            - name: api_url
              value: '{$GITHUB.API.URL}'
            - name: api_version
              value: '{$GITHUB.API_VERSION}'
            - name: http_proxy
              value: '{$GITHUB.HTTP_PROXY}'
            - name: org_name
              value: '{$GITHUB.ORG.NAME}'
            - name: pagination_required
              value: 'false'
            - name: user_agent
              value: '{$GITHUB.USER_AGENT}'
          tags:
            - tag: component
              value: raw
        - uuid: ab0c9861d5854e7ca4b195794d011e54
          name: 'Get copilot data check'
          type: DEPENDENT
          key: github.org.copilot.data_get.check
          value_type: TEXT
          description: 'Data collection check.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.error
              error_handler: CUSTOM_VALUE
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: github.org.copilot.data_get
          tags:
            - tag: component
              value: status
        - uuid: 23ff1cb8385c43648bb7ada9f9e11ef9
          name: 'Copilot engaged users'
          type: DEPENDENT
          key: github.org.copilot.engaged_users
          description: 'The number of engaged users using Copilot.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.total_engaged_users
              error_handler: DISCARD_VALUE
          master_item:
            key: github.org.copilot.data_get
          tags:
            - tag: component
              value: copilot
        - uuid: e243201e87f84077bbcf4f64ed8e406b
          name: 'Copilot seats active'
          type: DEPENDENT
          key: github.org.copilot.seats_active_this_cycle
          description: 'The number of Copilot seats active this cycle.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.seat_breakdown.active_this_cycle
              error_handler: DISCARD_VALUE
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: github.org.copilot.billing_get
          tags:
            - tag: component
              value: copilot
        - uuid: df7255bf200145009c115c099e828f95
          name: 'Copilot seats added'
          type: DEPENDENT
          key: github.org.copilot.seats_added_this_cycle
          description: 'The number of Copilot seats added this cycle.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.seat_breakdown.added_this_cycle
              error_handler: DISCARD_VALUE
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: github.org.copilot.billing_get
          tags:
            - tag: component
              value: copilot
        - uuid: 6ddb446edb194f22b7f3fbe96b118799
          name: 'Copilot seats inactive'
          type: DEPENDENT
          key: github.org.copilot.seats_inactive_this_cycle
          description: 'The number of Copilot seats inactive this cycle.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.seat_breakdown.inactive_this_cycle
              error_handler: DISCARD_VALUE
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: github.org.copilot.billing_get
          tags:
            - tag: component
              value: copilot
        - uuid: 16f0e729b647439db5b2f0d125796e26
          name: 'Copilot seats cancelled'
          type: DEPENDENT
          key: github.org.copilot.seats_pending_cancellation
          description: 'The number of Copilot seats pending cancellation.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.seat_breakdown.pending_cancellation
              error_handler: DISCARD_VALUE
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: github.org.copilot.billing_get
          tags:
            - tag: component
              value: copilot
        - uuid: 991bc24ef1dd4ac280afa8e2f4da83d3
          name: 'Copilot seats invited'
          type: DEPENDENT
          key: github.org.copilot.seats_pending_invitation
          description: 'The number of Copilot seats pending invitation.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.seat_breakdown.pending_invitation
              error_handler: DISCARD_VALUE
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: github.org.copilot.billing_get
          tags:
            - tag: component
              value: copilot
        - uuid: 7fcbb017cbbd4103aa28c61d0e6f5a6d
          name: 'Copilot seats total'
          type: DEPENDENT
          key: github.org.copilot.seats_total
          description: 'The total number of Copilot seats.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.seat_breakdown.total
              error_handler: DISCARD_VALUE
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: github.org.copilot.billing_get
          tags:
            - tag: component
              value: copilot
        - uuid: 6e07f15d731b49cfb926b394e5f5395e
          name: 'Get repositories'
          type: SCRIPT
          key: github.org.repo.get
          delay: '{$GITHUB.INTERVAL:"get_repo_list"}'
          history: '0'
          value_type: TEXT
          params: |
            var github = {
            	params: {},
            
            	setParams: function (params, required) {
            		required = required || [];
            		required.concat(['api_url', 'user_agent', 'api_version', 'pagination_required', 'api_token']).forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined'
            				|| params[field] === '') {
            				throw 'Required parameter is not set: "' + field + '".';
            			}
            		});
            
            		github.params = params;
            
            		if (typeof github.params.api_url === 'string' && !github.params.api_url.endsWith('/')) {
            			github.params.api_url += '/';
            		}
            	},
            
            	apiRequest: function (url, pagination_required) {
            		const next_pattern = /<([^>]+)>;\s*rel="next"/i;
            		var request = new HttpRequest(),
            			response,
            			headers,
            			final_data = {
            				headers: {},
            				data: []
            			};
            
            		pagination_required = (typeof pagination_required !== 'undefined') ? pagination_required : 'true';
            
            		request.addHeader('User-Agent: ' + github.params.user_agent);
            		request.addHeader('Accept: application/vnd.github+json');
            		request.addHeader('X-GitHub-Api-Version: ' + github.params.api_version);
            		request.addHeader('Authorization: Bearer ' + github.params.api_token);
            
            		if (typeof github.params.http_proxy !== 'undefined' && github.params.http_proxy !== '') {
            			request.setProxy(github.params.http_proxy);
            			Zabbix.log(4, '[ GitHub Repo ] Using HTTP proxy: ' + github.params.http_proxy);
            		}
            
            		while (url) {
            			Zabbix.log(4, '[ GitHub Repo ] Sending request: ' + url);
            
            			response = request.get(url);
            
            			Zabbix.log(4, '[ GitHub Repo ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            			if (request.getStatus() < 200 || request.getStatus() >= 300) {
            				throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
            			}
            
            			try {
            				response = JSON.parse(response);
            			}
            			catch (error) {
            				throw 'Failed to parse response received from API. Check debug log for more information.';
            			}
            
            			var parsed_data = github.parseData(response);
            			final_data.data = final_data.data.concat(parsed_data);
            
            			headers = request.getHeaders();
            
            			url = ((headers.link || '').match(next_pattern) || [])[1];
            
            			if (pagination_required === 'false') {
            				url = '';
            			}
            		}
            
            		final_data.headers = request.getHeaders();
            
            		delete request;
            
            		return final_data;
            	},
            
            	parseData: function (response_data) {
            		if (!response_data) {
            			return [];
            		}
            
            		const normalization_required = "total_count" in response_data && !("url" in response_data);
            		if (!normalization_required) return response_data;
            
            		delete response_data.incomplete_results;
            		delete response_data.repository_selection;
            		delete response_data.total_count;
            
            		const namespaceKey = Object.keys(response_data)[0];
            		response_data = response_data[namespaceKey];
            
            		return response_data;
            	},
            
            	itemsCount: function (response_data) {
            		const last_page_number = /<[^>]+page=(\d+)>;\s*rel="last"/i;
            
            		if (response_data.headers.link){
            			return response_data.headers.link.match(last_page_number)[1];
            		}
            
            		return response_data.data.length;
            	}
            }
            
            try {
            	github.setParams(JSON.parse(value), ['org_name', 'api_query']);
            
            	var result = github.apiRequest(
            		github.params.api_url + github.params.api_query + '?' +
            		encodeURIComponent(github.params.query_params || ''),
            		github.params.pagination_required
            	);
            
            	return JSON.stringify(result);
            }
            catch (error) {
            	error += (String(error).endsWith('.')) ? '' : '.';
            	Zabbix.log(3, '[ GitHub Org ] ERROR: ' + error);
            	return JSON.stringify({ error: error });
            }
          description: |
            Get a list of repositories for the `{$GITHUB.ORG.NAME}` organization.
            
            Information about endpoint:
            https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-organization-repositories
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          timeout: '{$GITHUB.TIMEOUT:"get_repo_list"}'
          parameters:
            - name: api_query
              value: 'orgs/{$GITHUB.ORG.NAME}/repos'
            - name: api_token
              value: '{$GITHUB.API.TOKEN}'
            - name: api_url
              value: '{$GITHUB.API.URL}'
            - name: api_version
              value: '{$GITHUB.API_VERSION}'
            - name: http_proxy
              value: '{$GITHUB.HTTP_PROXY}'
            - name: org_name
              value: '{$GITHUB.ORG.NAME}'
            - name: pagination_required
              value: 'false'
            - name: user_agent
              value: '{$GITHUB.USER_AGENT}'
          tags:
            - tag: component
              value: raw
        - uuid: 9030b4f40c04476eaf0071b462bc5d89
          name: 'Get repositories check'
          type: DEPENDENT
          key: github.org.repo.get.check
          value_type: TEXT
          description: 'Data collection check.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.error
              error_handler: CUSTOM_VALUE
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: github.org.repo.get
          tags:
            - tag: component
              value: status
        - uuid: c9140bb893f74681a03e8ccef35aa163
          name: 'Number of repositories'
          type: DEPENDENT
          key: github.org.repo.number
          description: 'The number of repositories in the organization.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data.length()
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: github.org.repo.get
          tags:
            - tag: component
              value: repository
        - uuid: b8c59be2d3ea45f88a2450f9257734e6
          name: 'Number of archived repositories'
          type: DEPENDENT
          key: github.org.repo.number_archived
          description: 'The number of archived repositories in the organization.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.data..[?(@.archived == "true")].length()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: github.org.repo.get
          tags:
            - tag: component
              value: repository
        - uuid: 46b39494159642488c246adfa8363874
          name: 'Number of disabled repositories'
          type: DEPENDENT
          key: github.org.repo.number_disabled
          description: 'The number of disabled repositories in the organization.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.data..[?(@.disabled == "true")].length()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: github.org.repo.get
          tags:
            - tag: component
              value: repository
        - uuid: b708ebe06f4c4bd3ad156fc5909e8b18
          name: 'Number of private repositories'
          type: DEPENDENT
          key: github.org.repo.number_private
          description: 'The number of private repositories in the organization.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.data..[?(@.private == "true")].length()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: github.org.repo.get
          tags:
            - tag: component
              value: repository
        - uuid: 66fc7d53caa747de8afbfe05ba752c57
          name: 'Number of repository templates'
          type: DEPENDENT
          key: github.org.repo.number_templates
          description: 'The number of repository templates in the organization.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.data..[?(@.is_template == "true")].length()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: github.org.repo.get
          tags:
            - tag: component
              value: repository
        - uuid: ae4bd3ea08544a4686cbfd9bbc44c0ed
          name: 'Open issue count'
          type: DEPENDENT
          key: github.org.repo.open_issues
          description: 'The total number of issues opened in all repositories.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data..open_issues_count.sum()
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: github.org.repo.get
          tags:
            - tag: component
              value: repository
        - uuid: 94fcf84d0fa3439c8063aea4d52c4c61
          name: 'Total size of repositories'
          type: DEPENDENT
          key: github.org.repo.total_size
          units: B
          description: 'The total size of repositories in the organization.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data..size.sum()
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: MULTIPLIER
              parameters:
                - '1024'
          master_item:
            key: github.org.repo.get
          tags:
            - tag: component
              value: repository
      discovery_rules:
        - uuid: 157c0a7632994459840c98e7cc32ef30
          name: 'Copilot IDE code completion discovery'
          type: DEPENDENT
          key: github.org.copilot_completion.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#IDE_NAME}'
                value: '{$GITHUB.COPILOT.IDE.NAME.MATCHES}'
              - macro: '{#IDE_NAME}'
                value: '{$GITHUB.COPILOT.IDE.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'The discovery of Copilot IDE code completions.'
          item_prototypes:
            - uuid: 737abc88f0ca48b7a27dea0cdbad837d
              name: 'IDE [{#IDE_NAME}]: Engaged users'
              type: DEPENDENT
              key: 'github.org.copilot_completion.engaged_users[{#IDE_NAME}]'
              description: 'The number of engaged users using Copilot in `{#IDE_NAME}`.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_ide_code_completions.editors[?(@.name == ''{#IDE_NAME}'')].total_engaged_users.first()'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: completion
                - tag: component
                  value: copilot
                - tag: component
                  value: ide
                - tag: ide
                  value: '{#IDE_NAME}'
          master_item:
            key: github.org.copilot.data_get
          lld_macro_paths:
            - lld_macro: '{#IDE_NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.copilot_ide_code_completions.editors
              error_handler: DISCARD_VALUE
        - uuid: 7ebdc287c68e47cd86cd704f0795431d
          name: '{#IDE_NAME} [{#MODEL_NAME}]: Language discovery'
          type: DEPENDENT
          key: 'github.org.copilot_completion_language.discovery[{#IDE_NAME},{#MODEL_NAME}]'
          filter:
            evaltype: AND
            conditions:
              - macro: '{#LANG_NAME}'
                value: '{$GITHUB.COPILOT.LANG.NAME.MATCHES}'
              - macro: '{#LANG_NAME}'
                value: '{$GITHUB.COPILOT.LANG.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'The discovery of programming languages used by the `{#MODEL_NAME}` model in the `{#IDE_NAME}` Copilot chat.'
          item_prototypes:
            - uuid: dc47aba6408041248f66ecf9890667f3
              name: '{#IDE_NAME} [{#MODEL_NAME}/{#LANG_NAME}]: Acceptance rate'
              type: CALCULATED
              key: 'github.org.copilot_completion_language.acceptance_rate[{#IDE_NAME},{#MODEL_NAME},{#LANG_NAME}]'
              value_type: FLOAT
              units: '%'
              params: 'last(//github.org.copilot_completion_language.code_acceptances[{#IDE_NAME},{#MODEL_NAME},{#LANG_NAME}])/last(//github.org.copilot_completion_language.code_suggestions[{#IDE_NAME},{#MODEL_NAME},{#LANG_NAME}])*100'
              description: 'The percentage of code acceptances in `{#LANG_NAME}` for the Copilot `{#MODEL_NAME}` model in `{#IDE_NAME}`.'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: copilot
                - tag: component
                  value: ide
                - tag: ide
                  value: '{#IDE_NAME}'
                - tag: language
                  value: '{#LANG_NAME}'
                - tag: model
                  value: '{#MODEL_NAME}'
            - uuid: 5c26002f73b34c4ea55d60f1c821fa0a
              name: '{#IDE_NAME} [{#MODEL_NAME}/{#LANG_NAME}]: Code acceptances'
              type: DEPENDENT
              key: 'github.org.copilot_completion_language.code_acceptances[{#IDE_NAME},{#MODEL_NAME},{#LANG_NAME}]'
              description: 'The number of code acceptances in `{#LANG_NAME}` by users for suggestions provided by the Copilot `{#MODEL_NAME}` model in `{#IDE_NAME}`.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_ide_code_completions.editors[?(@.name == ''{#IDE_NAME}'')].models[?(@.name == ''{#MODEL_NAME}'')].languages[?(@.name == ''{#LANG_NAME}'')].total_code_acceptances.first()'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: component
                  value: ide
                - tag: ide
                  value: '{#IDE_NAME}'
                - tag: language
                  value: '{#LANG_NAME}'
                - tag: model
                  value: '{#MODEL_NAME}'
            - uuid: 206200b8b1544c1c87b7b2712898ce3a
              name: '{#IDE_NAME} [{#MODEL_NAME}/{#LANG_NAME}]: Code suggestions'
              type: DEPENDENT
              key: 'github.org.copilot_completion_language.code_suggestions[{#IDE_NAME},{#MODEL_NAME},{#LANG_NAME}]'
              description: 'The number of code suggestions in `{#LANG_NAME}` provided by the Copilot `{#MODEL_NAME}` model in `{#IDE_NAME}`.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_ide_code_completions.editors[?(@.name == ''{#IDE_NAME}'')].models[?(@.name == ''{#MODEL_NAME}'')].languages[?(@.name == ''{#LANG_NAME}'')].total_code_suggestions.first()'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: component
                  value: ide
                - tag: ide
                  value: '{#IDE_NAME}'
                - tag: language
                  value: '{#LANG_NAME}'
                - tag: model
                  value: '{#MODEL_NAME}'
            - uuid: 7f1f8c11f272439ab6556cb9225c27fb
              name: '{#IDE_NAME} [{#MODEL_NAME}/{#LANG_NAME}]: Engaged users'
              type: DEPENDENT
              key: 'github.org.copilot_completion_language.engaged_users[{#IDE_NAME},{#MODEL_NAME},{#LANG_NAME}]'
              description: 'The number of engaged users using the Copilot `{#MODEL_NAME}` model in `{#IDE_NAME}` for code in `{#LANG_NAME}`.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_ide_code_completions.editors[?(@.name == ''{#IDE_NAME}'')].models[?(@.name == ''{#MODEL_NAME}'')].languages[?(@.name == ''{#LANG_NAME}'')].total_engaged_users.first()'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: component
                  value: ide
                - tag: ide
                  value: '{#IDE_NAME}'
                - tag: language
                  value: '{#LANG_NAME}'
                - tag: model
                  value: '{#MODEL_NAME}'
            - uuid: 3df0e2bfff964275b105802bce9ba0f4
              name: '{#IDE_NAME} [{#MODEL_NAME}/{#LANG_NAME}]: Total code lines accepted'
              type: DEPENDENT
              key: 'github.org.copilot_completion_language.lines_accepted[{#IDE_NAME},{#MODEL_NAME},{#LANG_NAME}]'
              description: 'The total number of code lines in `{#LANG_NAME}` suggested by the Copilot `{#MODEL_NAME}` model in `{#IDE_NAME}` and accepted by users.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_ide_code_completions.editors[?(@.name == ''{#IDE_NAME}'')].models[?(@.name == ''{#MODEL_NAME}'')].languages[?(@.name == ''{#LANG_NAME}'')].total_code_lines_accepted.first()'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: component
                  value: ide
                - tag: ide
                  value: '{#IDE_NAME}'
                - tag: language
                  value: '{#LANG_NAME}'
                - tag: model
                  value: '{#MODEL_NAME}'
            - uuid: 5109e502ef0145f480b6d2e07192eabc
              name: '{#IDE_NAME} [{#MODEL_NAME}/{#LANG_NAME}]: Total code lines suggested'
              type: DEPENDENT
              key: 'github.org.copilot_completion_language.lines_suggested[{#IDE_NAME},{#MODEL_NAME},{#LANG_NAME}]'
              description: 'The total number of code lines in `{#LANG_NAME}` suggested by the Copilot `{#MODEL_NAME}` model in `{#IDE_NAME}`.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_ide_code_completions.editors[?(@.name == ''{#IDE_NAME}'')].models[?(@.name == ''{#MODEL_NAME}'')].languages[?(@.name == ''{#LANG_NAME}'')].total_code_lines_suggested.first()'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: component
                  value: ide
                - tag: ide
                  value: '{#IDE_NAME}'
                - tag: language
                  value: '{#LANG_NAME}'
                - tag: model
                  value: '{#MODEL_NAME}'
            - uuid: 427e0d382af24227af462f893f6d5285
              name: '{#IDE_NAME} [{#MODEL_NAME}/{#LANG_NAME}]: Line acceptance rate'
              type: CALCULATED
              key: 'github.org.copilot_completion_language.line_acceptance_rate[{#IDE_NAME},{#MODEL_NAME},{#LANG_NAME}]'
              value_type: FLOAT
              units: '%'
              params: 'last(//github.org.copilot_completion_language.lines_accepted[{#IDE_NAME},{#MODEL_NAME},{#LANG_NAME}])/last(//github.org.copilot_completion_language.lines_suggested[{#IDE_NAME},{#MODEL_NAME},{#LANG_NAME}])*100'
              description: 'The percentage of code lines accepted in `{#LANG_NAME}` for the Copilot `{#MODEL_NAME}` model in `{#IDE_NAME}`.'
              preprocessing:
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              tags:
                - tag: component
                  value: copilot
                - tag: component
                  value: ide
                - tag: ide
                  value: '{#IDE_NAME}'
                - tag: language
                  value: '{#LANG_NAME}'
                - tag: model
                  value: '{#MODEL_NAME}'
          graph_prototypes:
            - uuid: a741d88a2aa04715b9e3cfbc58266e6b
              name: '{#IDE_NAME} [{#MODEL_NAME}/{#LANG_NAME}]: Code acceptances'
              graph_items:
                - color: 199C0D
                  yaxisside: RIGHT
                  item:
                    host: 'GitHub organization by HTTP'
                    key: 'github.org.copilot_completion_language.code_acceptances[{#IDE_NAME},{#MODEL_NAME},{#LANG_NAME}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'GitHub organization by HTTP'
                    key: 'github.org.copilot_completion_language.lines_accepted[{#IDE_NAME},{#MODEL_NAME},{#LANG_NAME}]'
            - uuid: 6ddad3d69edf4fddbae6433b3840c91d
              name: '{#IDE_NAME} [{#MODEL_NAME}/{#LANG_NAME}]: Code suggestions'
              graph_items:
                - color: 199C0D
                  yaxisside: RIGHT
                  item:
                    host: 'GitHub organization by HTTP'
                    key: 'github.org.copilot_completion_language.code_suggestions[{#IDE_NAME},{#MODEL_NAME},{#LANG_NAME}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'GitHub organization by HTTP'
                    key: 'github.org.copilot_completion_language.lines_suggested[{#IDE_NAME},{#MODEL_NAME},{#LANG_NAME}]'
          parent_discovery_rule:
            key: 'github.org.copilot_completion_model.discovery[{#IDE_NAME}]'
          master_item:
            key: github.org.copilot.data_get
          lld_macro_paths:
            - lld_macro: '{#LANG_NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.copilot_ide_code_completions.editors[?(@.name == ''{#IDE_NAME}'')].models[?(@.name == ''{#MODEL_NAME}'')].languages.first()'
              error_handler: DISCARD_VALUE
        - uuid: f8ef4833542b49aeb783a64b2b948b9f
          name: 'IDE [{#IDE_NAME}]: Model discovery'
          type: DEPENDENT
          key: 'github.org.copilot_completion_model.discovery[{#IDE_NAME}]'
          filter:
            evaltype: AND
            conditions:
              - macro: '{#MODEL_NAME}'
                value: '{$GITHUB.COPILOT.MODEL.NAME.MATCHES}'
              - macro: '{#MODEL_NAME}'
                value: '{$GITHUB.COPILOT.MODEL.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'The discovery of models used in the `{#IDE_NAME}` Copilot chat.'
          item_prototypes:
            - uuid: b5f214a4e25c457c8c0b08b35c1af048
              name: '{#IDE_NAME} [{#MODEL_NAME}]: Engaged users'
              type: DEPENDENT
              key: 'github.org.copilot_completion_model.engaged_users[{#IDE_NAME},{#MODEL_NAME}]'
              description: 'The number of engaged users using the Copilot `{#MODEL_NAME}` model in `{#IDE_NAME}`.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_ide_code_completions.editors[?(@.name == ''{#IDE_NAME}'')].models[?(@.name == ''{#MODEL_NAME}'')].total_engaged_users.first()'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: component
                  value: ide
                - tag: ide
                  value: '{#IDE_NAME}'
                - tag: model
                  value: '{#MODEL_NAME}'
          parent_discovery_rule:
            key: github.org.copilot_completion.discovery
          master_item:
            key: github.org.copilot.data_get
          lld_macro_paths:
            - lld_macro: '{#CUSTOM_FLAG}'
              path: $.is_custom_model
            - lld_macro: '{#MODEL_NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.copilot_ide_code_completions.editors[?(@.name == ''{#IDE_NAME}'')].models.first()'
              error_handler: DISCARD_VALUE
        - uuid: 3ffabd46a6124d91963a6e9cdb653719
          name: 'Copilot IDE chat discovery'
          type: DEPENDENT
          key: github.org.copilot_ide_chat.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#IDE_NAME}'
                value: '{$GITHUB.COPILOT.IDE.NAME.MATCHES}'
              - macro: '{#IDE_NAME}'
                value: '{$GITHUB.COPILOT.IDE.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'The discovery of Copilot IDE chats.'
          item_prototypes:
            - uuid: cb6e480e86f44e37b568e80ebbfe39c2
              name: 'IDE [{#IDE_NAME}]: Engaged users'
              type: DEPENDENT
              key: 'github.org.copilot_ide_chat.engaged_users[{#IDE_NAME}]'
              description: 'The number of engaged users using Copilot in `{#IDE_NAME}`.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_ide_chat.editors[?(@.name == ''{#IDE_NAME}'')].total_engaged_users.first()'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: component
                  value: ide
                - tag: ide
                  value: '{#IDE_NAME}'
          master_item:
            key: github.org.copilot.data_get
          lld_macro_paths:
            - lld_macro: '{#IDE_NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.copilot_ide_chat.editors
              error_handler: DISCARD_VALUE
        - uuid: faee4e47d8f8499ebf88ab7b2e6abc68
          name: 'Copilot IDE code language discovery'
          type: DEPENDENT
          key: github.org.copilot_ide_lang.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#LANG_NAME}'
                value: '{$GITHUB.COPILOT.LANG.NAME.MATCHES}'
              - macro: '{#LANG_NAME}'
                value: '{$GITHUB.COPILOT.LANG.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'The discovery of Copilot IDE code completion languages.'
          item_prototypes:
            - uuid: 7542e8d51e6346d790ae5fc82ff6ac3f
              name: 'Language [{#LANG_NAME}]: Engaged users'
              type: DEPENDENT
              key: 'github.org.copilot_ide_lang.engaged_users[{#LANG_NAME}]'
              description: 'The number of engaged users working with code in `{#LANG_NAME}`.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_ide_code_completions.languages[?(@.name == ''{#LANG_NAME}'')].total_engaged_users.first()'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: component
                  value: ide
                - tag: language
                  value: '{#LANG_NAME}'
          master_item:
            key: github.org.copilot.data_get
          lld_macro_paths:
            - lld_macro: '{#LANG_NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.copilot_ide_code_completions.languages
              error_handler: DISCARD_VALUE
        - uuid: bb6fd5b269cd4943a4d76ec3806c0cc2
          name: 'IDE [{#IDE_NAME}]: Model discovery'
          type: DEPENDENT
          key: 'github.org.copilot_ide_model.discovery[{#IDE_NAME}]'
          filter:
            evaltype: AND
            conditions:
              - macro: '{#MODEL_NAME}'
                value: '{$GITHUB.COPILOT.MODEL.NAME.MATCHES}'
              - macro: '{#MODEL_NAME}'
                value: '{$GITHUB.COPILOT.MODEL.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'The discovery of models used in the `{#IDE_NAME}` Copilot chat.'
          item_prototypes:
            - uuid: f78fda8346ff4dbb8e777d87b570fad3
              name: 'IDE [{#IDE_NAME}/{#MODEL_NAME}]: Chat copy events'
              type: DEPENDENT
              key: 'github.org.copilot_ide_model.chat_copy_events[{#IDE_NAME},{#MODEL_NAME}]'
              description: 'The number of Copilot chat copy events caused by the `{#MODEL_NAME}` model in `{#IDE_NAME}`.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_ide_chat.editors[?(@.name == ''{#IDE_NAME}'')].models[?(@.name == ''{#MODEL_NAME}'')].total_chat_copy_events.first()'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: component
                  value: ide
                - tag: ide
                  value: '{#IDE_NAME}'
                - tag: model
                  value: '{#MODEL_NAME}'
            - uuid: 836f8aec7f9f4c4ea522b75050c5a477
              name: 'IDE [{#IDE_NAME}/{#MODEL_NAME}]: Chat insertion events'
              type: DEPENDENT
              key: 'github.org.copilot_ide_model.chat_insertion_events[{#IDE_NAME},{#MODEL_NAME}]'
              description: 'The number of Copilot chat insertion events caused by the `{#MODEL_NAME}` model in `{#IDE_NAME}`.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_ide_chat.editors[?(@.name == ''{#IDE_NAME}'')].models[?(@.name == ''{#MODEL_NAME}'')].total_chat_insertion_events.first()'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: ide
                  value: '{#IDE_NAME}'
                - tag: model
                  value: '{#MODEL_NAME}'
            - uuid: 41275d39931b4474b8d846574e10cad2
              name: 'IDE [{#IDE_NAME}/{#MODEL_NAME}]: Engaged users'
              type: DEPENDENT
              key: 'github.org.copilot_ide_model.engaged_users[{#IDE_NAME},{#MODEL_NAME}]'
              description: 'The number of engaged users using the Copilot `{#MODEL_NAME}` model in `{#IDE_NAME}`.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_ide_chat.editors[?(@.name == ''{#IDE_NAME}'')].models[?(@.name == ''{#MODEL_NAME}'')].total_engaged_users.first()'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: component
                  value: ide
                - tag: ide
                  value: '{#IDE_NAME}'
                - tag: model
                  value: '{#MODEL_NAME}'
            - uuid: 22fe53f010e04010b3279c4335546282
              name: 'IDE [{#IDE_NAME}/{#MODEL_NAME}]: Total chats'
              type: DEPENDENT
              key: 'github.org.copilot_ide_model.total_chats[{#IDE_NAME},{#MODEL_NAME}]'
              description: 'The number of Copilot chats with the `{#MODEL_NAME}` model in `{#IDE_NAME}`.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_ide_chat.editors[?(@.name == ''{#IDE_NAME}'')].models[?(@.name == ''{#MODEL_NAME}'')].total_chats.first()'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: ide
                  value: '{#IDE_NAME}'
                - tag: model
                  value: '{#MODEL_NAME}'
          graph_prototypes:
            - uuid: b3ec6982c2a841e0a57b18f4825a087d
              name: 'IDE [{#IDE_NAME}/{#MODEL_NAME}]: Chat events'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'GitHub organization by HTTP'
                    key: 'github.org.copilot_ide_model.chat_copy_events[{#IDE_NAME},{#MODEL_NAME}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'GitHub organization by HTTP'
                    key: 'github.org.copilot_ide_model.chat_insertion_events[{#IDE_NAME},{#MODEL_NAME}]'
            - uuid: b92878c57c4747a894dd670fddb8f935
              name: 'IDE [{#IDE_NAME}/{#MODEL_NAME}]: Total chats'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'GitHub organization by HTTP'
                    key: 'github.org.copilot_ide_model.total_chats[{#IDE_NAME},{#MODEL_NAME}]'
          parent_discovery_rule:
            key: github.org.copilot_ide_chat.discovery
          master_item:
            key: github.org.copilot.data_get
          lld_macro_paths:
            - lld_macro: '{#CUSTOM_FLAG}'
              path: $.is_custom_model
            - lld_macro: '{#MODEL_NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.copilot_ide_chat.editors[?(@.name == ''{#IDE_NAME}'')].models.first()'
              error_handler: DISCARD_VALUE
        - uuid: a670dff6564749ef9587f74ee51306ef
          name: 'Repo [{#REPO_NAME}]: Model discovery'
          type: DEPENDENT
          key: 'github.org.copilot_pr_model.discovery[{#REPO_NAME}]'
          filter:
            evaltype: AND
            conditions:
              - macro: '{#MODEL_NAME}'
                value: '{$GITHUB.COPILOT.MODEL.NAME.MATCHES}'
              - macro: '{#MODEL_NAME}'
                value: '{$GITHUB.COPILOT.MODEL.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'The discovery of models used for work with PRs.'
          item_prototypes:
            - uuid: aaafd6b0a5cb4e40b78fa7ea8ddccaeb
              name: '{#REPO_NAME} [{#MODEL_NAME}]: Engaged users'
              type: DEPENDENT
              key: 'github.org.copilot_pr_model.engaged_users[{#REPO_NAME},{#MODEL_NAME}]'
              description: 'The number of engaged users using the Copilot `{#MODEL_NAME}` model for work with PRs.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_dotcom_pull_requests.repositories[?(@.name == ''{#REPO_NAME}'')].models[?(@.name == ''{#MODEL_NAME}'')].total_engaged_users.first()'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: component
                  value: pull-requests
                - tag: model
                  value: '{#MODEL_NAME}'
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: 5f4e0692600140908b3dc7383ab3c2b1
              name: '{#REPO_NAME} [{#MODEL_NAME}]: PR summaries created'
              type: DEPENDENT
              key: 'github.org.copilot_pr_model.summaries_created[{#REPO_NAME},{#MODEL_NAME}]'
              description: 'The number of PR summaries created by the Copilot `{#MODEL_NAME}` model.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_dotcom_pull_requests.repositories[?(@.name == ''{#REPO_NAME}'')].models[?(@.name == ''{#MODEL_NAME}'')].total_pr_summaries_created.first()'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: component
                  value: pull-requests
                - tag: model
                  value: '{#MODEL_NAME}'
                - tag: repository
                  value: '{#REPO_NAME}'
          parent_discovery_rule:
            key: github.org.copilot_pull_request.discovery
          master_item:
            key: github.org.copilot.data_get
          lld_macro_paths:
            - lld_macro: '{#CUSTOM_FLAG}'
              path: $.is_custom_model
            - lld_macro: '{#MODEL_NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.copilot_dotcom_pull_requests.repositories[?(@.name == ''{#REPO_NAME}'')].models.first()'
              error_handler: DISCARD_VALUE
        - uuid: e0e6134cdeab4e3b9a76e1c2a2c05f13
          name: 'Copilot.com PR discovery'
          type: DEPENDENT
          key: github.org.copilot_pull_request.discovery
          description: 'The discovery of pull requests on copilot.com.'
          item_prototypes:
            - uuid: a83115163f534e93b78de162e928daa6
              name: 'Repo [{#REPO_NAME}]: Engaged users'
              type: DEPENDENT
              key: 'github.org.copilot_pull_request.engaged_users[{#REPO_NAME}]'
              description: 'The number of engaged users working with PRs on copilot.com.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_dotcom_pull_requests.repositories[?(@.name == ''{#REPO_NAME}'')].total_engaged_users.first()'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: component
                  value: pull-requests
                - tag: repository
                  value: '{#REPO_NAME}'
          master_item:
            key: github.org.copilot.data_get
          lld_macro_paths:
            - lld_macro: '{#REPO_NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.copilot_dotcom_pull_requests.repositories
              error_handler: DISCARD_VALUE
        - uuid: e0e0c5d3e70641638a02cfc267338d5e
          name: 'Copilot.com chat model discovery'
          type: DEPENDENT
          key: github.org.copilot_web_chat.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#MODEL_NAME}'
                value: '{$GITHUB.COPILOT.MODEL.NAME.MATCHES}'
              - macro: '{#MODEL_NAME}'
                value: '{$GITHUB.COPILOT.MODEL.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'The discovery of chats on copilot.com.'
          item_prototypes:
            - uuid: 656bf264169c4371b1bc3264c3bbe4b8
              name: 'Copilot.com [{#MODEL_NAME}]: Engaged users'
              type: DEPENDENT
              key: 'github.org.copilot_web_model.engaged_users[{#MODEL_NAME}]'
              description: 'The number of engaged users using the `{#MODEL_NAME}` model on copilot.com.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_dotcom_chat.models[?(@.name == ''{#MODEL_NAME}'')].total_engaged_users.first()'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: model
                  value: '{#MODEL_NAME}'
            - uuid: 2a00540173ae4f05948a83817fc0aa5d
              name: 'Copilot.com [{#MODEL_NAME}]: Total chats'
              type: DEPENDENT
              key: 'github.org.copilot_web_model.total_chats[{#MODEL_NAME}]'
              description: 'The number of chats with the `{#MODEL_NAME}` model on copilot.com.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.copilot_dotcom_chat.models[?(@.name == ''{#MODEL_NAME}'')].total_chats.first()'
              master_item:
                key: github.org.copilot.data_get
              tags:
                - tag: component
                  value: copilot
                - tag: model
                  value: '{#MODEL_NAME}'
          graph_prototypes:
            - uuid: f0c9a1ddc68e49508560e4baa97da014
              name: 'Copilot.com [{#MODEL_NAME}]: Total chats'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'GitHub organization by HTTP'
                    key: 'github.org.copilot_web_model.total_chats[{#MODEL_NAME}]'
          master_item:
            key: github.org.copilot.data_get
          lld_macro_paths:
            - lld_macro: '{#CUSTOM_FLAG}'
              path: $.is_custom_model
            - lld_macro: '{#MODEL_NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.copilot_dotcom_chat.models
              error_handler: DISCARD_VALUE
        - uuid: b34506be8c8f4ada82e2a5a7cba7ff5a
          name: 'Repository discovery'
          type: DEPENDENT
          key: github.org.repo.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#REPO_DISABLED}'
                value: ^false$
              - macro: '{#REPO_NAME}'
                value: '{$GITHUB.REPO.NAME.MATCHES}'
              - macro: '{#REPO_NAME}'
                value: '{$GITHUB.REPO.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#REPO_OWNER}'
                value: '{$GITHUB.REPO.OWNER.MATCHES}'
              - macro: '{#REPO_OWNER}'
                value: '{$GITHUB.REPO.OWNER.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'The discovery of repositories.'
          item_prototypes:
            - uuid: d152f9bd8ac64b969fa7b0c2f44068ae
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Advanced Security'
              type: DEPENDENT
              key: 'github.org.repo.advanced_security[{#NODE_ID}]'
              trends: '0'
              description: 'Whether GitHub Advanced Security for the repository is enabled. For standalone Code Scanning or Secret Protection products, this value cannot be collected.'
              valuemap:
                name: 'Flag value'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.security_and_analysis.advanced_security.status
                  error_handler: CUSTOM_VALUE
                  error_handler_params: disabled
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const idx = [
                      	'disabled',
                      	'enabled'
                      ].indexOf(value);
                      return idx !== -1 ? idx : 2;
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: 46c9c4f0c88b49c3bb23f7c1bd345353
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Is archived'
              type: DEPENDENT
              key: 'github.org.repo.archived[{#NODE_ID}]'
              trends: '0'
              description: 'Whether the repository is archived.'
              valuemap:
                name: 'Flag value'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.archived
                  error_handler: DISCARD_VALUE
                - type: BOOL_TO_DECIMAL
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: 48e6b9c037f94d94a8c5ef16d6791424
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Created at'
              type: DEPENDENT
              key: 'github.org.repo.created_at[{#NODE_ID}]'
              trends: '0'
              units: unixtime
              description: 'The time when the repository was created.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.created_at
                - type: JAVASCRIPT
                  parameters:
                    - 'return Math.floor(new Date(value) / 1000);'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: c86211ab4cb4459998104e701d1c94be
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Fork count'
              type: DEPENDENT
              key: 'github.org.repo.forks_count[{#NODE_ID}]'
              description: 'The number of repository forks.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.forks_count
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: 40547c64c6e54058994daabcaae5df7f
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Get data'
              type: DEPENDENT
              key: 'github.org.repo.get_data[{#NODE_ID}]'
              history: '0'
              value_type: TEXT
              description: 'Get `{$GITHUB.REPO.NAME}` repository data.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.data[?(@.node_id == ''{#NODE_ID}'')].first()'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '{}'
              master_item:
                key: github.org.repo.get
              tags:
                - tag: component
                  value: raw
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: 3ac50c2cfd8a44aea228aafffb63bcbb
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Is a fork'
              type: DEPENDENT
              key: 'github.org.repo.is_fork[{#NODE_ID}]'
              trends: '0'
              description: 'Whether the repository is a fork.'
              valuemap:
                name: 'Flag value'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.fork
                  error_handler: DISCARD_VALUE
                - type: BOOL_TO_DECIMAL
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: 193095d5318b460792560449bcdc17df
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Is private'
              type: DEPENDENT
              key: 'github.org.repo.is_private[{#NODE_ID}]'
              trends: '0'
              description: 'Whether the repository is private.'
              valuemap:
                name: 'Flag value'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.private
                  error_handler: DISCARD_VALUE
                - type: BOOL_TO_DECIMAL
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: faf0aa76035c4528a0c57e91086cda8d
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Is a template'
              type: DEPENDENT
              key: 'github.org.repo.is_template[{#NODE_ID}]'
              trends: '0'
              description: 'Whether the repository is a template.'
              valuemap:
                name: 'Flag value'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.is_template
                  error_handler: DISCARD_VALUE
                - type: BOOL_TO_DECIMAL
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: ea721c9204d140dbb2870914f31c0087
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Language'
              type: DEPENDENT
              key: 'github.org.repo.language[{#NODE_ID}]'
              value_type: CHAR
              description: 'The language of the repository.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.language
                  error_handler: DISCARD_VALUE
                - type: NOT_MATCHES_REGEX
                  parameters:
                    - ^null$
                  error_handler: DISCARD_VALUE
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: a64c94b832b94a90a97df7b32237726e
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Open issue count'
              type: DEPENDENT
              key: 'github.org.repo.open_issues[{#NODE_ID}]'
              description: 'The number of issues opened in the repository.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.open_issues_count
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: d7ddd79bf2bc41f68f442692e6866354
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Pushed at'
              type: DEPENDENT
              key: 'github.org.repo.pushed_at[{#NODE_ID}]'
              trends: '0'
              units: unixtime
              description: 'The time when the repository was pushed.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.pushed_at
                - type: JAVASCRIPT
                  parameters:
                    - 'return Math.floor(new Date(value) / 1000);'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: 6d60c774dd3e44a183b82cb3326fea00
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Secret Scanning AI Detection'
              type: DEPENDENT
              key: 'github.org.repo.secret_ai_detection[{#NODE_ID}]'
              trends: '0'
              description: 'Whether GitHub Secret Scanning AI Detection for the repository is enabled.'
              valuemap:
                name: 'Flag value'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.security_and_analysis.secret_scanning_ai_detection.status
                  error_handler: CUSTOM_VALUE
                  error_handler_params: disabled
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const idx = [
                      	'disabled',
                      	'enabled'
                      ].indexOf(value);
                      return idx !== -1 ? idx : 2;
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: 166aff204a83422da25e22987f7109ad
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Secret Protection'
              type: DEPENDENT
              key: 'github.org.repo.secret_protection[{#NODE_ID}]'
              trends: '0'
              description: 'Whether GitHub Secret Protection for the repository is enabled.'
              valuemap:
                name: 'Flag value'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.security_and_analysis.secret_scanning_push_protection.status
                  error_handler: CUSTOM_VALUE
                  error_handler_params: disabled
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const idx = [
                      	'disabled',
                      	'enabled'
                      ].indexOf(value);
                      return idx !== -1 ? idx : 2;
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: ac68188a36214e1f8dd0e9edfbd00b2e
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Secret Scanning'
              type: DEPENDENT
              key: 'github.org.repo.secret_scanning[{#NODE_ID}]'
              trends: '0'
              description: 'Whether GitHub Secret Scanning for the repository is enabled.'
              valuemap:
                name: 'Flag value'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.security_and_analysis.secret_scanning.status
                  error_handler: CUSTOM_VALUE
                  error_handler_params: disabled
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const idx = [
                      	'disabled',
                      	'enabled'
                      ].indexOf(value);
                      return idx !== -1 ? idx : 2;
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: 1b9cd8857b05443a86d5717a8866ce35
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Secret Scanning non-provider patterns'
              type: DEPENDENT
              key: 'github.org.repo.secret_scanning_non_provider_patterns[{#NODE_ID}]'
              trends: '0'
              description: 'Whether GitHub Secret Scanning non-provider patterns for the repository are enabled.'
              valuemap:
                name: 'Flag value'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.security_and_analysis.secret_scanning_non_provider_patterns.status
                  error_handler: CUSTOM_VALUE
                  error_handler_params: disabled
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const idx = [
                      	'disabled',
                      	'enabled'
                      ].indexOf(value);
                      return idx !== -1 ? idx : 2;
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: 7ca258ed39b648aa840472f53cfee720
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Secret Scanning Validity Checks'
              type: DEPENDENT
              key: 'github.org.repo.secret_scanning_validity_checks[{#NODE_ID}]'
              trends: '0'
              description: 'Whether GitHub Secret Scanning validity checks for the repository are enabled.'
              valuemap:
                name: 'Flag value'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.security_and_analysis.secret_scanning_validity_checks.status
                  error_handler: CUSTOM_VALUE
                  error_handler_params: disabled
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const idx = [
                      	'disabled',
                      	'enabled'
                      ].indexOf(value);
                      return idx !== -1 ? idx : 2;
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: 36fb00ed003a4c2da3d49ff33181de55
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Size'
              type: DEPENDENT
              key: 'github.org.repo.size[{#NODE_ID}]'
              units: B
              description: 'The size of the repository, in kilobytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.size
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
                - type: MULTIPLIER
                  parameters:
                    - '1024'
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: cafac4f8a018493196a6e436c90dd3bd
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Stargazer count'
              type: DEPENDENT
              key: 'github.org.repo.stargazers_count[{#NODE_ID}]'
              description: 'The number of stargazers in the repository.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.stargazers_count
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: 4572951f5b154039881102162772a6c4
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Updated at'
              type: DEPENDENT
              key: 'github.org.repo.updated_at[{#NODE_ID}]'
              trends: '0'
              units: unixtime
              description: 'The time when the repository was updated.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.updated_at
                - type: JAVASCRIPT
                  parameters:
                    - 'return Math.floor(new Date(value) / 1000);'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: b9faee5c840e4529989fc60792a2b09d
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Visibility'
              type: DEPENDENT
              key: 'github.org.repo.visibility[{#NODE_ID}]'
              trends: '0'
              description: 'Visibility type of the repository.'
              valuemap:
                name: 'Visibility type'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.visibility
                  error_handler: DISCARD_VALUE
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const idx = [
                      	'private',
                      	'public',
                      	'internal'
                      ].indexOf(value);
                      return idx !== -1 ? idx : 3;
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
            - uuid: e976ecd4cda247b3a7ea45e989101c07
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Watcher count'
              type: DEPENDENT
              key: 'github.org.repo.watchers_count[{#NODE_ID}]'
              description: 'The number of watchers in the repository.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.watchers_count
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'github.org.repo.get_data[{#NODE_ID}]'
              tags:
                - tag: component
                  value: repository
                - tag: repository
                  value: '{#REPO_NAME}'
          graph_prototypes:
            - uuid: 76f79d4ed592459fb863a1ca4857610a
              name: '[{#REPO_OWNER}/{#REPO_NAME}]: Repository size'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'GitHub organization by HTTP'
                    key: 'github.org.repo.size[{#NODE_ID}]'
          host_prototypes:
            - uuid: 70a6212ea45f4bb0abce485eaf7ac643
              host: 'repo_{#ID}'
              name: '{#REPO_OWNER}/{#REPO_NAME}'
              inventory_mode: AUTOMATIC
              group_links:
                - group:
                    name: Applications
              group_prototypes:
                - name: 'GitHub/{#REPO_OWNER}'
              templates:
                - name: 'GitHub repository by HTTP'
              macros:
                - macro: '{$GITHUB.REPO.NAME}'
                  value: '{#REPO_NAME}'
                  description: 'Set the repository name here.'
                - macro: '{$GITHUB.REPO.OWNER}'
                  value: '{#REPO_OWNER}'
                  description: 'Set the repository owner here.'
              tags:
                - tag: owner
                  value: '{#REPO_OWNER}'
          master_item:
            key: github.org.repo.get
          lld_macro_paths:
            - lld_macro: '{#ID}'
              path: $.id
            - lld_macro: '{#NODE_ID}'
              path: $.node_id
            - lld_macro: '{#REPO_DESCR}'
              path: $.description
            - lld_macro: '{#REPO_DISABLED}'
              path: $.disabled
            - lld_macro: '{#REPO_NAME}'
              path: $.name
            - lld_macro: '{#REPO_OWNER}'
              path: $.owner.login
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data
              error_handler: DISCARD_VALUE
      tags:
        - tag: class
          value: software
        - tag: subclass
          value: communication
        - tag: subclass
          value: development
        - tag: target
          value: github
        - tag: target
          value: organization
      macros:
        - macro: '{$GITHUB.API.TOKEN}'
          type: SECRET_TEXT
          description: 'Set the access token here.'
          config:
            type: TEXT
            priority: '6'
            label: 'Access token'
            description: 'Set the access token here.'
            required: 'YES'
        - macro: '{$GITHUB.API.URL}'
          value: 'https://api.github.com/'
          description: 'Set the API URL here.'
          config:
            type: TEXT
            priority: '1'
            label: 'API URL'
            description: 'Set the API URL here.'
            required: 'YES'
        - macro: '{$GITHUB.API_VERSION}'
          value: '2022-11-28'
          description: 'The API version that is used in headers for HTTP requests.'
          config:
            type: TEXT
            priority: '3'
            label: 'API version'
            description: 'The API version that is used in headers for HTTP requests.'
        - macro: '{$GITHUB.COPILOT.IDE.NAME.MATCHES}'
          value: .+
          description: 'The Copilot IDE name regex filter to use in Copilot-related metric discovery - for including.'
          config:
            type: TEXT
            priority: '18'
            section_name: Filters
            label: 'Copilot IDE name filter (include)'
            description: 'The Copilot IDE name regex filter to use in Copilot-related metric discovery - for including.'
        - macro: '{$GITHUB.COPILOT.IDE.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'The Copilot IDE name regex filter to use in Copilot-related metric discovery - for excluding.'
          config:
            type: TEXT
            priority: '19'
            section_name: Filters
            label: 'Copilot IDE name filter (exclude)'
            description: 'The Copilot IDE name regex filter to use in Copilot-related metric discovery - for excluding.'
        - macro: '{$GITHUB.COPILOT.LANG.NAME.MATCHES}'
          value: .+
          description: 'The Copilot programming language name regex filter to use in Copilot-related metric discovery - for including.'
          config:
            type: TEXT
            priority: '22'
            section_name: Filters
            label: 'Copilot language filter (include)'
            description: 'The Copilot programming language name regex filter to use in Copilot-related metric discovery - for including.'
        - macro: '{$GITHUB.COPILOT.LANG.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'The Copilot programming language name regex filter to use in Copilot-related metric discovery - for excluding.'
          config:
            type: TEXT
            priority: '23'
            section_name: Filters
            label: 'Copilot language filter (exclude)'
            description: 'The Copilot programming language name regex filter to use in Copilot-related metric discovery - for excluding.'
        - macro: '{$GITHUB.COPILOT.MODEL.NAME.MATCHES}'
          value: .+
          description: 'The Copilot model name regex filter to use in Copilot-related metric discovery - for including.'
          config:
            type: TEXT
            priority: '20'
            section_name: Filters
            label: 'Copilot model name filter (include)'
            description: 'The Copilot model name regex filter to use in Copilot-related metric discovery - for including.'
        - macro: '{$GITHUB.COPILOT.MODEL.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'The Copilot model name regex filter to use in Copilot-related metric discovery - for excluding.'
          config:
            type: TEXT
            priority: '21'
            section_name: Filters
            label: 'Copilot model name filter (exclude)'
            description: 'The Copilot model name regex filter to use in Copilot-related metric discovery - for excluding.'
        - macro: '{$GITHUB.COPILOT.USED}'
          value: '0'
          description: 'The flag for gathering Copilot metrics. If set to a value other than "1", items for Copilot will not be created. If set to "1", the `{$GITHUB.ORG.NAME}` macro is required.'
          config:
            type: CHECKBOX
            priority: '4'
            label: 'Copilot monitoring'
            description: 'Whether it is necessary to gather Copilot metrics.'
            options:
              - checked: '1'
                unchecked: '0'
        - macro: '{$GITHUB.HTTP_PROXY}'
          description: 'The HTTP proxy for script items (set if needed). If the macro is empty, then no proxy is used.'
          config:
            type: TEXT
            priority: '12'
            section_name: Other
            label: 'HTTP proxy'
            description: 'The HTTP proxy for script items (set if needed). If the macro is empty, then no proxy is used.'
        - macro: '{$GITHUB.INTERVAL}'
          value: 1m
          description: 'The update interval for the script items that retrieve data from the API. Can be used with context if needed (check the context values in relevant items).'
          config:
            type: TEXT
            priority: '7'
            section_name: Other
            label: 'Data update interval'
            description: 'The update interval for the script items that retrieve data from the API. Can be used with context if needed (check the context values in relevant items).'
        - macro: '{$GITHUB.INTERVAL:"get_copilot_billing"}'
          value: 1h
          description: 'The update interval for the script item that retrieves Copilot billing.'
          config:
            type: TEXT
            priority: '10'
            section_name: Other
            label: 'Copilot billing update interval'
            description: 'The update interval for the script item that retrieves Copilot billing.'
        - macro: '{$GITHUB.INTERVAL:"get_copilot_data"}'
          value: 1h
          description: 'The update interval for the script item that retrieves Copilot statistics.'
          config:
            type: TEXT
            priority: '9'
            section_name: Other
            label: 'Copilot statistics update interval'
            description: 'The update interval for the script item that retrieves Copilot statistics.'
        - macro: '{$GITHUB.INTERVAL:"get_repo_list"}'
          value: 15m
          description: 'The update interval for the script item that retrieves a list of repositories.'
          config:
            type: TEXT
            priority: '8'
            section_name: Other
            label: 'Repository list update interval'
            description: 'The update interval for the script item that retrieves a list of repositories.'
        - macro: '{$GITHUB.ORG.NAME}'
          description: 'Set the organization name here.'
          config:
            type: TEXT
            priority: '5'
            label: 'Organization name'
            description: 'Set the organization name here, if "Copilot monitoring" is set to "1".'
            required: 'YES'
        - macro: '{$GITHUB.REPO.NAME.MATCHES}'
          value: .+
          description: 'The repository name regex filter to use in repository discovery - for including.'
          config:
            type: TEXT
            priority: '14'
            section_name: Filters
            label: 'Repository name filter (include)'
            description: 'The repository name regex filter to use in repository discovery - for including.'
        - macro: '{$GITHUB.REPO.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'The repository name regex filter to use in repository discovery - for excluding.'
          config:
            type: TEXT
            priority: '15'
            section_name: Filters
            label: 'Repository name filter (exclude)'
            description: 'The repository name regex filter to use in repository discovery - for excluding.'
        - macro: '{$GITHUB.REPO.OWNER.MATCHES}'
          value: .+
          description: 'The repository owner regex filter to use in repository discovery - for including.'
          config:
            type: TEXT
            priority: '16'
            section_name: Filters
            label: 'Repository owner filter (include)'
            description: 'The repository owner regex filter to use in repository discovery - for including.'
        - macro: '{$GITHUB.REPO.OWNER.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'The repository owner regex filter to use in repository discovery - for excluding.'
          config:
            type: TEXT
            priority: '17'
            section_name: Filters
            label: 'Repository owner filter (exclude)'
            description: 'The repository owner regex filter to use in repository discovery - for excluding.'
        - macro: '{$GITHUB.RESULTS_PER_PAGE}'
          value: '100'
          description: 'The number of results to fetch per page. Can be used with context and adjusted if needed (check the context values in script parameters of relevant items).'
          config:
            type: TEXT
            priority: '13'
            section_name: Other
            label: 'Results per page'
            description: 'The number of results to fetch per page. Can be used with context and adjusted if needed (check the context values in script parameters of relevant items).'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$GITHUB.TIMEOUT}'
          value: 15s
          description: 'The timeout threshold for the script items that retrieve data from the API. Can be used with context if needed (check the context values in relevant items).'
          config:
            type: TEXT
            priority: '11'
            section_name: Other
            label: 'API timeout'
            description: 'The timeout threshold for the script items that retrieve data from the API. Can be used with context if needed (check the context values in relevant items).'
        - macro: '{$GITHUB.USER_AGENT}'
          value: Zabbix/8.0
          description: 'The user agent that is used in headers for HTTP requests.'
          config:
            type: TEXT
            priority: '2'
            label: 'HTTP user agent'
            description: 'The user agent that is used in headers for HTTP requests.'
      dashboards:
        - uuid: 0f686bf03ab54b5996f66483a831a3ac
          name: '1. Overview'
          pages:
            - name: Main
              widgets:
                - type: item
                  name: 'Number of repositories'
                  width: '12'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub organization by HTTP'
                        key: github.org.repo.number
                    - type: INTEGER
                      name: show.0
                      value: '2'
                - type: honeycomb
                  name: 'Repository language'
                  'y': '2'
                  width: '36'
                  height: '7'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00C48C
                    - type: STRING
                      name: items.0
                      value: '[*/*]: Language'
                    - type: INTEGER
                      name: item_tags.0.operator
                      value: '1'
                    - type: STRING
                      name: item_tags.0.tag
                      value: component
                    - type: STRING
                      name: item_tags.0.value
                      value: repository
                    - type: STRING
                      name: primary_label
                      value: '{{ITEM.NAME}.regsub("\[(.*?)\/(.*?)\]", "\2")}'
                    - type: INTEGER
                      name: primary_label_size_type
                      value: '1'
                    - type: STRING
                      name: reference
                      value: AAAAA
                    - type: INTEGER
                      name: secondary_label_decimal_places
                      value: '0'
                    - type: INTEGER
                      name: secondary_label_size_type
                      value: '1'
                - type: problems
                  name: Problems
                  'y': '9'
                  width: '72'
                  height: '6'
                - type: item
                  name: 'Total size of repositories'
                  x: '12'
                  width: '12'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub organization by HTTP'
                        key: github.org.repo.total_size
                    - type: INTEGER
                      name: show.0
                      value: '2'
                - type: item
                  name: 'Number of private repositories'
                  x: '24'
                  width: '12'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub organization by HTTP'
                        key: github.org.repo.number_private
                    - type: INTEGER
                      name: show.0
                      value: '2'
                - type: item
                  name: 'Number of archived repositories'
                  x: '36'
                  width: '12'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub organization by HTTP'
                        key: github.org.repo.number_archived
                    - type: INTEGER
                      name: show.0
                      value: '2'
                - type: honeycomb
                  name: 'Repository size'
                  x: '36'
                  'y': '2'
                  width: '36'
                  height: '7'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FFBF59
                    - type: STRING
                      name: items.0
                      value: '[*/*]: Size'
                    - type: INTEGER
                      name: item_tags.0.operator
                      value: '1'
                    - type: STRING
                      name: item_tags.0.tag
                      value: component
                    - type: STRING
                      name: item_tags.0.value
                      value: repository
                    - type: STRING
                      name: primary_label
                      value: '{{ITEM.NAME}.regsub("\[(.*?)\/(.*?)\]", "\2")}'
                    - type: INTEGER
                      name: primary_label_size_type
                      value: '1'
                    - type: STRING
                      name: reference
                      value: AAAAB
                    - type: INTEGER
                      name: secondary_label_decimal_places
                      value: '0'
                    - type: INTEGER
                      name: secondary_label_size
                      value: '40'
                    - type: INTEGER
                      name: secondary_label_size_type
                      value: '1'
                - type: item
                  name: 'Number of disabled repositories'
                  x: '48'
                  width: '12'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub organization by HTTP'
                        key: github.org.repo.number_disabled
                    - type: INTEGER
                      name: show.0
                      value: '2'
                - type: item
                  name: 'Number of repository templates'
                  x: '60'
                  width: '12'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub organization by HTTP'
                        key: github.org.repo.number_templates
                    - type: INTEGER
                      name: show.0
                      value: '2'
        - uuid: f616b8c2930545759ac3e3aec1eeb6f1
          name: '2. Copilot'
          pages:
            - name: Main
              widgets:
                - type: item
                  name: 'Active users'
                  width: '12'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub organization by HTTP'
                        key: github.org.copilot.active_users
                    - type: INTEGER
                      name: show.0
                      value: '2'
                - type: honeycomb
                  name: 'Copilot users per language'
                  'y': '2'
                  width: '36'
                  height: '5'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 97AAB3
                    - type: STRING
                      name: items.0
                      value: 'Language [*]: Engaged users'
                    - type: INTEGER
                      name: item_tags.0.operator
                      value: '1'
                    - type: STRING
                      name: item_tags.0.tag
                      value: component
                    - type: STRING
                      name: item_tags.0.value
                      value: ide
                    - type: STRING
                      name: primary_label
                      value: '{{ITEM.NAME}.regsub("\[(.*?)\]", "\1")}'
                    - type: INTEGER
                      name: primary_label_size
                      value: '30'
                    - type: INTEGER
                      name: primary_label_size_type
                      value: '1'
                    - type: STRING
                      name: reference
                      value: AAAAC
                    - type: INTEGER
                      name: secondary_label_decimal_places
                      value: '0'
                    - type: INTEGER
                      name: secondary_label_size
                      value: '50'
                    - type: INTEGER
                      name: secondary_label_size_type
                      value: '1'
                - type: honeycomb
                  name: 'Copilot users per IDE & model'
                  'y': '7'
                  width: '36'
                  height: '5'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00C48C
                    - type: STRING
                      name: items.0
                      value: 'IDE [*/*]: Engaged users'
                    - type: INTEGER
                      name: item_tags.0.operator
                      value: '1'
                    - type: STRING
                      name: item_tags.0.tag
                      value: component
                    - type: STRING
                      name: item_tags.0.value
                      value: ide
                    - type: STRING
                      name: primary_label
                      value: '{{ITEM.NAME}.regsub("\[(.*?)\/(.*?)\]", "\1 / \2")}'
                    - type: INTEGER
                      name: primary_label_size
                      value: '15'
                    - type: INTEGER
                      name: primary_label_size_type
                      value: '1'
                    - type: STRING
                      name: reference
                      value: AAAAE
                    - type: INTEGER
                      name: secondary_label_decimal_places
                      value: '0'
                    - type: INTEGER
                      name: secondary_label_size
                      value: '50'
                    - type: INTEGER
                      name: secondary_label_size_type
                      value: '1'
                - type: honeycomb
                  name: 'Copilot.com chats per model'
                  'y': '12'
                  width: '36'
                  height: '5'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FFA059
                    - type: STRING
                      name: items.0
                      value: 'Copilot.com [*]: Total chats'
                    - type: INTEGER
                      name: item_tags.0.operator
                      value: '1'
                    - type: STRING
                      name: item_tags.0.tag
                      value: component
                    - type: STRING
                      name: item_tags.0.value
                      value: copilot
                    - type: STRING
                      name: primary_label
                      value: '{{ITEM.NAME}.regsub("\[(.*?)\]", "\1")}'
                    - type: INTEGER
                      name: primary_label_size_type
                      value: '1'
                    - type: STRING
                      name: reference
                      value: AAAAG
                    - type: INTEGER
                      name: secondary_label_decimal_places
                      value: '0'
                    - type: INTEGER
                      name: secondary_label_size
                      value: '50'
                    - type: INTEGER
                      name: secondary_label_size_type
                      value: '1'
                - type: honeycomb
                  name: 'Acceptance rate per IDE & model & language'
                  'y': '17'
                  width: '36'
                  height: '5'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 64B5F6
                    - type: STRING
                      name: items.0
                      value: '* [*/*]: Acceptance rate'
                    - type: INTEGER
                      name: item_tags.0.operator
                      value: '1'
                    - type: STRING
                      name: item_tags.0.tag
                      value: component
                    - type: STRING
                      name: item_tags.0.value
                      value: ide
                    - type: INTEGER
                      name: item_tags.1.operator
                      value: '4'
                    - type: STRING
                      name: item_tags.1.tag
                      value: language
                    - type: STRING
                      name: item_tags.1.value
                      value: ''
                    - type: STRING
                      name: primary_label
                      value: '{{ITEM.NAME}.regsub("^(.*?) \[(.*?)\/(.*?)\]", "\1 / \2 / \3")}'
                    - type: INTEGER
                      name: primary_label_size
                      value: '15'
                    - type: INTEGER
                      name: primary_label_size_type
                      value: '1'
                    - type: STRING
                      name: reference
                      value: AAAAI
                    - type: INTEGER
                      name: secondary_label_size
                      value: '40'
                    - type: INTEGER
                      name: secondary_label_size_type
                      value: '1'
                - type: item
                  name: 'Engaged users'
                  x: '12'
                  width: '12'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub organization by HTTP'
                        key: github.org.copilot.engaged_users
                    - type: INTEGER
                      name: show.0
                      value: '2'
                - type: item
                  name: 'Seats total'
                  x: '24'
                  width: '12'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub organization by HTTP'
                        key: github.org.copilot.seats_total
                    - type: INTEGER
                      name: show.0
                      value: '2'
                - type: item
                  name: 'Seats active this cycle'
                  x: '36'
                  width: '12'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub organization by HTTP'
                        key: github.org.copilot.seats_active_this_cycle
                    - type: INTEGER
                      name: show.0
                      value: '2'
                - type: honeycomb
                  name: 'Copilot users per IDE'
                  x: '36'
                  'y': '2'
                  width: '36'
                  height: '5'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 7499FF
                    - type: STRING
                      name: items.0
                      value: 'IDE [*]: Engaged users'
                    - type: INTEGER
                      name: item_tags.0.operator
                      value: '1'
                    - type: STRING
                      name: item_tags.0.tag
                      value: component
                    - type: STRING
                      name: item_tags.0.value
                      value: completion
                    - type: INTEGER
                      name: item_tags.1.operator
                      value: '4'
                    - type: STRING
                      name: item_tags.1.tag
                      value: ide
                    - type: STRING
                      name: item_tags.1.value
                      value: ''
                    - type: INTEGER
                      name: item_tags.2.operator
                      value: '5'
                    - type: STRING
                      name: item_tags.2.tag
                      value: model
                    - type: STRING
                      name: item_tags.2.value
                      value: ''
                    - type: STRING
                      name: primary_label
                      value: '{{ITEM.NAME}.regsub("\[(.*?)\]", "\1")}'
                    - type: INTEGER
                      name: primary_label_size_type
                      value: '1'
                    - type: STRING
                      name: reference
                      value: AAAAD
                    - type: INTEGER
                      name: secondary_label_decimal_places
                      value: '0'
                    - type: INTEGER
                      name: secondary_label_size
                      value: '50'
                    - type: INTEGER
                      name: secondary_label_size_type
                      value: '1'
                - type: honeycomb
                  name: 'Copilot.com users per model'
                  x: '36'
                  'y': '7'
                  width: '36'
                  height: '5'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FFBF59
                    - type: STRING
                      name: items.0
                      value: 'Copilot.com [*]: Engaged users'
                    - type: INTEGER
                      name: item_tags.0.operator
                      value: '4'
                    - type: STRING
                      name: item_tags.0.tag
                      value: model
                    - type: STRING
                      name: item_tags.0.value
                      value: ''
                    - type: STRING
                      name: primary_label
                      value: '{{ITEM.NAME}.regsub("\[(.*?)\]", "\1")}'
                    - type: INTEGER
                      name: primary_label_size_type
                      value: '1'
                    - type: STRING
                      name: reference
                      value: AAAAF
                    - type: INTEGER
                      name: secondary_label_decimal_places
                      value: '0'
                    - type: INTEGER
                      name: secondary_label_size
                      value: '50'
                    - type: INTEGER
                      name: secondary_label_size_type
                      value: '1'
                - type: honeycomb
                  name: 'PR summaries per repo & model'
                  x: '36'
                  'y': '12'
                  width: '36'
                  height: '5'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: E45959
                    - type: STRING
                      name: items.0
                      value: '* [*]: PR summaries created'
                    - type: INTEGER
                      name: item_tags.0.operator
                      value: '1'
                    - type: STRING
                      name: item_tags.0.tag
                      value: component
                    - type: STRING
                      name: item_tags.0.value
                      value: pull-requests
                    - type: STRING
                      name: primary_label
                      value: '{{ITEM.NAME}.regsub("^(.*?) \[(.*?)\]", "\1 / \2")}'
                    - type: STRING
                      name: reference
                      value: AAAAH
                    - type: INTEGER
                      name: secondary_label_decimal_places
                      value: '0'
                    - type: INTEGER
                      name: secondary_label_size
                      value: '50'
                    - type: INTEGER
                      name: secondary_label_size_type
                      value: '1'
                - type: honeycomb
                  name: 'Acceptance lines rate per IDE & model & language'
                  x: '36'
                  'y': '17'
                  width: '36'
                  height: '5'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: B39DDB
                    - type: STRING
                      name: items.0
                      value: '* [*/*]: Acceptance lines rate'
                    - type: INTEGER
                      name: item_tags.0.operator
                      value: '1'
                    - type: STRING
                      name: item_tags.0.tag
                      value: component
                    - type: STRING
                      name: item_tags.0.value
                      value: ide
                    - type: INTEGER
                      name: item_tags.1.operator
                      value: '4'
                    - type: STRING
                      name: item_tags.1.tag
                      value: language
                    - type: STRING
                      name: item_tags.1.value
                      value: ''
                    - type: STRING
                      name: primary_label
                      value: '{{ITEM.NAME}.regsub("^(.*?) \[(.*?)\/(.*?)\]", "\1 / \2 / \3")}'
                    - type: INTEGER
                      name: primary_label_size
                      value: '15'
                    - type: INTEGER
                      name: primary_label_size_type
                      value: '1'
                    - type: STRING
                      name: reference
                      value: AAAAK
                    - type: INTEGER
                      name: secondary_label_size
                      value: '40'
                    - type: INTEGER
                      name: secondary_label_size_type
                      value: '1'
                - type: item
                  name: 'Seats added this cycle'
                  x: '48'
                  width: '12'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub organization by HTTP'
                        key: github.org.copilot.seats_added_this_cycle
                    - type: INTEGER
                      name: show.0
                      value: '2'
                - type: item
                  name: 'Seats pending cancellation'
                  x: '60'
                  width: '12'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub organization by HTTP'
                        key: github.org.copilot.seats_pending_cancellation
                    - type: INTEGER
                      name: show.0
                      value: '2'
      valuemaps:
        - uuid: 044106454954428d92cf0a984fc79790
          name: 'Flag value'
          mappings:
            - value: '0'
              newvalue: 'false'
            - value: '1'
              newvalue: 'true'
            - value: '2'
              newvalue: unknown
        - uuid: 3155bc32a5c643859945ac8f220a23a5
          name: 'Visibility type'
          mappings:
            - value: '0'
              newvalue: private
            - value: '1'
              newvalue: public
            - value: '2'
              newvalue: internal
            - value: '3'
              newvalue: unknown
    - uuid: 11144543d1144a3693aa0b97a1c20dac
      template: 'GitHub repository by HTTP'
      name: 'GitHub repository by HTTP'
      description: |
        This template is designed for the effortless deployment of GitHub repository monitoring by Zabbix via GitHub REST API and doesn't require any external scripts.
        
        For more details about GitHub REST API, refer to the official documentation:
        https://docs.github.com/en/rest?apiVersion=2022-11-28
        
        Setup:
        
        1. Create an access token for monitoring
        
        One of the simplest ways to send authenticated requests is to use a personal access token - either a classic or a fine-grained one:
        https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api?apiVersion=2022-11-28#authenticating-with-a-personal-access-token
        
        Classic personal access token
        
        You can create a new classic personal access token by following the instructions in the official documentation:
        https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic
        
        For public repositories, no additional permission scopes are required. For monitoring to work on private repositories, the "repo" scope must be set to have full control of private repositories.
        
        Additional information about OAuth scopes is available in the official documentation:
        https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes
        
        Note that authenticated users must have admin access to the repository and the "repo" scope must be set to get information about self-hosted runners:
        https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-a-repository
        
        Fine-grained personal access token
        
        Alternatively, you can use a fine-grained personal access token:
        https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token
        
        In order to use fine-grained tokens to monitor organization-owned repositories, organizations must opt in to fine-grained personal access tokens and set up a personal access token policy:
        https://docs.github.com/en/organizations/managing-programmatic-access-to-your-organization/setting-a-personal-access-token-policy-for-your-organization
        
        The fine-grained token needs to have the following permissions set to provide access to the repository resources:
        - "Actions" repository permissions (read);
        - "Administration" repository permissions (read);
        - "Contents" repository permissions (read);
        - "Issues" repository permissions (read);
        - "Metadata" repository permissions (read);
        - "Pull requests" repository permissions (read).
        
        2. Set the access token that you've created in step 1 in the "{$GITHUB.API.TOKEN}" macro
        3. Change the API URL in the "{$GITHUB.API.URL}" macro if needed (for self-hosted installations)
        4. Set the repository owner name in the "{$GITHUB.REPO.OWNER}" macro
        5. Set the repository name in the "{$GITHUB.REPO.NAME}" macro
        6. Set the LLD rule filters if needed (you may want to use it to also stay within rate limits as on large repositories, LLD rules may generate a lot of script items)
        
        Note: Update intervals and timeouts for script items can be changed individually via "{$GITHUB.INTERVAL}" and "{$GITHUB.TIMEOUT}" macros with context. Depending on the repository being monitored, it can be adjusted if needed (if you are exceeding rate limits, you can increase update intervals for some script items to stay within per hour request limits). But be aware that it may also affect the triggers (check whether the item is used in triggers and adjust thresholds and/or evaluation periods if needed).
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        This template is designed for the effortless deployment of GitHub repository monitoring by Zabbix via GitHub REST API and doesn't require any external scripts.
        
        For more details about GitHub REST API, refer to the [official documentation](https://docs.github.com/en/rest?apiVersion=2022-11-28).
        
        ## Setup
        
        GitHub limits the number of REST API requests that you can make within a specific amount of time, which also depends on whether you are authenticated or not, the plan, and the token type used. Many REST API endpoints require authentication or return additional information if you are authenticated. Additionally, you can make more requests per hour when you are authenticated.
        
        Additional information is available in the official documentation:
        - [Regarding authentication](https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api?apiVersion=2022-11-28#about-authentication)
        - [Rate limits for the REST API](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28)
        
        1. **Create an access token for monitoring**
        
        One of the simplest ways to send authenticated requests is to use a [personal access token](https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api?apiVersion=2022-11-28#authenticating-with-a-personal-access-token) - either a classic or a fine-grained one.
        
        **Classic personal access token**
        
        You can create a new classic personal access token by following the [instructions in the official documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic).
        
        For public repositories, no additional permission scopes are required. For monitoring to work on private repositories, the `repo` scope must be set to have full control of private repositories.
        
        Additional information about OAuth scopes is available in the [official documentation](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes).
        
        Note that authenticated users must have admin access to the repository and the `repo` scope must be set to get information about [self-hosted runners](https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-a-repository).
        
        **Fine-grained personal access token**
        
        Alternatively, you can use a [fine-grained personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token).
        
        In order to use fine-grained tokens to monitor organization-owned repositories, [organizations must opt in to fine-grained personal access tokens and set up a personal access token policy](https://docs.github.com/en/organizations/managing-programmatic-access-to-your-organization/setting-a-personal-access-token-policy-for-your-organization).
        
        The fine-grained token needs to have the following permissions set to provide access to the repository resources:
        - "Actions" repository permissions (read);
        - "Administration" repository permissions (read);
        - "Contents" repository permissions (read);
        - "Issues" repository permissions (read);
        - "Metadata" repository permissions (read);
        - "Pull requests" repository permissions (read).
        
        2. **Set the access token** that you've created in step 1 in the `Access token` host wizard configuration field
        3. **Change the API URL** in the `API URL` host wizard configuration field if needed (for self-hosted installations)
        4. **Set the repository owner name** in the `Repository owner` host wizard configuration field
        5. **Set the repository name** in the `Repository name` host wizard configuration field
        6. **Set the LLD rule filters** if needed (you may want to use them to stay within rate limits as on large repositories, LLD rules may generate a lot of script items):
        - Filter repository branches by name: `Branch name filter (include)`, `Branch name filter (exclude)`;
        - Filter repository workflows by name: `Workflow name filter (include)`, `Workflow name filter (exclude)`;
        - Filter repository workflows by state: `Workflow state filter (include)`, `Workflow state filter (exclude)`;
        - Filter self-hosted runners by name: `Self-hosted runner name filter (include)`, `Self-hosted runner name filter (exclude)`;
        - Filter self-hosted runners by OS: `Self-hosted runner OS filter (include)`, `Self-hosted runner OS filter (exclude)`.
        
        Note: Update intervals and timeouts for script items can be changed individually via `Data update interval` and `API timeout` host wizard configuration fields with context. Depending on the repository being monitored, it can be adjusted if needed (if you are exceeding rate limits, you can increase update intervals for some script items to stay within per hour request limits). But be aware that it may also affect the triggers (check whether the item is used in triggers and adjust thresholds and/or evaluation periods if needed).
      vendor:
        name: Zabbix
        version: 8.0-2
      groups:
        - name: Templates/Applications
      items:
        - uuid: e348ae4bd2c04b5c88df2f5cb422eb61
          name: 'Get branches'
          type: SCRIPT
          key: github.repo.branches.get
          delay: '{$GITHUB.INTERVAL:"get_branches"}'
          history: '0'
          value_type: TEXT
          params: |
            var github = {
            	params: {},
            
            	setParams: function (params, required) {
            		required = required || [];
            		required.concat(['api_url', 'user_agent', 'api_version', 'pagination_required', 'api_token']).forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined'
            				|| params[field] === '') {
            				throw 'Required parameter is not set: "' + field + '".';
            			}
            		});
            
            		github.params = params;
            
            		if (typeof github.params.api_url === 'string' && !github.params.api_url.endsWith('/')) {
            			github.params.api_url += '/';
            		}
            	},
            
            	apiRequest: function (url, pagination_required) {
            		const next_pattern = /<([^>]+)>;\s*rel="next"/i;
            		var request = new HttpRequest(),
            			response,
            			headers,
            			final_data = {
            				headers: {},
            				data: []
            			};
            
            		pagination_required = (typeof pagination_required !== 'undefined') ? pagination_required : 'true';
            
            		request.addHeader('User-Agent: ' + github.params.user_agent);
            		request.addHeader('Accept: application/vnd.github+json');
            		request.addHeader('X-GitHub-Api-Version: ' + github.params.api_version);
            		request.addHeader('Authorization: Bearer ' + github.params.api_token);
            
            		if (typeof github.params.http_proxy !== 'undefined' && github.params.http_proxy !== '') {
            			request.setProxy(github.params.http_proxy);
            			Zabbix.log(4, '[ GitHub Repo ] Using HTTP proxy: ' + github.params.http_proxy);
            		}
            
            		while (url) {
            			Zabbix.log(4, '[ GitHub Repo ] Sending request: ' + url);
            
            			response = request.get(url);
            
            			Zabbix.log(4, '[ GitHub Repo ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            			if (request.getStatus() < 200 || request.getStatus() >= 300) {
            				throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
            			}
            
            			try {
            				response = JSON.parse(response);
            			}
            			catch (error) {
            				throw 'Failed to parse response received from API. Check debug log for more information.';
            			}
            
            			var parsed_data = github.parseData(response);
            			final_data.data = final_data.data.concat(parsed_data);
            
            			headers = request.getHeaders();
            
            			url = ((headers.link || '').match(next_pattern) || [])[1];
            
            			if (pagination_required === 'false') {
            				url = '';
            			}
            		}
            
            		final_data.headers = request.getHeaders();
            
            		delete request;
            
            		return final_data;
            	},
            
            	parseData: function (response_data) {
            		if (!response_data) {
            			return [];
            		}
            
            		const normalization_required = "total_count" in response_data && !("url" in response_data);
            		if (!normalization_required) return response_data;
            
            		delete response_data.incomplete_results;
            		delete response_data.repository_selection;
            		delete response_data.total_count;
            
            		const namespaceKey = Object.keys(response_data)[0];
            		response_data = response_data[namespaceKey];
            
            		return response_data;
            	},
            
            	itemsCount: function (response_data) {
            		const last_page_number = /<[^>]+page=(\d+)>;\s*rel="last"/i;
            
            		if (response_data.headers.link){
            			return response_data.headers.link.match(last_page_number)[1];
            		}
            
            		return response_data.data.length;
            	}
            }
            
            try {
            	github.setParams(JSON.parse(value), ['repo_owner', 'repo_name', 'api_query']);
            
            	var result = github.apiRequest(github.params.api_url + github.params.api_query + '?' + github.params.query_params || '', github.params.pagination_required);
            
            	return JSON.stringify(result);
            }
            catch (error) {
            	error += (String(error).endsWith('.')) ? '' : '.';
            	Zabbix.log(3, '[ GitHub Repo ] ERROR: ' + error);
            	return JSON.stringify({ error: error });
            }
          description: |
            Get the repository branches.
            
            Information about endpoint:
            https://docs.github.com/en/rest/branches/branches?apiVersion=2022-11-28#list-branches
          preprocessing:
            - type: CHECK_REGEX_ERROR
              parameters:
                - 'API rate limit exceeded'
                - \0
              error_handler: DISCARD_VALUE
          timeout: '{$GITHUB.TIMEOUT:"get_branches"}'
          parameters:
            - name: api_query
              value: 'repos/{$GITHUB.REPO.OWNER}/{$GITHUB.REPO.NAME}/branches'
            - name: api_token
              value: '{$GITHUB.API.TOKEN}'
            - name: api_url
              value: '{$GITHUB.API.URL}'
            - name: api_version
              value: '{$GITHUB.API_VERSION}'
            - name: http_proxy
              value: '{$GITHUB.HTTP_PROXY}'
            - name: pagination_required
              value: 'true'
            - name: query_params
              value: 'per_page={$GITHUB.RESULTS_PER_PAGE:"branches_discovery"}'
            - name: repo_name
              value: '{$GITHUB.REPO.NAME}'
            - name: repo_owner
              value: '{$GITHUB.REPO.OWNER}'
            - name: user_agent
              value: '{$GITHUB.USER_AGENT}'
          tags:
            - tag: component
              value: raw
        - uuid: 3b4799f0efc64f91836eb081b66f3e3b
          name: 'Number of closed issues'
          type: DEPENDENT
          key: github.repo.issues.closed
          description: 'The number of closed issues in the repository.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.issues.closed
          master_item:
            key: github.repo.issues.get
          tags:
            - tag: component
              value: issues
        - uuid: f88f02dc593844a89eb601e833a1a19c
          name: 'Get issue count'
          type: SCRIPT
          key: github.repo.issues.get
          delay: '{$GITHUB.INTERVAL:"get_issues_count"}'
          history: '0'
          value_type: TEXT
          params: |
            var github = {
            	params: {},
            
            	setParams: function (params, required) {
            		required = required || [];
            		required.concat(['api_url', 'user_agent', 'api_version', 'pagination_required', 'api_token']).forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined'
            				|| params[field] === '') {
            				throw 'Required parameter is not set: "' + field + '".';
            			}
            		});
            
            		github.params = params;
            
            		if (typeof github.params.api_url === 'string' && !github.params.api_url.endsWith('/')) {
            			github.params.api_url += '/';
            		}
            	},
            
            	apiRequest: function (url, pagination_required) {
            		const next_pattern = /<([^>]+)>;\s*rel="next"/i;
            		var request = new HttpRequest(),
            			response,
            			headers,
            			final_data = {
            				headers: {},
            				data: []
            			};
            
            		pagination_required = (typeof pagination_required !== 'undefined') ? pagination_required : 'true';
            
            		request.addHeader('User-Agent: ' + github.params.user_agent);
            		request.addHeader('Accept: application/vnd.github+json');
            		request.addHeader('X-GitHub-Api-Version: ' + github.params.api_version);
            		request.addHeader('Authorization: Bearer ' + github.params.api_token);
            
            		if (typeof github.params.http_proxy !== 'undefined' && github.params.http_proxy !== '') {
            			request.setProxy(github.params.http_proxy);
            			Zabbix.log(4, '[ GitHub Repo ] Using HTTP proxy: ' + github.params.http_proxy);
            		}
            
            		while (url) {
            			Zabbix.log(4, '[ GitHub Repo ] Sending request: ' + url);
            
            			response = request.get(url);
            
            			Zabbix.log(4, '[ GitHub Repo ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            			if (request.getStatus() < 200 || request.getStatus() >= 300) {
            				throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
            			}
            
            			try {
            				response = JSON.parse(response);
            			}
            			catch (error) {
            				throw 'Failed to parse response received from API. Check debug log for more information.';
            			}
            
            			var parsed_data = github.parseData(response);
            			final_data.data = final_data.data.concat(parsed_data);
            
            			headers = request.getHeaders();
            
            			url = ((headers.link || '').match(next_pattern) || [])[1];
            
            			if (pagination_required === 'false') {
            				url = '';
            			}
            		}
            
            		final_data.headers = request.getHeaders();
            
            		delete request;
            
            		return final_data;
            	},
            
            	parseData: function (response_data) {
            		if (!response_data) {
            			return [];
            		}
            
            		const normalization_required = "total_count" in response_data && !("url" in response_data);
            		if (!normalization_required) return response_data;
            
            		delete response_data.incomplete_results;
            		delete response_data.repository_selection;
            		delete response_data.total_count;
            
            		const namespaceKey = Object.keys(response_data)[0];
            		response_data = response_data[namespaceKey];
            
            		return response_data;
            	},
            
            	itemsCount: function (response_data) {
            		const last_page_number = /<[^>]+page=(\d+)>;\s*rel="last"/i;
            
            		if (response_data.headers.link){
            			return response_data.headers.link.match(last_page_number)[1];
            		}
            
            		return response_data.data.length;
            	}
            }
            
            try {
            	github.setParams(JSON.parse(value), ['repo_owner', 'repo_name']);
            
            	var issues_count,
            		issues_count_result = {
            			issues: {
            				total: 0,
            				open: 0,
            				closed: 0
            			},
            			pr: {
            				total: 0,
            				open: 0,
            				closed: 0
            			}
            		};
            
            	issues_count = github.apiRequest(github.params.api_url + 'repos/' + github.params.repo_owner + '/' + github.params.repo_name + '/pulls?state=all&per_page=1', github.params.pagination_required);
            	issues_count_result.pr.total = github.itemsCount(issues_count);
            
            	issues_count = github.apiRequest(github.params.api_url + 'repos/' + github.params.repo_owner + '/' + github.params.repo_name + '/pulls?state=open&per_page=1', github.params.pagination_required);
            	issues_count_result.pr.open = github.itemsCount(issues_count);
            
            	issues_count_result.pr.closed = issues_count_result.pr.total - issues_count_result.pr.open;
            
            
            	issues_count = github.apiRequest(github.params.api_url + 'repos/' + github.params.repo_owner + '/' + github.params.repo_name + '/issues?state=all&per_page=1', github.params.pagination_required);
            	issues_count_result.issues.total = github.itemsCount(issues_count) - issues_count_result.pr.total;
            
            	issues_count = github.apiRequest(github.params.api_url + 'repos/' + github.params.repo_owner + '/' + github.params.repo_name + '/issues?state=open&per_page=1', github.params.pagination_required);
            	issues_count_result.issues.open = github.itemsCount(issues_count) - issues_count_result.pr.open;
            
            	issues_count_result.issues.closed = issues_count_result.issues.total - issues_count_result.issues.open;
            
            	return JSON.stringify(issues_count_result);
            }
            catch (error) {
            	error += (String(error).endsWith('.')) ? '' : '.';
            	Zabbix.log(3, '[ GitHub Repo ] ERROR: ' + error);
            	return JSON.stringify({ error: error });
            }
          description: |
            Get the count of issues and pull requests in the repository (total, open, closed).
            
            Information about endpoint for issues:
            https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#list-repository-issues
            
            Information about endpoint for pull requests:
            https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#list-pull-requests
          preprocessing:
            - type: CHECK_REGEX_ERROR
              parameters:
                - 'API rate limit exceeded'
                - \0
              error_handler: DISCARD_VALUE
          timeout: '{$GITHUB.TIMEOUT:"get_issues_count"}'
          parameters:
            - name: api_token
              value: '{$GITHUB.API.TOKEN}'
            - name: api_url
              value: '{$GITHUB.API.URL}'
            - name: api_version
              value: '{$GITHUB.API_VERSION}'
            - name: http_proxy
              value: '{$GITHUB.HTTP_PROXY}'
            - name: pagination_required
              value: 'false'
            - name: repo_name
              value: '{$GITHUB.REPO.NAME}'
            - name: repo_owner
              value: '{$GITHUB.REPO.OWNER}'
            - name: user_agent
              value: '{$GITHUB.USER_AGENT}'
          tags:
            - tag: component
              value: raw
        - uuid: 7ea663eb6d4b40688115e0cb2ab03424
          name: 'Number of open issues'
          type: DEPENDENT
          key: github.repo.issues.open
          description: 'The number of open issues in the repository.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.issues.open
          master_item:
            key: github.repo.issues.get
          tags:
            - tag: component
              value: issues
        - uuid: f60f12d72f90461d8eeda2c2719cf94d
          name: 'Number of issues'
          type: DEPENDENT
          key: github.repo.issues.total
          description: 'The total number of issues in the repository.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.issues.total
          master_item:
            key: github.repo.issues.get
          tags:
            - tag: component
              value: issues
          triggers:
            - uuid: 9a146a900ced45b09a09b402daae6f94
              expression: 'last(/GitHub repository by HTTP/github.repo.issues.total)>last(/GitHub repository by HTTP/github.repo.issues.total,#2)'
              name: 'GitHub: The total number of issues has increased'
              priority: WARNING
              description: 'The total number of issues has increased which means that either a new issue (or multiple) has been opened.'
              type: MULTIPLE
              tags:
                - tag: scope
                  value: notice
        - uuid: 6c02d2fecace4bf4b94a06a923668938
          name: 'Number of closed PRs'
          type: DEPENDENT
          key: github.repo.pr.closed
          description: 'The number of closed pull requests in the repository.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.pr.closed
          master_item:
            key: github.repo.issues.get
          tags:
            - tag: component
              value: pull-requests
        - uuid: a1782ae22188416c8d2399fba2a1768c
          name: 'Number of open PRs'
          type: DEPENDENT
          key: github.repo.pr.open
          description: 'The number of open pull requests in the repository.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.pr.open
          master_item:
            key: github.repo.issues.get
          tags:
            - tag: component
              value: pull-requests
        - uuid: a20eda1b6c754b95b2bec1e449b681f5
          name: 'Number of PRs'
          type: DEPENDENT
          key: github.repo.pr.total
          description: 'The total number of pull requests in the repository.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.pr.total
          master_item:
            key: github.repo.issues.get
          tags:
            - tag: component
              value: pull-requests
          triggers:
            - uuid: 7d834276726941cf9952c820e478ccf0
              expression: 'last(/GitHub repository by HTTP/github.repo.pr.total)>last(/GitHub repository by HTTP/github.repo.pr.total,#2)'
              name: 'GitHub: The total number of PRs has increased'
              priority: INFO
              description: 'The total number of pull requests has increased which means that either a new pull request (or multiple) has been opened.'
              type: MULTIPLE
              tags:
                - tag: scope
                  value: notice
        - uuid: 0098bfc3ed5c4181a7dcd1eceb8e7251
          name: 'Number of releases'
          type: SCRIPT
          key: github.repo.releases.count
          delay: '{$GITHUB.INTERVAL:"get_releases_count"}'
          params: |
            var github = {
            	params: {},
            
            	setParams: function (params, required) {
            		required = required || [];
            		required.concat(['api_url', 'user_agent', 'api_version', 'pagination_required', 'api_token']).forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined'
            				|| params[field] === '') {
            				throw 'Required parameter is not set: "' + field + '".';
            			}
            		});
            
            		github.params = params;
            
            		if (typeof github.params.api_url === 'string' && !github.params.api_url.endsWith('/')) {
            			github.params.api_url += '/';
            		}
            	},
            
            	apiRequest: function (url, pagination_required) {
            		const next_pattern = /<([^>]+)>;\s*rel="next"/i;
            		var request = new HttpRequest(),
            			response,
            			headers,
            			final_data = {
            				headers: {},
            				data: []
            			};
            
            		pagination_required = (typeof pagination_required !== 'undefined') ? pagination_required : 'true';
            
            		request.addHeader('User-Agent: ' + github.params.user_agent);
            		request.addHeader('Accept: application/vnd.github+json');
            		request.addHeader('X-GitHub-Api-Version: ' + github.params.api_version);
            		request.addHeader('Authorization: Bearer ' + github.params.api_token);
            
            		if (typeof github.params.http_proxy !== 'undefined' && github.params.http_proxy !== '') {
            			request.setProxy(github.params.http_proxy);
            			Zabbix.log(4, '[ GitHub Repo ] Using HTTP proxy: ' + github.params.http_proxy);
            		}
            
            		while (url) {
            			Zabbix.log(4, '[ GitHub Repo ] Sending request: ' + url);
            
            			response = request.get(url);
            
            			Zabbix.log(4, '[ GitHub Repo ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            			if (request.getStatus() < 200 || request.getStatus() >= 300) {
            				throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
            			}
            
            			try {
            				response = JSON.parse(response);
            			}
            			catch (error) {
            				throw 'Failed to parse response received from API. Check debug log for more information.';
            			}
            
            			var parsed_data = github.parseData(response);
            			final_data.data = final_data.data.concat(parsed_data);
            
            			headers = request.getHeaders();
            
            			url = ((headers.link || '').match(next_pattern) || [])[1];
            
            			if (pagination_required === 'false') {
            				url = '';
            			}
            		}
            
            		final_data.headers = request.getHeaders();
            
            		delete request;
            
            		return final_data;
            	},
            
            	parseData: function (response_data) {
            		if (!response_data) {
            			return [];
            		}
            
            		const normalization_required = "total_count" in response_data && !("url" in response_data);
            		if (!normalization_required) return response_data;
            
            		delete response_data.incomplete_results;
            		delete response_data.repository_selection;
            		delete response_data.total_count;
            
            		const namespaceKey = Object.keys(response_data)[0];
            		response_data = response_data[namespaceKey];
            
            		return response_data;
            	},
            
            	itemsCount: function (response_data) {
            		const last_page_number = /<[^>]+page=(\d+)>;\s*rel="last"/i;
            
            		if (response_data.headers.link){
            			return response_data.headers.link.match(last_page_number)[1];
            		}
            
            		return response_data.data.length;
            	}
            }
            
            try {
            	github.setParams(JSON.parse(value), ['repo_owner', 'repo_name', 'api_query']);
            
            	var result = github.apiRequest(github.params.api_url + github.params.api_query + '?' + github.params.query_params || '', github.params.pagination_required);
            
            	return github.itemsCount(result);
            }
            catch (error) {
            	error += (String(error).endsWith('.')) ? '' : '.';
            	Zabbix.log(3, '[ GitHub Repo ] ERROR: ' + error);
            	return JSON.stringify({ error: error });
            }
          description: |
            The number of releases in the repository. Note that this number also includes draft releases.
            
            Information about endpoint:
            https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#list-releases
          preprocessing:
            - type: CHECK_REGEX_ERROR
              parameters:
                - 'API rate limit exceeded'
                - \0
              error_handler: DISCARD_VALUE
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          timeout: '{$GITHUB.TIMEOUT:"get_releases_count"}'
          parameters:
            - name: api_query
              value: 'repos/{$GITHUB.REPO.OWNER}/{$GITHUB.REPO.NAME}/releases'
            - name: api_token
              value: '{$GITHUB.API.TOKEN}'
            - name: api_url
              value: '{$GITHUB.API.URL}'
            - name: api_version
              value: '{$GITHUB.API_VERSION}'
            - name: http_proxy
              value: '{$GITHUB.HTTP_PROXY}'
            - name: pagination_required
              value: 'false'
            - name: query_params
              value: per_page=1
            - name: repo_name
              value: '{$GITHUB.REPO.NAME}'
            - name: repo_owner
              value: '{$GITHUB.REPO.OWNER}'
            - name: user_agent
              value: '{$GITHUB.USER_AGENT}'
          tags:
            - tag: component
              value: releases
        - uuid: 72a596dd573e4237a1fde665477bdfb5
          name: 'Repository forks'
          type: DEPENDENT
          key: github.repo.repository.forks.count
          description: 'The number of repository forks.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data..forks_count.first()
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: github.repo.repository.get
          tags:
            - tag: component
              value: repository
        - uuid: 37e94a93bf924d84bb6609eec47ff081
          name: 'Get repository'
          type: SCRIPT
          key: github.repo.repository.get
          delay: '{$GITHUB.INTERVAL:"get_repo"}'
          history: '0'
          value_type: TEXT
          params: |
            var github = {
            	params: {},
            
            	setParams: function (params, required) {
            		required = required || [];
            		required.concat(['api_url', 'user_agent', 'api_version', 'pagination_required', 'api_token']).forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined'
            				|| params[field] === '') {
            				throw 'Required parameter is not set: "' + field + '".';
            			}
            		});
            
            		github.params = params;
            
            		if (typeof github.params.api_url === 'string' && !github.params.api_url.endsWith('/')) {
            			github.params.api_url += '/';
            		}
            	},
            
            	apiRequest: function (url, pagination_required) {
            		const next_pattern = /<([^>]+)>;\s*rel="next"/i;
            		var request = new HttpRequest(),
            			response,
            			headers,
            			final_data = {
            				headers: {},
            				data: []
            			};
            
            		pagination_required = (typeof pagination_required !== 'undefined') ? pagination_required : 'true';
            
            		request.addHeader('User-Agent: ' + github.params.user_agent);
            		request.addHeader('Accept: application/vnd.github+json');
            		request.addHeader('X-GitHub-Api-Version: ' + github.params.api_version);
            		request.addHeader('Authorization: Bearer ' + github.params.api_token);
            
            		if (typeof github.params.http_proxy !== 'undefined' && github.params.http_proxy !== '') {
            			request.setProxy(github.params.http_proxy);
            			Zabbix.log(4, '[ GitHub Repo ] Using HTTP proxy: ' + github.params.http_proxy);
            		}
            
            		while (url) {
            			Zabbix.log(4, '[ GitHub Repo ] Sending request: ' + url);
            
            			response = request.get(url);
            
            			Zabbix.log(4, '[ GitHub Repo ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            			if (request.getStatus() < 200 || request.getStatus() >= 300) {
            				throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
            			}
            
            			try {
            				response = JSON.parse(response);
            			}
            			catch (error) {
            				throw 'Failed to parse response received from API. Check debug log for more information.';
            			}
            
            			var parsed_data = github.parseData(response);
            			final_data.data = final_data.data.concat(parsed_data);
            
            			headers = request.getHeaders();
            
            			url = ((headers.link || '').match(next_pattern) || [])[1];
            
            			if (pagination_required === 'false') {
            				url = '';
            			}
            		}
            
            		final_data.headers = request.getHeaders();
            
            		delete request;
            
            		return final_data;
            	},
            
            	parseData: function (response_data) {
            		if (!response_data) {
            			return [];
            		}
            
            		const normalization_required = "total_count" in response_data && !("url" in response_data);
            		if (!normalization_required) return response_data;
            
            		delete response_data.incomplete_results;
            		delete response_data.repository_selection;
            		delete response_data.total_count;
            
            		const namespaceKey = Object.keys(response_data)[0];
            		response_data = response_data[namespaceKey];
            
            		return response_data;
            	},
            
            	itemsCount: function (response_data) {
            		const last_page_number = /<[^>]+page=(\d+)>;\s*rel="last"/i;
            
            		if (response_data.headers.link){
            			return response_data.headers.link.match(last_page_number)[1];
            		}
            
            		return response_data.data.length;
            	}
            }
            
            try {
            	github.setParams(JSON.parse(value), ['repo_owner', 'repo_name', 'api_query']);
            
            	var repo_data = github.apiRequest(github.params.api_url + github.params.api_query);
            
            	if (repo_data.data[0].fork === false) {
            		var repo_community_profile = github.apiRequest(github.params.api_url + github.params.api_query + '/community/profile');
            
            		repo_data.data[0].zbx_community_profile = repo_community_profile.data[0];
            	}
            
            	return JSON.stringify(repo_data);
            }
            catch (error) {
            	error += (String(error).endsWith('.')) ? '' : '.';
            	Zabbix.log(3, '[ GitHub Repo ] ERROR: ' + error);
            	return JSON.stringify({ error: error });
            }
          description: |
            Get the general repository information. If the repository is not a fork, the community profile metrics are also retrieved.
            
            Information about endpoint:
            https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#get-a-repository
            
            Information about community profile metrics:
            https://docs.github.com/en/rest/metrics/community?apiVersion=2022-11-28#get-community-profile-metrics
          timeout: '{$GITHUB.TIMEOUT:"get_repo"}'
          parameters:
            - name: api_query
              value: 'repos/{$GITHUB.REPO.OWNER}/{$GITHUB.REPO.NAME}'
            - name: api_token
              value: '{$GITHUB.API.TOKEN}'
            - name: api_url
              value: '{$GITHUB.API.URL}'
            - name: api_version
              value: '{$GITHUB.API_VERSION}'
            - name: http_proxy
              value: '{$GITHUB.HTTP_PROXY}'
            - name: pagination_required
              value: 'false'
            - name: repo_name
              value: '{$GITHUB.REPO.NAME}'
            - name: repo_owner
              value: '{$GITHUB.REPO.OWNER}'
            - name: user_agent
              value: '{$GITHUB.USER_AGENT}'
          tags:
            - tag: component
              value: raw
        - uuid: 4bc2b485d4f546a0b390288d48bc179d
          name: 'Get repository data check'
          type: DEPENDENT
          key: github.repo.repository.get.check
          value_type: TEXT
          description: 'Data collection check.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.error
              error_handler: CUSTOM_VALUE
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: github.repo.repository.get
          tags:
            - tag: component
              value: status
          triggers:
            - uuid: fea49679a888491c96516b421703131b
              expression: 'length(last(/GitHub repository by HTTP/github.repo.repository.get.check))>0'
              name: 'GitHub: There are errors in requests to API'
              priority: AVERAGE
              description: 'Errors have been received in response to API requests. Check the latest values for details.'
              tags:
                - tag: scope
                  value: availability
        - uuid: c0e4cf3a4f654f5b82d29db43aeaa6eb
          name: 'Repository is a fork'
          type: DEPENDENT
          key: github.repo.repository.is_fork
          description: 'Indicates whether the repository is a fork.'
          valuemap:
            name: Boolean
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data..fork.first()
            - type: BOOL_TO_DECIMAL
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          master_item:
            key: github.repo.repository.get
          tags:
            - tag: component
              value: repository
        - uuid: ece3996cba7e4561a6629df40299579f
          name: 'Repository size'
          type: DEPENDENT
          key: github.repo.repository.size
          units: B
          description: 'The size of the repository.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data..size.first()
            - type: MULTIPLIER
              parameters:
                - '1024'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: github.repo.repository.get
          tags:
            - tag: component
              value: repository
        - uuid: 2e329b0973aa4f2abf94bf10554d776c
          name: 'Repository stargazers'
          type: DEPENDENT
          key: github.repo.repository.stargazers
          description: 'The number of GitHub users who have starred the repository.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data..stargazers_count.first()
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: github.repo.repository.get
          tags:
            - tag: component
              value: repository
        - uuid: 488ff6c6217d4d51a7cb8fd278996435
          name: 'Repository watchers'
          type: DEPENDENT
          key: github.repo.repository.watchers
          description: 'The number of GitHub users who are subscribed to the repository.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data..subscribers_count.first()
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: github.repo.repository.get
          tags:
            - tag: component
              value: repository
        - uuid: 1166ecf4aa624b469805406da0b1f552
          name: 'Request limit'
          type: DEPENDENT
          key: github.repo.requests.limit
          description: |
            API request limit.
            
            Information about request limits in GitHub REST API documentation:
            https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.headers[''x-ratelimit-limit'']'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: github.repo.repository.get
          tags:
            - tag: component
              value: request-limits
        - uuid: a0c4165547f942a789deee0703c1f284
          name: 'Requests used'
          type: DEPENDENT
          key: github.repo.requests.used
          description: |
            The number of used API requests.
            
            Information about request limits in GitHub REST API documentation:
            https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.headers[''x-ratelimit-used'']'
          master_item:
            key: github.repo.repository.get
          tags:
            - tag: component
              value: request-limits
        - uuid: e4b52ac7188944298fd6ca306ed4f8b8
          name: 'Request limit utilization, in %'
          type: DEPENDENT
          key: github.repo.requests.util
          value_type: FLOAT
          units: '%'
          description: |
            The calculated utilization of the API request limit in %.
            
            Information about request limits in GitHub REST API documentation:
            https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  const data = JSON.parse(value);
                  
                  const requests_limit = data.headers['x-ratelimit-limit'],
                  	  requests_used = data.headers['x-ratelimit-used'];
                  
                  return requests_used / requests_limit * 100;
          master_item:
            key: github.repo.repository.get
          tags:
            - tag: component
              value: request-limits
          triggers:
            - uuid: 621ef82bf8f74f09a8c30b8a38085e9d
              expression: 'max(/GitHub repository by HTTP/github.repo.requests.util,1h)>{$GITHUB.REQUESTS.UTIL.WARN}'
              recovery_mode: RECOVERY_EXPRESSION
              recovery_expression: 'max(/GitHub repository by HTTP/github.repo.requests.util,1h)>{$GITHUB.REQUESTS.UTIL.WARN}-5'
              name: 'GitHub: API request limit utilization is high'
              event_name: 'GitHub: API request limit utilization is high (usage is > {$GITHUB.REQUESTS.UTIL.WARN})'
              priority: WARNING
              description: |
                The API request limit utilization is high. It can be lowered by increasing the update intervals for script items (by setting up higher values in corresponding context macros).
                
                The trigger will be resolved automatically if the limit usage drops 5% below the trigger threshold.
                
                Information about request limits in GitHub REST API documentation:
                https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28
              dependencies:
                - name: 'GitHub: API request limit utilization is very high'
                  expression: 'max(/GitHub repository by HTTP/github.repo.requests.util,1h)>{$GITHUB.REQUESTS.UTIL.HIGH}'
                  recovery_expression: 'max(/GitHub repository by HTTP/github.repo.requests.util,1h)>{$GITHUB.REQUESTS.UTIL.HIGH}-5'
              tags:
                - tag: scope
                  value: availability
                - tag: scope
                  value: capacity
            - uuid: 9783018b6c394397aa093b4f8a1a4067
              expression: 'max(/GitHub repository by HTTP/github.repo.requests.util,1h)>{$GITHUB.REQUESTS.UTIL.HIGH}'
              recovery_mode: RECOVERY_EXPRESSION
              recovery_expression: 'max(/GitHub repository by HTTP/github.repo.requests.util,1h)>{$GITHUB.REQUESTS.UTIL.HIGH}-5'
              name: 'GitHub: API request limit utilization is very high'
              event_name: 'GitHub: API request limit utilization is very high (usage is > {$GITHUB.REQUESTS.UTIL.HIGH})'
              priority: AVERAGE
              description: |
                The API request limit utilization is very high. It can be lowered by increasing the update intervals for script items (by setting up higher values in corresponding context macros).
                
                The trigger will be resolved automatically if the limit usage drops 5% below the trigger threshold.
                
                Information about request limits in GitHub REST API documentation:
                https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28
              tags:
                - tag: scope
                  value: availability
                - tag: scope
                  value: capacity
        - uuid: a0ca909d3c734d859594771985a5c302
          name: 'Get self-hosted runners'
          type: SCRIPT
          key: github.repo.runners.get
          delay: '{$GITHUB.INTERVAL:"get_runners"}'
          history: '0'
          value_type: TEXT
          params: |
            var github = {
            	params: {},
            
            	setParams: function (params, required) {
            		required = required || [];
            		required.concat(['api_url', 'user_agent', 'api_version', 'pagination_required', 'api_token']).forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined'
            				|| params[field] === '') {
            				throw 'Required parameter is not set: "' + field + '".';
            			}
            		});
            
            		github.params = params;
            
            		if (typeof github.params.api_url === 'string' && !github.params.api_url.endsWith('/')) {
            			github.params.api_url += '/';
            		}
            	},
            
            	apiRequest: function (url, pagination_required) {
            		const next_pattern = /<([^>]+)>;\s*rel="next"/i;
            		var request = new HttpRequest(),
            			response,
            			headers,
            			final_data = {
            				headers: {},
            				data: []
            			};
            
            		pagination_required = (typeof pagination_required !== 'undefined') ? pagination_required : 'true';
            
            		request.addHeader('User-Agent: ' + github.params.user_agent);
            		request.addHeader('Accept: application/vnd.github+json');
            		request.addHeader('X-GitHub-Api-Version: ' + github.params.api_version);
            		request.addHeader('Authorization: Bearer ' + github.params.api_token);
            
            		if (typeof github.params.http_proxy !== 'undefined' && github.params.http_proxy !== '') {
            			request.setProxy(github.params.http_proxy);
            			Zabbix.log(4, '[ GitHub Repo ] Using HTTP proxy: ' + github.params.http_proxy);
            		}
            
            		while (url) {
            			Zabbix.log(4, '[ GitHub Repo ] Sending request: ' + url);
            
            			response = request.get(url);
            
            			Zabbix.log(4, '[ GitHub Repo ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            			if (request.getStatus() < 200 || request.getStatus() >= 300) {
            				throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
            			}
            
            			try {
            				response = JSON.parse(response);
            			}
            			catch (error) {
            				throw 'Failed to parse response received from API. Check debug log for more information.';
            			}
            
            			var parsed_data = github.parseData(response);
            			final_data.data = final_data.data.concat(parsed_data);
            
            			headers = request.getHeaders();
            
            			url = ((headers.link || '').match(next_pattern) || [])[1];
            
            			if (pagination_required === 'false') {
            				url = '';
            			}
            		}
            
            		final_data.headers = request.getHeaders();
            
            		delete request;
            
            		return final_data;
            	},
            
            	parseData: function (response_data) {
            		if (!response_data) {
            			return [];
            		}
            
            		const normalization_required = "total_count" in response_data && !("url" in response_data);
            		if (!normalization_required) return response_data;
            
            		delete response_data.incomplete_results;
            		delete response_data.repository_selection;
            		delete response_data.total_count;
            
            		const namespaceKey = Object.keys(response_data)[0];
            		response_data = response_data[namespaceKey];
            
            		return response_data;
            	},
            
            	itemsCount: function (response_data) {
            		const last_page_number = /<[^>]+page=(\d+)>;\s*rel="last"/i;
            
            		if (response_data.headers.link){
            			return response_data.headers.link.match(last_page_number)[1];
            		}
            
            		return response_data.data.length;
            	}
            }
            
            try {
            	github.setParams(JSON.parse(value), ['repo_owner', 'repo_name', 'api_query']);
            
            	var result = github.apiRequest(github.params.api_url + github.params.api_query + '?' + github.params.query_params || '', github.params.pagination_required);
            
            	return JSON.stringify(result);
            }
            catch (error) {
            	error += (String(error).endsWith('.')) ? '' : '.';
            	Zabbix.log(3, '[ GitHub Repo ] ERROR: ' + error);
            	return JSON.stringify({ error: error });
            }
          description: |
            Get the self-hosted runners of the repository.
            
            Note that admin access to the repository is required to use this endpoint:
            https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-a-repository
          preprocessing:
            - type: CHECK_REGEX_ERROR
              parameters:
                - 'API rate limit exceeded'
                - \0
              error_handler: DISCARD_VALUE
          timeout: '{$GITHUB.TIMEOUT:"get_runners"}'
          parameters:
            - name: api_query
              value: 'repos/{$GITHUB.REPO.OWNER}/{$GITHUB.REPO.NAME}/actions/runners'
            - name: api_token
              value: '{$GITHUB.API.TOKEN}'
            - name: api_url
              value: '{$GITHUB.API.URL}'
            - name: api_version
              value: '{$GITHUB.API_VERSION}'
            - name: http_proxy
              value: '{$GITHUB.HTTP_PROXY}'
            - name: pagination_required
              value: 'true'
            - name: query_params
              value: 'per_page={$GITHUB.RESULTS_PER_PAGE:"get_runners"}'
            - name: repo_name
              value: '{$GITHUB.REPO.NAME}'
            - name: repo_owner
              value: '{$GITHUB.REPO.OWNER}'
            - name: user_agent
              value: '{$GITHUB.USER_AGENT}'
          tags:
            - tag: component
              value: raw
        - uuid: 35507c347ff44527a7deb3aaf4846d33
          name: 'Get self-hosted runner check'
          type: DEPENDENT
          key: github.repo.runners.get.check
          value_type: TEXT
          description: 'Carry out a self-hosted runners data collection check.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.error
              error_handler: CUSTOM_VALUE
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: github.repo.runners.get
          tags:
            - tag: component
              value: status
          triggers:
            - uuid: 30877fea1bd14e22b8b5c4a040001bb5
              expression: 'find(/GitHub repository by HTTP/github.repo.runners.get.check,,"iregexp","Must have admin rights to Repository")=1'
              name: 'GitHub: No access to repository self-hosted runners'
              priority: AVERAGE
              description: |
                Admin access to the repository is required to use this endpoint:
                https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-a-repository
        - uuid: 49d81fc72a6a455ebee7304592056930
          name: 'Number of tags'
          type: SCRIPT
          key: github.repo.tags.count
          delay: '{$GITHUB.INTERVAL:"get_tags_count"}'
          params: |
            var github = {
            	params: {},
            
            	setParams: function (params, required) {
            		required = required || [];
            		required.concat(['api_url', 'user_agent', 'api_version', 'pagination_required', 'api_token']).forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined'
            				|| params[field] === '') {
            				throw 'Required parameter is not set: "' + field + '".';
            			}
            		});
            
            		github.params = params;
            
            		if (typeof github.params.api_url === 'string' && !github.params.api_url.endsWith('/')) {
            			github.params.api_url += '/';
            		}
            	},
            
            	apiRequest: function (url, pagination_required) {
            		const next_pattern = /<([^>]+)>;\s*rel="next"/i;
            		var request = new HttpRequest(),
            			response,
            			headers,
            			final_data = {
            				headers: {},
            				data: []
            			};
            
            		pagination_required = (typeof pagination_required !== 'undefined') ? pagination_required : 'true';
            
            		request.addHeader('User-Agent: ' + github.params.user_agent);
            		request.addHeader('Accept: application/vnd.github+json');
            		request.addHeader('X-GitHub-Api-Version: ' + github.params.api_version);
            		request.addHeader('Authorization: Bearer ' + github.params.api_token);
            
            		if (typeof github.params.http_proxy !== 'undefined' && github.params.http_proxy !== '') {
            			request.setProxy(github.params.http_proxy);
            			Zabbix.log(4, '[ GitHub Repo ] Using HTTP proxy: ' + github.params.http_proxy);
            		}
            
            		while (url) {
            			Zabbix.log(4, '[ GitHub Repo ] Sending request: ' + url);
            
            			response = request.get(url);
            
            			Zabbix.log(4, '[ GitHub Repo ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            			if (request.getStatus() < 200 || request.getStatus() >= 300) {
            				throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
            			}
            
            			try {
            				response = JSON.parse(response);
            			}
            			catch (error) {
            				throw 'Failed to parse response received from API. Check debug log for more information.';
            			}
            
            			var parsed_data = github.parseData(response);
            			final_data.data = final_data.data.concat(parsed_data);
            
            			headers = request.getHeaders();
            
            			url = ((headers.link || '').match(next_pattern) || [])[1];
            
            			if (pagination_required === 'false') {
            				url = '';
            			}
            		}
            
            		final_data.headers = request.getHeaders();
            
            		delete request;
            
            		return final_data;
            	},
            
            	parseData: function (response_data) {
            		if (!response_data) {
            			return [];
            		}
            
            		const normalization_required = "total_count" in response_data && !("url" in response_data);
            		if (!normalization_required) return response_data;
            
            		delete response_data.incomplete_results;
            		delete response_data.repository_selection;
            		delete response_data.total_count;
            
            		const namespaceKey = Object.keys(response_data)[0];
            		response_data = response_data[namespaceKey];
            
            		return response_data;
            	},
            
            	itemsCount: function (response_data) {
            		const last_page_number = /<[^>]+page=(\d+)>;\s*rel="last"/i;
            
            		if (response_data.headers.link){
            			return response_data.headers.link.match(last_page_number)[1];
            		}
            
            		return response_data.data.length;
            	}
            }
            
            try {
            	github.setParams(JSON.parse(value), ['repo_owner', 'repo_name', 'api_query']);
            
            	var result = github.apiRequest(github.params.api_url + github.params.api_query + '?' + github.params.query_params || '', github.params.pagination_required);
            
            	return github.itemsCount(result);
            }
            catch (error) {
            	error += (String(error).endsWith('.')) ? '' : '.';
            	Zabbix.log(3, '[ GitHub Repo ] ERROR: ' + error);
            	return JSON.stringify({ error: error });
            }
          description: |
            The number of tags in the repository.
            
            Information about endpoint:
            https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-repository-tags
          preprocessing:
            - type: CHECK_REGEX_ERROR
              parameters:
                - 'API rate limit exceeded'
                - \0
              error_handler: DISCARD_VALUE
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          timeout: '{$GITHUB.TIMEOUT:"get_tags_count"}'
          parameters:
            - name: api_query
              value: 'repos/{$GITHUB.REPO.OWNER}/{$GITHUB.REPO.NAME}/tags'
            - name: api_token
              value: '{$GITHUB.API.TOKEN}'
            - name: api_url
              value: '{$GITHUB.API.URL}'
            - name: api_version
              value: '{$GITHUB.API_VERSION}'
            - name: http_proxy
              value: '{$GITHUB.HTTP_PROXY}'
            - name: pagination_required
              value: 'false'
            - name: query_params
              value: per_page=1
            - name: repo_name
              value: '{$GITHUB.REPO.NAME}'
            - name: repo_owner
              value: '{$GITHUB.REPO.OWNER}'
            - name: user_agent
              value: '{$GITHUB.USER_AGENT}'
          tags:
            - tag: component
              value: tags
        - uuid: d45dbcb0493d4258ac2cdba10648b3b3
          name: 'Get workflows'
          type: SCRIPT
          key: github.repo.workflows.get
          delay: '{$GITHUB.INTERVAL:"get_workflows"}'
          history: '0'
          value_type: TEXT
          params: |
            var github = {
            	params: {},
            
            	setParams: function (params, required) {
            		required = required || [];
            		required.concat(['api_url', 'user_agent', 'api_version', 'pagination_required', 'api_token']).forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined'
            				|| params[field] === '') {
            				throw 'Required parameter is not set: "' + field + '".';
            			}
            		});
            
            		github.params = params;
            
            		if (typeof github.params.api_url === 'string' && !github.params.api_url.endsWith('/')) {
            			github.params.api_url += '/';
            		}
            	},
            
            	apiRequest: function (url, pagination_required) {
            		const next_pattern = /<([^>]+)>;\s*rel="next"/i;
            		var request = new HttpRequest(),
            			response,
            			headers,
            			final_data = {
            				headers: {},
            				data: []
            			};
            
            		pagination_required = (typeof pagination_required !== 'undefined') ? pagination_required : 'true';
            
            		request.addHeader('User-Agent: ' + github.params.user_agent);
            		request.addHeader('Accept: application/vnd.github+json');
            		request.addHeader('X-GitHub-Api-Version: ' + github.params.api_version);
            		request.addHeader('Authorization: Bearer ' + github.params.api_token);
            
            		if (typeof github.params.http_proxy !== 'undefined' && github.params.http_proxy !== '') {
            			request.setProxy(github.params.http_proxy);
            			Zabbix.log(4, '[ GitHub Repo ] Using HTTP proxy: ' + github.params.http_proxy);
            		}
            
            		while (url) {
            			Zabbix.log(4, '[ GitHub Repo ] Sending request: ' + url);
            
            			response = request.get(url);
            
            			Zabbix.log(4, '[ GitHub Repo ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            			if (request.getStatus() < 200 || request.getStatus() >= 300) {
            				throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
            			}
            
            			try {
            				response = JSON.parse(response);
            			}
            			catch (error) {
            				throw 'Failed to parse response received from API. Check debug log for more information.';
            			}
            
            			var parsed_data = github.parseData(response);
            			final_data.data = final_data.data.concat(parsed_data);
            
            			headers = request.getHeaders();
            
            			url = ((headers.link || '').match(next_pattern) || [])[1];
            
            			if (pagination_required === 'false') {
            				url = '';
            			}
            		}
            
            		final_data.headers = request.getHeaders();
            
            		delete request;
            
            		return final_data;
            	},
            
            	parseData: function (response_data) {
            		if (!response_data) {
            			return [];
            		}
            
            		const normalization_required = "total_count" in response_data && !("url" in response_data);
            		if (!normalization_required) return response_data;
            
            		delete response_data.incomplete_results;
            		delete response_data.repository_selection;
            		delete response_data.total_count;
            
            		const namespaceKey = Object.keys(response_data)[0];
            		response_data = response_data[namespaceKey];
            
            		return response_data;
            	},
            
            	itemsCount: function (response_data) {
            		const last_page_number = /<[^>]+page=(\d+)>;\s*rel="last"/i;
            
            		if (response_data.headers.link){
            			return response_data.headers.link.match(last_page_number)[1];
            		}
            
            		return response_data.data.length;
            	}
            }
            
            try {
            	github.setParams(JSON.parse(value), ['repo_owner', 'repo_name', 'api_query']);
            
            	var repo_data = github.apiRequest(github.params.api_url + github.params.api_query);
            
            	if (repo_data.data[0].fork === false) {
            		var repo_community_profile = github.apiRequest(github.params.api_url + github.params.api_query + '/community/profile');
            
            		repo_data.data[0].zbx_community_profile = repo_community_profile.data[0];
            	}
            
            	return JSON.stringify(repo_data);
            }
            catch (error) {
            	error += (String(error).endsWith('.')) ? '' : '.';
            	Zabbix.log(3, '[ GitHub Repo ] ERROR: ' + error);
            	return JSON.stringify({ error: error });
            }
          description: |
            Get the repository workflows.
            
            Information about endpoint:
            https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#list-repository-workflows
          preprocessing:
            - type: CHECK_REGEX_ERROR
              parameters:
                - 'API rate limit exceeded'
                - \0
              error_handler: DISCARD_VALUE
          timeout: '{$GITHUB.TIMEOUT:"get_workflows"}'
          parameters:
            - name: api_query
              value: 'repos/{$GITHUB.REPO.OWNER}/{$GITHUB.REPO.NAME}/actions/workflows'
            - name: api_token
              value: '{$GITHUB.API.TOKEN}'
            - name: api_url
              value: '{$GITHUB.API.URL}'
            - name: api_version
              value: '{$GITHUB.API_VERSION}'
            - name: http_proxy
              value: '{$GITHUB.HTTP_PROXY}'
            - name: pagination_required
              value: 'true'
            - name: query_params
              value: 'per_page={$GITHUB.RESULTS_PER_PAGE:"workflows_discovery"}'
            - name: repo_name
              value: '{$GITHUB.REPO.NAME}'
            - name: repo_owner
              value: '{$GITHUB.REPO.OWNER}'
            - name: user_agent
              value: '{$GITHUB.USER_AGENT}'
          tags:
            - tag: component
              value: raw
      discovery_rules:
        - uuid: 8142a17a53f44cd9b3d3991b9e3da91d
          name: 'Branch discovery'
          type: DEPENDENT
          key: github.repo.branches.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#BRANCH_NAME}'
                value: '{$GITHUB.BRANCH.NAME.MATCHES}'
              - macro: '{#BRANCH_NAME}'
                value: '{$GITHUB.BRANCH.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: |
            Discovers repository branches.
            
            Information about endpoint:
            https://docs.github.com/en/rest/branches/branches?apiVersion=2022-11-28#list-branches
          item_prototypes:
            - uuid: 927ef4806cc4460a8882c204a9e94817
              name: 'Branch [{#BRANCH_NAME}]: Number of commits'
              type: SCRIPT
              key: 'github.repo.branches.commits.total[{#BRANCH_NAME}]'
              delay: '{$GITHUB.INTERVAL:"get_commits_count:{#BRANCH_NAME}"}'
              params: |
                var github = {
                	params: {},
                
                	setParams: function (params, required) {
                		required = required || [];
                		required.concat(['api_url', 'user_agent', 'api_version', 'pagination_required', 'api_token']).forEach(function (field) {
                			if (typeof params !== 'object' || typeof params[field] === 'undefined'
                				|| params[field] === '') {
                				throw 'Required parameter is not set: "' + field + '".';
                			}
                		});
                
                		github.params = params;
                
                		if (typeof github.params.api_url === 'string' && !github.params.api_url.endsWith('/')) {
                			github.params.api_url += '/';
                		}
                	},
                
                	apiRequest: function (url, pagination_required) {
                		const next_pattern = /<([^>]+)>;\s*rel="next"/i;
                		var request = new HttpRequest(),
                			response,
                			headers,
                			final_data = {
                				headers: {},
                				data: []
                			};
                
                		pagination_required = (typeof pagination_required !== 'undefined') ? pagination_required : 'true';
                
                		request.addHeader('User-Agent: ' + github.params.user_agent);
                		request.addHeader('Accept: application/vnd.github+json');
                		request.addHeader('X-GitHub-Api-Version: ' + github.params.api_version);
                		request.addHeader('Authorization: Bearer ' + github.params.api_token);
                
                		if (typeof github.params.http_proxy !== 'undefined' && github.params.http_proxy !== '') {
                			request.setProxy(github.params.http_proxy);
                			Zabbix.log(4, '[ GitHub Repo ] Using HTTP proxy: ' + github.params.http_proxy);
                		}
                
                		while (url) {
                			Zabbix.log(4, '[ GitHub Repo ] Sending request: ' + url);
                
                			response = request.get(url);
                
                			Zabbix.log(4, '[ GitHub Repo ] Received response with status code ' + request.getStatus() + ': ' + response);
                
                			if (request.getStatus() < 200 || request.getStatus() >= 300) {
                				throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
                			}
                
                			try {
                				response = JSON.parse(response);
                			}
                			catch (error) {
                				throw 'Failed to parse response received from API. Check debug log for more information.';
                			}
                
                			var parsed_data = github.parseData(response);
                			final_data.data = final_data.data.concat(parsed_data);
                
                			headers = request.getHeaders();
                
                			url = ((headers.link || '').match(next_pattern) || [])[1];
                
                			if (pagination_required === 'false') {
                				url = '';
                			}
                		}
                
                		final_data.headers = request.getHeaders();
                
                		delete request;
                
                		return final_data;
                	},
                
                	parseData: function (response_data) {
                		if (!response_data) {
                			return [];
                		}
                
                		const normalization_required = "total_count" in response_data && !("url" in response_data);
                		if (!normalization_required) return response_data;
                
                		delete response_data.incomplete_results;
                		delete response_data.repository_selection;
                		delete response_data.total_count;
                
                		const namespaceKey = Object.keys(response_data)[0];
                		response_data = response_data[namespaceKey];
                
                		return response_data;
                	},
                
                	itemsCount: function (response_data) {
                		const last_page_number = /<[^>]+page=(\d+)>;\s*rel="last"/i;
                
                		if (response_data.headers.link){
                			return response_data.headers.link.match(last_page_number)[1];
                		}
                
                		return response_data.data.length;
                	}
                }
                
                try {
                	github.setParams(JSON.parse(value), ['repo_owner', 'repo_name', 'api_query']);
                
                	var result = github.apiRequest(github.params.api_url + github.params.api_query + '?' + github.params.query_params || '', github.params.pagination_required);
                
                	return github.itemsCount(result);
                }
                catch (error) {
                	error += (String(error).endsWith('.')) ? '' : '.';
                	Zabbix.log(3, '[ GitHub Repo ] ERROR: ' + error);
                	return JSON.stringify({ error: error });
                }
              description: |
                Get the number of commits in the branch.
                
                Information about endpoint:
                https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#list-commits
              preprocessing:
                - type: CHECK_REGEX_ERROR
                  parameters:
                    - 'API rate limit exceeded'
                    - \0
                  error_handler: DISCARD_VALUE
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              timeout: '{$GITHUB.TIMEOUT:"get_commits_count:{#BRANCH_NAME}"}'
              parameters:
                - name: api_query
                  value: 'repos/{$GITHUB.REPO.OWNER}/{$GITHUB.REPO.NAME}/commits'
                - name: api_token
                  value: '{$GITHUB.API.TOKEN}'
                - name: api_url
                  value: '{$GITHUB.API.URL}'
                - name: api_version
                  value: '{$GITHUB.API_VERSION}'
                - name: http_proxy
                  value: '{$GITHUB.HTTP_PROXY}'
                - name: pagination_required
                  value: 'false'
                - name: query_params
                  value: 'sha={#BRANCH_NAME}&per_page=1'
                - name: repo_name
                  value: '{$GITHUB.REPO.NAME}'
                - name: repo_owner
                  value: '{$GITHUB.REPO.OWNER}'
                - name: user_agent
                  value: '{$GITHUB.USER_AGENT}'
              tags:
                - tag: branch
                  value: '{#BRANCH_NAME}'
                - tag: component
                  value: branch
                - tag: component
                  value: commit
          graph_prototypes:
            - uuid: 369c8e6bf49b4b348258d77126386769
              name: 'Branch [{#BRANCH_NAME}]: Number of commits'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'GitHub repository by HTTP'
                    key: 'github.repo.branches.commits.total[{#BRANCH_NAME}]'
          master_item:
            key: github.repo.branches.get
          lld_macro_paths:
            - lld_macro: '{#BRANCH_NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data
        - uuid: 8a3dbc58ccd845bbb92a671997a3bbec
          name: 'Discovery of community profile metrics'
          type: DEPENDENT
          key: github.repo.community_profile.discovery
          description: |
            Discovers community profile metrics (the repository must not be a fork).
            
            Information about community profile metrics:
            https://docs.github.com/en/rest/metrics/community?apiVersion=2022-11-28#get-community-profile-metrics
          item_prototypes:
            - uuid: 8babff453a0a4df597436d3c9dd3112f
              name: 'Health percentage score'
              type: DEPENDENT
              key: 'github.repo.repository.health[{#SINGLETON}]'
              units: '%'
              description: |
                The health percentage score is defined as a percentage of how many of the recommended community health files are present.
                
                For more information, see the documentation:
                https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/about-community-profiles-for-public-repositories
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.data..zbx_community_profile.health_percentage.first()
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: github.repo.repository.get
              tags:
                - tag: component
                  value: health
          graph_prototypes:
            - uuid: d3234c15dc844899ae1bdd473229279f
              name: 'Health percentage score{#SINGLETON}'
              ymin_type_1: FIXED
              ymax_type_1: FIXED
              graph_items:
                - color: 199C0D
                  item:
                    host: 'GitHub repository by HTTP'
                    key: 'github.repo.repository.health[{#SINGLETON}]'
          master_item:
            key: github.repo.repository.get
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  return JSON.stringify(JSON.parse(value).data[0].zbx_community_profile
                  	? [{'{#SINGLETON}': ''}] : []);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: b77b33e77ddb457d9fd7912f97f179fd
          name: 'Self-hosted runner discovery'
          type: DEPENDENT
          key: github.repo.runners.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#RUNNER_NAME}'
                value: '{$GITHUB.RUNNER.NAME.MATCHES}'
              - macro: '{#RUNNER_NAME}'
                value: '{$GITHUB.RUNNER.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#RUNNER_OS}'
                value: '{$GITHUB.RUNNER.OS.MATCHES}'
              - macro: '{#RUNNER_OS}'
                value: '{$GITHUB.RUNNER.OS.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: |
            Discovers self-hosted runners of the repository.
            
            Note that admin access to the repository is required to use this endpoint:
            https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-a-repository
          item_prototypes:
            - uuid: 6cf4664f14744eb88eaee6e82330cd79
              name: 'Runner [{#RUNNER_NAME}]: Busy'
              type: DEPENDENT
              key: 'github.repo.runners.busy[{#RUNNER_NAME}]'
              trends: '0'
              description: 'Indicates whether the runner is currently executing a job.'
              valuemap:
                name: Boolean
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.data[?(@.id == "{#RUNNER_ID}")].busy.first()'
                - type: BOOL_TO_DECIMAL
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: github.repo.runners.get
              tags:
                - tag: component
                  value: runner
                - tag: os
                  value: '{#RUNNER_OS}'
                - tag: runner
                  value: '{#RUNNER_NAME}'
            - uuid: 7594ae484e72433ca4259bebc9044031
              name: 'Runner [{#RUNNER_NAME}]: Online'
              type: DEPENDENT
              key: 'github.repo.runners.online[{#RUNNER_NAME}]'
              trends: '0'
              description: 'Indicates whether the runner is connected to GitHub and is ready to execute jobs.'
              valuemap:
                name: Boolean
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.data[?(@.id == "{#RUNNER_ID}")].status.first()'
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const idx = [
                      	'offline',
                      	'online'
                      ].indexOf(value);
                      
                      return idx !== -1 ? idx : 10;
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: github.repo.runners.get
              tags:
                - tag: component
                  value: runner
                - tag: os
                  value: '{#RUNNER_OS}'
                - tag: runner
                  value: '{#RUNNER_NAME}'
              trigger_prototypes:
                - uuid: 3759039884e6486fb92f2a5abf7b1133
                  expression: 'last(/GitHub repository by HTTP/github.repo.runners.online[{#RUNNER_NAME}],#2)=1 and last(/GitHub repository by HTTP/github.repo.runners.online[{#RUNNER_NAME}])=0'
                  name: 'GitHub: Runner [{#RUNNER_NAME}]: The runner has become offline'
                  priority: WARNING
                  description: 'The runner was online previously, but is currently not connected to GitHub. This could be because the machine is offline, the self-hosted runner application is not running on the machine, or the self-hosted runner application cannot communicate with GitHub.'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: github.repo.runners.get
          lld_macro_paths:
            - lld_macro: '{#RUNNER_ID}'
              path: $.id
            - lld_macro: '{#RUNNER_NAME}'
              path: $.name
            - lld_macro: '{#RUNNER_OS}'
              path: $.os
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - |
                  var runners = JSON.parse(value);
                  
                  result = runners.map(function (runner) {
                  	return {
                  		'name': runner.name,
                  		'id': runner.id,
                  		'os': runner.os
                  	};
                  });
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
        - uuid: df2e23b12f914d7d89c182ff451da054
          name: 'Workflow discovery'
          type: DEPENDENT
          key: github.repo.workflows.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#WORKFLOW_NAME}'
                value: '{$GITHUB.WORKFLOW.NAME.MATCHES}'
              - macro: '{#WORKFLOW_NAME}'
                value: '{$GITHUB.WORKFLOW.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#WORKFLOW_STATE}'
                value: '{$GITHUB.WORKFLOW.STATE.MATCHES}'
              - macro: '{#WORKFLOW_STATE}'
                value: '{$GITHUB.WORKFLOW.STATE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: |
            Discovers repository workflows. By default, only the active workflows are discovered.
            
            Information about endpoint:
            https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#list-repository-workflows
          item_prototypes:
            - uuid: f9941fc67aca404ebd4eddd80d6066cb
              name: 'Workflow [{#WORKFLOW_NAME}]: Last run conclusion'
              type: DEPENDENT
              key: 'github.repo.workflows.last_run.conclusion[{#WORKFLOW_NAME}]'
              trends: '0'
              description: |
                The conclusion of the last workflow run. Possible values:
                
                0 - success
                1 - failure
                2 - neutral
                3 - cancelled
                4 - skipped
                5 - timed_out
                6 - action_required
                10 - unknown
              valuemap:
                name: 'Workflow run conclusion'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.conclusion
                - type: JAVASCRIPT
                  parameters:
                    - |
                      if (value !== 'null') {
                      	const idx = [
                      		'success',
                      		'failure',
                      		'neutral',
                      		'cancelled',
                      		'skipped',
                      		'timed_out',
                      		'action_required',
                      	].indexOf(value);
                      
                      	return idx !== -1 ? idx : 10;
                      }
                      
                      return null;
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'github.repo.workflows.last_run.get[{#WORKFLOW_NAME}]'
              tags:
                - tag: component
                  value: health
                - tag: component
                  value: workflow
                - tag: workflow
                  value: '{#WORKFLOW_NAME}'
              trigger_prototypes:
                - uuid: 4a32968c1bf14ac8a47f8f398ce43ea3
                  expression: 'last(/GitHub repository by HTTP/github.repo.workflows.last_run.conclusion[{#WORKFLOW_NAME}])=1'
                  name: 'GitHub: Workflow [{#WORKFLOW_NAME}]: The workflow has failed'
                  priority: WARNING
                  description: 'The last workflow run has returned a "failure" conclusion.'
                  tags:
                    - tag: scope
                      value: performance
            - uuid: 8653f8c233af44a7857b8ae58086edf3
              name: 'Workflow [{#WORKFLOW_NAME}]: Last run duration'
              type: DEPENDENT
              key: 'github.repo.workflows.last_run.duration[{#WORKFLOW_NAME}]'
              units: s
              description: 'The duration of the last workflow run.'
              preprocessing:
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const data = JSON.parse(value);
                      
                      const start_date = Math.floor(new Date(data.run_started_at) / 1000),
                      	  update_date = Math.floor(new Date(data.updated_at) / 1000);
                      
                      return (update_date - start_date);
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'github.repo.workflows.last_run.get[{#WORKFLOW_NAME}]'
              tags:
                - tag: component
                  value: workflow
                - tag: workflow
                  value: '{#WORKFLOW_NAME}'
            - uuid: 32311fa69236401388321fad4ae183d6
              name: 'Workflow [{#WORKFLOW_NAME}]: Get last run'
              type: SCRIPT
              key: 'github.repo.workflows.last_run.get[{#WORKFLOW_NAME}]'
              delay: '{$GITHUB.INTERVAL:"get_last_run:{#WORKFLOW_NAME}"}'
              history: '0'
              value_type: TEXT
              params: |
                var github = {
                	params: {},
                
                	setParams: function (params, required) {
                		required = required || [];
                		required.concat(['api_url', 'user_agent', 'api_version', 'pagination_required', 'api_token']).forEach(function (field) {
                			if (typeof params !== 'object' || typeof params[field] === 'undefined'
                				|| params[field] === '') {
                				throw 'Required parameter is not set: "' + field + '".';
                			}
                		});
                
                		github.params = params;
                
                		if (typeof github.params.api_url === 'string' && !github.params.api_url.endsWith('/')) {
                			github.params.api_url += '/';
                		}
                	},
                
                	apiRequest: function (url, pagination_required) {
                		const next_pattern = /<([^>]+)>;\s*rel="next"/i;
                		var request = new HttpRequest(),
                			response,
                			headers,
                			final_data = {
                				headers: {},
                				data: []
                			};
                
                		pagination_required = (typeof pagination_required !== 'undefined') ? pagination_required : 'true';
                
                		request.addHeader('User-Agent: ' + github.params.user_agent);
                		request.addHeader('Accept: application/vnd.github+json');
                		request.addHeader('X-GitHub-Api-Version: ' + github.params.api_version);
                		request.addHeader('Authorization: Bearer ' + github.params.api_token);
                
                		if (typeof github.params.http_proxy !== 'undefined' && github.params.http_proxy !== '') {
                			request.setProxy(github.params.http_proxy);
                			Zabbix.log(4, '[ GitHub Repo ] Using HTTP proxy: ' + github.params.http_proxy);
                		}
                
                		while (url) {
                			Zabbix.log(4, '[ GitHub Repo ] Sending request: ' + url);
                
                			response = request.get(url);
                
                			Zabbix.log(4, '[ GitHub Repo ] Received response with status code ' + request.getStatus() + ': ' + response);
                
                			if (request.getStatus() < 200 || request.getStatus() >= 300) {
                				throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
                			}
                
                			try {
                				response = JSON.parse(response);
                			}
                			catch (error) {
                				throw 'Failed to parse response received from API. Check debug log for more information.';
                			}
                
                			var parsed_data = github.parseData(response);
                			final_data.data = final_data.data.concat(parsed_data);
                
                			headers = request.getHeaders();
                
                			url = ((headers.link || '').match(next_pattern) || [])[1];
                
                			if (pagination_required === 'false') {
                				url = '';
                			}
                		}
                
                		final_data.headers = request.getHeaders();
                
                		delete request;
                
                		return final_data;
                	},
                
                	parseData: function (response_data) {
                		if (!response_data) {
                			return [];
                		}
                
                		const normalization_required = "total_count" in response_data && !("url" in response_data);
                		if (!normalization_required) return response_data;
                
                		delete response_data.incomplete_results;
                		delete response_data.repository_selection;
                		delete response_data.total_count;
                
                		const namespaceKey = Object.keys(response_data)[0];
                		response_data = response_data[namespaceKey];
                
                		return response_data;
                	},
                
                	itemsCount: function (response_data) {
                		const last_page_number = /<[^>]+page=(\d+)>;\s*rel="last"/i;
                
                		if (response_data.headers.link){
                			return response_data.headers.link.match(last_page_number)[1];
                		}
                
                		return response_data.data.length;
                	}
                }
                
                try {
                	github.setParams(JSON.parse(value), ['repo_owner', 'repo_name', 'api_query']);
                
                	var result = github.apiRequest(github.params.api_url + github.params.api_query + '?' + github.params.query_params || '', github.params.pagination_required);
                
                	return JSON.stringify(result);
                }
                catch (error) {
                	error += (String(error).endsWith('.')) ? '' : '.';
                	Zabbix.log(3, '[ GitHub Repo ] ERROR: ' + error);
                	return JSON.stringify({ error: error });
                }
              description: |
                Get the data about the last workflow run.
                
                Information about endpoint:
                https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-workflow
              preprocessing:
                - type: CHECK_REGEX_ERROR
                  parameters:
                    - 'API rate limit exceeded'
                    - \0
                  error_handler: DISCARD_VALUE
                - type: JSONPATH
                  parameters:
                    - $.data.first()
              timeout: '{$GITHUB.TIMEOUT:"get_last_run:{#WORKFLOW_NAME}"}'
              parameters:
                - name: api_query
                  value: 'repos/{$GITHUB.REPO.OWNER}/{$GITHUB.REPO.NAME}/actions/workflows/{#WORKFLOW_ID}/runs'
                - name: api_token
                  value: '{$GITHUB.API.TOKEN}'
                - name: api_url
                  value: '{$GITHUB.API.URL}'
                - name: api_version
                  value: '{$GITHUB.API_VERSION}'
                - name: http_proxy
                  value: '{$GITHUB.HTTP_PROXY}'
                - name: pagination_required
                  value: 'false'
                - name: query_params
                  value: per_page=1
                - name: repo_name
                  value: '{$GITHUB.REPO.NAME}'
                - name: repo_owner
                  value: '{$GITHUB.REPO.OWNER}'
                - name: user_agent
                  value: '{$GITHUB.USER_AGENT}'
              tags:
                - tag: component
                  value: raw
                - tag: component
                  value: workflow
                - tag: workflow
                  value: '{#WORKFLOW_NAME}'
            - uuid: f8bebdb8345b41c48cfd7be9554d82bf
              name: 'Workflow [{#WORKFLOW_NAME}]: Last run start date'
              type: DEPENDENT
              key: 'github.repo.workflows.last_run.start_date[{#WORKFLOW_NAME}]'
              trends: '0'
              units: unixtime
              description: 'The date when the last workflow run was started.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.run_started_at
                - type: JAVASCRIPT
                  parameters:
                    - 'return Math.floor(new Date(value) / 1000);'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'github.repo.workflows.last_run.get[{#WORKFLOW_NAME}]'
              tags:
                - tag: component
                  value: workflow
                - tag: workflow
                  value: '{#WORKFLOW_NAME}'
            - uuid: e23ba9f5d20541d594748d01491a7ea7
              name: 'Workflow [{#WORKFLOW_NAME}]: Last run status'
              type: DEPENDENT
              key: 'github.repo.workflows.last_run.status[{#WORKFLOW_NAME}]'
              trends: '0'
              description: |
                The status of the last workflow run. Possible values:
                
                0 - queued
                1 - in_progress
                2 - completed
                10 - unknown
              valuemap:
                name: 'Workflow run status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const idx = [
                      	'queued',
                      	'in_progress',
                      	'completed'
                      ].indexOf(value);
                      
                      return idx !== -1 ? idx : 10;
              master_item:
                key: 'github.repo.workflows.last_run.get[{#WORKFLOW_NAME}]'
              tags:
                - tag: component
                  value: health
                - tag: component
                  value: workflow
                - tag: workflow
                  value: '{#WORKFLOW_NAME}'
              trigger_prototypes:
                - uuid: d89658cb7d8c4b75a8f526dee6dcf43f
                  expression: 'last(/GitHub repository by HTTP/github.repo.workflows.last_run.status[{#WORKFLOW_NAME}])=1 and changecount(/GitHub repository by HTTP/github.repo.workflows.last_run.status[{#WORKFLOW_NAME}],{$GITHUB.WORKFLOW.STATUS.IN_PROGRESS.THRESH:"workflow_in_progress:{#WORKFLOW_NAME}"})=0'
                  name: 'GitHub: Workflow [{#WORKFLOW_NAME}]: The workflow has been in progress for too long'
                  event_name: 'GitHub: Workflow [{#WORKFLOW_NAME}]: The workflow has been in progress for too long (over {$GITHUB.WORKFLOW.STATUS.IN_PROGRESS.THRESH:"workflow_in_progress:{#WORKFLOW_NAME}"})'
                  priority: WARNING
                  description: 'The last workflow run has been in the "in_progress" status for too long. The default threshold is provided as an example and can be adjusted for relevant workflows with context macros.'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: performance
                - uuid: f98d0332c53a453bb737f436a4f0d2c0
                  expression: 'last(/GitHub repository by HTTP/github.repo.workflows.last_run.status[{#WORKFLOW_NAME}])=0 and changecount(/GitHub repository by HTTP/github.repo.workflows.last_run.status[{#WORKFLOW_NAME}],{$GITHUB.WORKFLOW.STATUS.QUEUED.THRESH:"workflow_queued:{#WORKFLOW_NAME}"})=0'
                  name: 'GitHub: Workflow [{#WORKFLOW_NAME}]: The workflow has been in the queue for too long'
                  event_name: 'GitHub: Workflow [{#WORKFLOW_NAME}]: The workflow has been in the queue for too long (over {$GITHUB.WORKFLOW.STATUS.QUEUED.THRESH:"workflow_queued:{#WORKFLOW_NAME}"})'
                  priority: WARNING
                  description: 'The last workflow run has been in the "queued" status for too long. This may mean that it has failed to be assigned to a runner. The default threshold is provided as an example and can be adjusted for relevant workflows with context macros.'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: performance
            - uuid: a187f9ea480341288b422168f6345784
              name: 'Workflow [{#WORKFLOW_NAME}]: Last run update date'
              type: DEPENDENT
              key: 'github.repo.workflows.last_run.update_date[{#WORKFLOW_NAME}]'
              trends: '0'
              units: unixtime
              description: 'The date when the last workflow run was updated.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.updated_at
                - type: JAVASCRIPT
                  parameters:
                    - 'return Math.floor(new Date(value) / 1000);'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: 'github.repo.workflows.last_run.get[{#WORKFLOW_NAME}]'
              tags:
                - tag: component
                  value: workflow
                - tag: workflow
                  value: '{#WORKFLOW_NAME}'
          master_item:
            key: github.repo.workflows.get
          lld_macro_paths:
            - lld_macro: '{#WORKFLOW_ID}'
              path: $.id
            - lld_macro: '{#WORKFLOW_NAME}'
              path: $.name
            - lld_macro: '{#WORKFLOW_STATE}'
              path: $.state
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.data
      tags:
        - tag: class
          value: software
        - tag: subclass
          value: communication
        - tag: subclass
          value: development
        - tag: target
          value: github
        - tag: target
          value: repository
      macros:
        - macro: '{$GITHUB.API.TOKEN}'
          type: SECRET_TEXT
          description: 'Set the access token here.'
          config:
            type: TEXT
            priority: '6'
            label: 'Access token'
            description: 'Set the access token here.'
            required: 'YES'
        - macro: '{$GITHUB.API.URL}'
          value: 'https://api.github.com/'
          description: 'Set the API URL here.'
          config:
            type: TEXT
            priority: '1'
            label: 'API URL'
            description: 'Set the API URL here.'
            required: 'YES'
        - macro: '{$GITHUB.API_VERSION}'
          value: '2022-11-28'
          description: 'The API version that is used in headers for HTTP requests.'
          config:
            type: TEXT
            priority: '3'
            label: 'API version'
            description: 'The API version that is used in headers for HTTP requests.'
        - macro: '{$GITHUB.BRANCH.NAME.MATCHES}'
          value: .+
          description: 'The repository branch name regex filter to use in branch-related metric discovery - for including.'
          config:
            type: TEXT
            priority: '21'
            section_name: Filters
            label: 'Branch name filter (include)'
            description: 'The repository branch name regex filter to use in branch-related metric discovery - for including.'
        - macro: '{$GITHUB.BRANCH.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'The repository branch name regex filter to use in branch-related metric discovery - for excluding.'
          config:
            type: TEXT
            priority: '22'
            section_name: Filters
            label: 'Branch name filter (exclude)'
            description: 'The repository branch name regex filter to use in branch-related metric discovery - for excluding.'
        - macro: '{$GITHUB.HTTP_PROXY}'
          description: 'The HTTP proxy for script items (set if needed). If the macro is empty, then no proxy is used.'
          config:
            type: TEXT
            priority: '15'
            section_name: Other
            label: 'HTTP proxy'
            description: 'The HTTP proxy for script items (set if needed). If the macro is empty, then no proxy is used.'
        - macro: '{$GITHUB.INTERVAL}'
          value: 1m
          description: 'The update interval for the script items that retrieve data from the API. Can be used with context if needed (check the context values in relevant items).'
          config:
            type: TEXT
            priority: '7'
            section_name: Other
            label: 'Data update interval'
            description: 'The update interval for the script items that retrieve data from the API. Can be used with context if needed (check the context values in relevant items).'
        - macro: '{$GITHUB.INTERVAL:"get_(branches|workflows)"}'
          value: 1h
          description: 'The update interval for the script items that retrieve the branches and workflows. Used only for related metric discovery.'
          config:
            type: TEXT
            priority: '10'
            section_name: Other
            label: 'Branches/workflows update interval'
            description: 'The update interval for the script items that retrieve the branches and workflows. Used only for related metric discovery.'
        - macro: '{$GITHUB.INTERVAL:"get_repo"}'
          value: 15m
          description: 'The update interval for the script item that retrieves the repository information.'
          config:
            type: TEXT
            priority: '9'
            section_name: Other
            label: 'Repository info update interval'
            description: 'The update interval for the script item that retrieves the repository information.'
        - macro: '{$GITHUB.INTERVAL:"get_runners"}'
          value: 15m
          description: 'The update interval for the script item that retrieves the information about self-hosted runners.'
          config:
            type: TEXT
            priority: '11'
            section_name: Other
            label: 'Self-hosted runners info update interval'
            description: 'The update interval for the script item that retrieves the information about self-hosted runners.'
        - macro: '{$GITHUB.INTERVAL:regex:"get_(tags|releases|issues)_count"}'
          value: 1h
          description: 'The update interval for the script items that retrieve the number of tags, releases, issues, and pull requests (total, open, closed).'
          config:
            type: TEXT
            priority: '8'
            section_name: Other
            label: 'Tags/releases/issues update interval'
            description: 'The update interval for the script items that retrieve the number of tags, releases, issues, and pull requests (total, open, closed).'
        - macro: '{$GITHUB.INTERVAL:regex:"get_commits_count:.+"}'
          value: 1h
          description: 'The update interval for the script items that retrieve the commits count in discovered branches.'
          config:
            type: TEXT
            priority: '13'
            section_name: Other
            label: 'Commits count update interval'
            description: 'The update interval for the script items that retrieve the commits count in discovered branches.'
        - macro: '{$GITHUB.INTERVAL:regex:"get_last_run:.+"}'
          value: 15m
          description: 'The update interval for the script items that retrieve the information about the last workflow run results.'
          config:
            type: TEXT
            priority: '12'
            section_name: Other
            label: 'Workflow run results update interval'
            description: 'The update interval for the script items that retrieve the information about the last workflow run results.'
        - macro: '{$GITHUB.REPO.NAME}'
          description: 'Set the repository name here.'
          config:
            type: TEXT
            priority: '5'
            label: 'Repository name'
            description: 'Set the repository name here.'
            required: 'YES'
        - macro: '{$GITHUB.REPO.OWNER}'
          description: 'Set the repository owner here.'
          config:
            type: TEXT
            priority: '4'
            label: 'Repository owner'
            description: 'Set the repository owner here.'
            required: 'YES'
        - macro: '{$GITHUB.REQUESTS.UTIL.HIGH}'
          value: '90'
          description: 'The threshold percentage of utilized API requests in a High trigger expression.'
          config:
            type: TEXT
            priority: '28'
            section_name: Thresholds
            label: 'API usage high threshold (%)'
            description: 'The threshold percentage of utilized API requests in a High trigger expression. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$GITHUB.REQUESTS.UTIL.WARN}'
          value: '80'
          description: 'The threshold percentage of utilized API requests in a Warning trigger expression.'
          config:
            type: TEXT
            priority: '27'
            section_name: Thresholds
            label: 'API usage warning threshold (%)'
            description: 'The threshold percentage of utilized API requests in a Warning trigger expression. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$GITHUB.RESULTS_PER_PAGE}'
          value: '100'
          description: 'The number of results to fetch per page. Can be used with context and adjusted if needed (check the context values in script parameters of relevant items).'
          config:
            type: TEXT
            priority: '16'
            section_name: Other
            label: 'Results per page'
            description: 'The number of results to fetch per page. Can be used with context and adjusted if needed (check the context values in script parameters of relevant items).'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$GITHUB.RUNNER.NAME.MATCHES}'
          value: .+
          description: 'The repository self-hosted runner name regex filter to use in discovering metrics related to the self-hosted runner - for including.'
          config:
            type: TEXT
            priority: '23'
            section_name: Filters
            label: 'Self-hosted runner name filter (include)'
            description: 'The repository self-hosted runner name regex filter to use in discovering metrics related to the self-hosted runner - for including.'
        - macro: '{$GITHUB.RUNNER.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'The repository self-hosted runner name regex filter to use in discovering metrics related to the self-hosted runner - for excluding.'
          config:
            type: TEXT
            priority: '24'
            section_name: Filters
            label: 'Self-hosted runner name filter (exclude)'
            description: 'The repository self-hosted runner name regex filter to use in discovering metrics related to the self-hosted runner - for excluding.'
        - macro: '{$GITHUB.RUNNER.OS.MATCHES}'
          value: .+
          description: 'The repository self-hosted runner OS regex filter to use in discovering metrics related to the self-hosted runner - for including.'
          config:
            type: TEXT
            priority: '25'
            section_name: Filters
            label: 'Self-hosted runner OS filter (include)'
            description: 'The repository self-hosted runner OS regex filter to use in discovering metrics related to the self-hosted runner - for including.'
        - macro: '{$GITHUB.RUNNER.OS.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'The repository self-hosted runner OS regex filter to use in discovering metrics related to the self-hosted runner - for excluding.'
          config:
            type: TEXT
            priority: '26'
            section_name: Filters
            label: 'Self-hosted runner OS filter (exclude)'
            description: 'The repository self-hosted runner OS regex filter to use in discovering metrics related to the self-hosted runner - for excluding.'
        - macro: '{$GITHUB.TIMEOUT}'
          value: 15s
          description: 'The timeout threshold for the script items that retrieve data from the API. Can be used with context if needed (check the context values in relevant items).'
          config:
            type: TEXT
            priority: '14'
            section_name: Other
            label: 'API timeout'
            description: 'The timeout threshold for the script items that retrieve data from the API. Can be used with context if needed (check the context values in relevant items).'
        - macro: '{$GITHUB.USER_AGENT}'
          value: Zabbix/8.0
          description: 'The user agent that is used in headers for HTTP requests.'
          config:
            type: TEXT
            priority: '2'
            label: 'HTTP user agent'
            description: 'The user agent that is used in headers for HTTP requests.'
        - macro: '{$GITHUB.WORKFLOW.NAME.MATCHES}'
          value: .+
          description: 'The repository workflow name regex filter to use in workflow-related metric discovery - for including.'
          config:
            type: TEXT
            priority: '17'
            section_name: Filters
            label: 'Workflow name filter (include)'
            description: 'The repository workflow name regex filter to use in workflow-related metric discovery - for including.'
        - macro: '{$GITHUB.WORKFLOW.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'The repository workflow name regex filter to use in workflow-related metric discovery - for excluding.'
          config:
            type: TEXT
            priority: '18'
            section_name: Filters
            label: 'Workflow name filter (exclude)'
            description: 'The repository workflow name regex filter to use in workflow-related metric discovery - for excluding.'
        - macro: '{$GITHUB.WORKFLOW.STATE.MATCHES}'
          value: active
          description: 'The repository workflow state regex filter to use in workflow-related metric discovery - for including.'
          config:
            type: TEXT
            priority: '19'
            section_name: Filters
            label: 'Workflow state filter (include)'
            description: 'The repository workflow state regex filter to use in workflow-related metric discovery - for including.'
        - macro: '{$GITHUB.WORKFLOW.STATE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'The repository workflow state regex filter to use in workflow-related metric discovery - for excluding.'
          config:
            type: TEXT
            priority: '20'
            section_name: Filters
            label: 'Workflow state filter (exclude)'
            description: 'The repository workflow state regex filter to use in workflow-related metric discovery - for excluding.'
        - macro: '{$GITHUB.WORKFLOW.STATUS.IN_PROGRESS.THRESH}'
          value: 24h
          description: 'The time threshold used in the trigger of a workflow run that has been in the queue for too long. Can be used with context if needed.'
          config:
            type: TEXT
            priority: '30'
            section_name: Thresholds
            label: 'Workflow queue time high threshold'
            description: 'The time threshold used in the trigger of a workflow run that has been in the queue for too long. Can be used with context if needed.'
        - macro: '{$GITHUB.WORKFLOW.STATUS.QUEUED.THRESH}'
          value: 1h
          description: 'The time threshold used in the trigger of a workflow run that has been in the queue for too long. Can be used with context if needed.'
          config:
            type: TEXT
            priority: '29'
            section_name: Thresholds
            label: 'Workflow queue time warning threshold'
            description: 'The time threshold used in the trigger of a workflow run that has been in the queue for too long. Can be used with context if needed.'
      dashboards:
        - uuid: 09870c778f4740da8430b1383225b2c6
          name: 'Repository overview'
          auto_start: 'NO'
          pages:
            - name: 'Repository statistics'
              widgets:
                - type: item
                  name: Size
                  width: '10'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: description
                      value: Size
                    - type: INTEGER
                      name: desc_bold
                      value: '1'
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.repository.size
                    - type: INTEGER
                      name: show.0
                      value: '1'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                    - type: INTEGER
                      name: units_bold
                      value: '0'
                - type: item
                  name: Releases
                  'y': '2'
                  width: '10'
                  hide_header: 'YES'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: Releases
                    - type: INTEGER
                      name: desc_bold
                      value: '1'
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.releases.count
                    - type: INTEGER
                      name: show.0
                      value: '1'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                    - type: INTEGER
                      name: units_show
                      value: '0'
                - type: item
                  name: Stargazers
                  'y': '4'
                  width: '10'
                  hide_header: 'YES'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: Stargazers
                    - type: INTEGER
                      name: desc_bold
                      value: '1'
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.repository.stargazers
                    - type: INTEGER
                      name: show.0
                      value: '1'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                    - type: INTEGER
                      name: units_show
                      value: '0'
                - type: item
                  name: 'Open issues'
                  'y': '6'
                  width: '10'
                  height: '4'
                  hide_header: 'YES'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Open issues'
                    - type: INTEGER
                      name: desc_bold
                      value: '1'
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.issues.open
                    - type: INTEGER
                      name: show.0
                      value: '1'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                    - type: INTEGER
                      name: show.2
                      value: '4'
                    - type: INTEGER
                      name: units_show
                      value: '0'
                - type: item
                  name: 'Open PRs'
                  'y': '10'
                  width: '10'
                  height: '4'
                  hide_header: 'YES'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Open PRs'
                    - type: INTEGER
                      name: desc_bold
                      value: '1'
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.pr.open
                    - type: INTEGER
                      name: show.0
                      value: '1'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                    - type: INTEGER
                      name: show.2
                      value: '4'
                    - type: INTEGER
                      name: units_show
                      value: '0'
                - type: svggraph
                  name: 'Requests limit usage'
                  'y': '14'
                  width: '36'
                  height: '5'
                  fields:
                    - type: STRING
                      name: ds.0.color.0
                      value: FF465C
                    - type: STRING
                      name: ds.0.color.1
                      value: 4CAF50
                    - type: INTEGER
                      name: ds.0.dataset_type
                      value: '0'
                    - type: ITEM
                      name: ds.0.itemids.0
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.requests.limit
                    - type: ITEM
                      name: ds.0.itemids.1
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.requests.used
                    - type: INTEGER
                      name: ds.0.missingdatafunc
                      value: '1'
                    - type: INTEGER
                      name: ds.0.width
                      value: '2'
                    - type: INTEGER
                      name: legend_lines
                      value: '2'
                    - type: INTEGER
                      name: legend_statistic
                      value: '1'
                    - type: STRING
                      name: reference
                      value: RHXEN
                    - type: INTEGER
                      name: righty
                      value: '0'
                    - type: INTEGER
                      name: working_time
                      value: '1'
                - type: graphprototype
                  'y': '19'
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'GitHub repository by HTTP'
                        name: 'Health percentage score{#SINGLETON}'
                    - type: STRING
                      name: reference
                      value: QXEXC
                - type: item
                  name: Forks
                  x: '10'
                  width: '9'
                  hide_header: 'YES'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: Forks
                    - type: INTEGER
                      name: desc_bold
                      value: '1'
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.repository.forks.count
                    - type: INTEGER
                      name: show.0
                      value: '1'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                    - type: INTEGER
                      name: units_show
                      value: '0'
                - type: item
                  name: Tags
                  x: '10'
                  'y': '2'
                  width: '9'
                  hide_header: 'YES'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: Tags
                    - type: INTEGER
                      name: desc_bold
                      value: '1'
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.tags.count
                    - type: INTEGER
                      name: show.0
                      value: '1'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                    - type: INTEGER
                      name: units_show
                      value: '0'
                - type: item
                  name: Watchers
                  x: '10'
                  'y': '4'
                  width: '9'
                  hide_header: 'YES'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: Watchers
                    - type: INTEGER
                      name: desc_bold
                      value: '1'
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.repository.watchers
                    - type: INTEGER
                      name: show.0
                      value: '1'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                    - type: INTEGER
                      name: units_show
                      value: '0'
                - type: svggraph
                  name: Issues
                  x: '10'
                  'y': '6'
                  width: '62'
                  height: '4'
                  fields:
                    - type: STRING
                      name: ds.0.color.0
                      value: FFD54F
                    - type: STRING
                      name: ds.0.color.1
                      value: FF465C
                    - type: STRING
                      name: ds.0.color.2
                      value: 4CAF50
                    - type: INTEGER
                      name: ds.0.dataset_type
                      value: '0'
                    - type: ITEM
                      name: ds.0.itemids.0
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.issues.total
                    - type: ITEM
                      name: ds.0.itemids.1
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.issues.open
                    - type: ITEM
                      name: ds.0.itemids.2
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.issues.closed
                    - type: INTEGER
                      name: ds.0.missingdatafunc
                      value: '1'
                    - type: INTEGER
                      name: ds.0.width
                      value: '2'
                    - type: INTEGER
                      name: legend_lines
                      value: '3'
                    - type: INTEGER
                      name: legend_statistic
                      value: '1'
                    - type: STRING
                      name: reference
                      value: NDLZO
                    - type: INTEGER
                      name: righty
                      value: '0'
                    - type: INTEGER
                      name: working_time
                      value: '1'
                - type: svggraph
                  name: PRs
                  x: '10'
                  'y': '10'
                  width: '62'
                  height: '4'
                  fields:
                    - type: STRING
                      name: ds.0.color.0
                      value: FFD54F
                    - type: STRING
                      name: ds.0.color.1
                      value: FF465C
                    - type: STRING
                      name: ds.0.color.2
                      value: 4CAF50
                    - type: INTEGER
                      name: ds.0.dataset_type
                      value: '0'
                    - type: ITEM
                      name: ds.0.itemids.0
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.pr.total
                    - type: ITEM
                      name: ds.0.itemids.1
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.pr.open
                    - type: ITEM
                      name: ds.0.itemids.2
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.pr.closed
                    - type: INTEGER
                      name: ds.0.missingdatafunc
                      value: '1'
                    - type: INTEGER
                      name: ds.0.width
                      value: '2'
                    - type: INTEGER
                      name: legend_lines
                      value: '3'
                    - type: INTEGER
                      name: legend_statistic
                      value: '1'
                    - type: STRING
                      name: reference
                      value: SCQDP
                    - type: INTEGER
                      name: righty
                      value: '0'
                    - type: INTEGER
                      name: working_time
                      value: '1'
                - type: itemnavigator
                  name: Branches
                  x: '19'
                  width: '12'
                  height: '6'
                  fields:
                    - type: STRING
                      name: items.0
                      value: 'Branch [*]: Number of commits'
                    - type: STRING
                      name: reference
                      value: YXPRE
                - type: item
                  name: 'Number of commits'
                  x: '31'
                  width: '17'
                  height: '6'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: itemid._reference
                      value: YXPRE._itemid
                    - type: INTEGER
                      name: show.0
                      value: '2'
                - type: svggraph
                  name: 'Requests limit utilization, in %'
                  x: '36'
                  'y': '14'
                  width: '36'
                  height: '5'
                  fields:
                    - type: STRING
                      name: ds.0.color.0
                      value: 4CAF50
                    - type: INTEGER
                      name: ds.0.dataset_type
                      value: '0'
                    - type: ITEM
                      name: ds.0.itemids.0
                      value:
                        host: 'GitHub repository by HTTP'
                        key: github.repo.requests.util
                    - type: INTEGER
                      name: ds.0.missingdatafunc
                      value: '1'
                    - type: INTEGER
                      name: ds.0.width
                      value: '2'
                    - type: STRING
                      name: lefty_max
                      value: '100'
                    - type: STRING
                      name: lefty_min
                      value: '0'
                    - type: INTEGER
                      name: legend_statistic
                      value: '1'
                    - type: STRING
                      name: reference
                      value: MTFRC
                    - type: INTEGER
                      name: righty
                      value: '0'
                    - type: INTEGER
                      name: simple_triggers
                      value: '1'
                    - type: INTEGER
                      name: working_time
                      value: '1'
                - type: problems
                  x: '48'
                  width: '24'
                  height: '6'
                  fields:
                    - type: STRING
                      name: reference
                      value: UDUDX
            - name: 'Self-hosted runners'
              widgets:
                - type: honeycomb
                  name: 'Runners online'
                  width: '72'
                  height: '7'
                  fields:
                    - type: STRING
                      name: items.0
                      value: 'Runner [*]: Online'
                    - type: STRING
                      name: primary_label
                      value: '{ITEM.NAME}'
                    - type: STRING
                      name: reference
                      value: YSQRZ
                    - type: INTEGER
                      name: secondary_label_decimal_places
                      value: '0'
                    - type: INTEGER
                      name: secondary_label_units_show
                      value: '0'
                    - type: STRING
                      name: thresholds.0.color
                      value: FF465C
                    - type: STRING
                      name: thresholds.0.threshold
                      value: '0'
                    - type: STRING
                      name: thresholds.1.color
                      value: 4CAF50
                    - type: STRING
                      name: thresholds.1.threshold
                      value: '1'
                - type: honeycomb
                  name: 'Runners busy'
                  'y': '7'
                  width: '72'
                  height: '7'
                  fields:
                    - type: STRING
                      name: items.0
                      value: 'Runner [*]: Busy'
                    - type: STRING
                      name: primary_label
                      value: '{ITEM.NAME}'
                    - type: STRING
                      name: reference
                      value: ZYVGW
                    - type: INTEGER
                      name: secondary_label_decimal_places
                      value: '0'
                    - type: INTEGER
                      name: secondary_label_units_show
                      value: '0'
                    - type: STRING
                      name: thresholds.0.color
                      value: D2D2D2
                    - type: STRING
                      name: thresholds.0.threshold
                      value: '0'
                    - type: STRING
                      name: thresholds.1.color
                      value: 29B6F6
                    - type: STRING
                      name: thresholds.1.threshold
                      value: '1'
      valuemaps:
        - uuid: 21844e435a364b2f92d675f0967e115a
          name: Boolean
          mappings:
            - value: '0'
              newvalue: 'false'
            - value: '1'
              newvalue: 'true'
        - uuid: 9175771d066042c49ac1583c0e8689c6
          name: 'Workflow run conclusion'
          mappings:
            - value: '0'
              newvalue: success
            - value: '1'
              newvalue: failure
            - value: '2'
              newvalue: neutral
            - value: '3'
              newvalue: cancelled
            - value: '4'
              newvalue: skipped
            - value: '5'
              newvalue: timed_out
            - value: '6'
              newvalue: action_required
            - value: '10'
              newvalue: unknown
        - uuid: 9b86b16774094f5e9c06286b27f6f440
          name: 'Workflow run status'
          mappings:
            - value: '0'
              newvalue: queued
            - value: '1'
              newvalue: in_progress
            - value: '2'
              newvalue: completed
            - value: '10'
              newvalue: unknown
    - uuid: 0ffde4421f524bcbac2f47fec87c0f95
      template: 'HPE Synergy by HTTP'
      name: 'HPE Synergy by HTTP'
      description: |
        This template is designed to monitor HPE Synergy by HTTP.
        It works without any external scripts and uses the script item.
        
        Setup:
          1. Link template to the host.
          2. Set the hostname or IP address of the host in the {$HPE.SYNERGY.API.HOST} macro and configure the username and password in the {$HPE.SYNERGY.API.USERNAME} and {$HPE.SYNERGY.API.PASSWORD} macros.
          3. Change the {$HPE.SYNERGY.API.SCHEME} and {$HPE.SYNERGY.API.PORT} macros if needed.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        The template to monitor HPE Synergy by HTTP.
        It works without any external scripts and uses the script item.
        
        ## Setup
        
        1. Link template to the host.
        2. Set the hostname or IP address of the host in the `API host` and configure the username and password in the `API username` and `API password` host wizard configuration fields.
        3. Change the `API scheme` and `API port` host wizard configuration fields if needed.
      vendor:
        name: Zabbix
        version: 8.0-2
      groups:
        - name: 'Templates/Server hardware'
      items:
        - uuid: 2f9816e8a60149f4aafdf7ffb0632224
          name: 'Get data'
          type: SCRIPT
          key: hpe.synergy.get.data
          history: '0'
          value_type: TEXT
          params: |
            var Synergy = {
            	params: {},
            	session_id: null,
            	api_version: null,
            
            	setParams: function (params) {
            		['username', 'password', 'base_url', 'login_domain'].forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
            				throw 'Required param is not set: ' + field + '.';
            			}
            		});
            
            		Synergy.params = params;
            		if (typeof Synergy.params.base_url === 'string' && !Synergy.params.base_url.endsWith('/')) {
            			Synergy.params.base_url += '/';
            		}
            	},
            
            	checkVersion: function () {
            		if (Synergy.api_version !== null) {
            			return;
            		}
            
            		var response, request = new HttpRequest();
            		request.addHeader('Content-Type: application/json');
            
            		response = request.get(Synergy.params.base_url + 'rest/version');
            
            		if (request.getStatus() !== 200) {
            			throw 'Get version request failed with status code ' + request.getStatus() + ': ' + response;
            		}
            
            		if (response !== null) {
            			try {
            				version_data = JSON.parse(response);
            			}
            			catch (error) {
            				throw 'Failed to parse get version response received from device API.';
            			}
            		}
            		else {
            			throw 'No data received by get version request.';
            		}
            
            		if ('currentVersion' in version_data && 'minimumVersion' in version_data) {
            			if (version_data['minimumVersion'] <= 1200 && version_data['currentVersion'] >= 1200) {
            				Synergy.api_version = 1200;
            			} else {
            				throw 'API version is not supported.';
            			}
            		} else {
            			throw 'Get version response does not contain version.';
            		}
            	},
            
            	login: function () {
            		if (Synergy.session_id !== null || Synergy.api_version === null) {
            			return;
            		}
            
            		var response, request = new HttpRequest();
            		request.addHeader('Content-Type: application/json');
            		request.addHeader('X-API-Version: ' + Synergy.api_version);
            
            		response = request.post(Synergy.params.base_url + 'rest/login-sessions', JSON.stringify({
            			'userName': Synergy.params.username,
            			'password': Synergy.params.password,
            			'authLoginDomain': Synergy.params.login_domain,
            			'loginMsgAck': 'true'
            		}));
            
            		if (request.getStatus() !== 200) {
            			throw 'Auth request failed with status code ' + request.getStatus() + ': ' + response;
            		}
            
            		if (response !== null) {
            			try {
            				auth_data = JSON.parse(response);
            			}
            			catch (error) {
            				throw 'Failed to parse auth response received from device API.';
            			}
            		}
            		else {
            			throw 'No data received by auth request.';
            		}
            
            		if ('sessionID' in auth_data) {
            			Synergy.session_id = auth_data['sessionID'];
            		} else {
            			throw 'Auth response does not contain session ID.';
            		}
            	},
            
            	logout: function () {
            		if (Synergy.session_id !== null && Synergy.api_version !== null) {
            			var response, request = new HttpRequest();
            			request.addHeader('Content-Type: application/json');
            			request.addHeader('X-API-Version: ' + Synergy.api_version);
            			request.addHeader('Auth: ' + Synergy.session_id);
            			response = request.delete(Synergy.params.base_url + 'rest/login-sessions');
            		}
            	},
            
            	requestData: function (method) {
            		if (Synergy.session_id === null || Synergy.api_version === null) {
            			return;
            		}
            
            		request = new HttpRequest();
            		request.addHeader('Auth: ' + Synergy.session_id);
            		request.addHeader('X-API-Version: ' + Synergy.api_version);
            
            		raw_data = request.get(Synergy.params.base_url + 'rest/' + method);
            
            		if (request.getStatus() < 200 || request.getStatus() >= 300) {
            			throw 'Request failed with status code ' + request.getStatus() + ': ' + raw_data;
            		}
            
            		if (raw_data !== null) {
            			try {
            				return JSON.parse(raw_data);
            			}
            			catch (error) {
            				throw 'Failed to parse response received from device API.';
            			}
            		}
            		else {
            			throw 'No data received by ' + method + ' request.';
            		}
            	}
            };
            
            var methods = ['datacenters', 'enclosures', 'ethernet-networks', 'fabrics', 'fc-networks', 'hypervisor-managers', 'interconnects', 'logical-enclosures', 'racks', 'server-hardware', 'storage-pools', 'storage-systems', 'storage-volumes', 'uplink-sets'],
            	data = {};
            
            data['errors'] = {};
            
            try {
            	Synergy.setParams(JSON.parse(value));
            
            	try {
            		Synergy.checkVersion();
            	}
            	catch (error) {
            		data.errors.version = error.toString();
            	}
            
            	try {
            		Synergy.login();
            	}
            	catch (error) {
            		data.errors.auth = error.toString();
            	}
            
            	if (!('auth' in data.errors) && !('version' in data.errors)) {
            		for (var i in methods) {
            			try {
            				if (methods[i] === 'enclosures') {
            					var bays = ['applianceBays', 'crossBars', 'deviceBays', 'fanBays', 'partitions', 'powerSupplyBays', 'managerBays'];
            
            					enclosures = Synergy.requestData(methods[i]);
            
            					enclosures.members.forEach(function (enclosure) {
            						enclosure_name = enclosure.name;
            
            						for (var j in bays) {
            							bay = enclosure[bays[j]];
            
            							bay.forEach(function (b) {
            								b.enclosureName = enclosure_name;
            								enclosures.members[bays[j[b]]] = b;
            							});
            						}
            					});
            
            					data[methods[i]] = enclosures;
            				}
            				else {
            					data[methods[i]] = Synergy.requestData(methods[i]);
            				}
            			}
            			catch (error) {
            				data.errors[methods[i]] = error.toString();
            			}
            		}
            	}
            }
            catch (error) {
            	data.errors.params = error.toString();
            }
            
            try {
            	Synergy.logout();
            }
            catch (error) {
            }
            
            if (Object.keys(data.errors).length !== 0) {
            	errors = 'Failed to receive data:';
            	for (var error in data.errors) {
            		errors += '\n' + error + ' : ' + data.errors[error];
            	}
            	data.errors = errors;
            }
            else {
            	data.errors = '';
            }
            
            return JSON.stringify(data);
          description: 'The JSON with the result from requests to API.'
          timeout: '{$HPE.SYNERGY.DATA.TIMEOUT}'
          parameters:
            - name: base_url
              value: '{$HPE.SYNERGY.API.SCHEME}://{$HPE.SYNERGY.API.HOST}:{$HPE.SYNERGY.API.PORT}'
            - name: login_domain
              value: '{$HPE.SYNERGY.API.LOGIN_DOMAIN}'
            - name: password
              value: '{$HPE.SYNERGY.API.PASSWORD}'
            - name: username
              value: '{$HPE.SYNERGY.API.USERNAME}'
          tags:
            - tag: component
              value: raw
        - uuid: 03389ced2251456a98f56418f1fbc6c5
          name: 'Get datacenters data'
          type: DEPENDENT
          key: hpe.synergy.get.datacenters
          history: '0'
          value_type: TEXT
          description: 'Data of the datacenters.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.datacenters
              error_handler: DISCARD_VALUE
          master_item:
            key: hpe.synergy.get.data
          tags:
            - tag: component
              value: raw
        - uuid: 6a12ea452d444c8ca5aec2698709d979
          name: 'Get enclosures data'
          type: DEPENDENT
          key: hpe.synergy.get.enclosures
          history: '0'
          value_type: TEXT
          description: 'A list of enclosures.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.enclosures
              error_handler: DISCARD_VALUE
          master_item:
            key: hpe.synergy.get.data
          tags:
            - tag: component
              value: raw
        - uuid: c0049d63dffe4cdaafa806796051e06b
          name: 'Get errors'
          type: DEPENDENT
          key: hpe.synergy.get.errors
          value_type: TEXT
          description: 'A list of errors from API requests.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.errors
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: hpe.synergy.get.data
          tags:
            - tag: component
              value: raw
          triggers:
            - uuid: dba8cff13328403dae2cbda8f106b384
              expression: 'length(last(/HPE Synergy by HTTP/hpe.synergy.get.errors))>0'
              name: 'HPE Synergy: There are errors in requests to API'
              opdata: '{ITEM.LASTVALUE1}'
              priority: AVERAGE
              description: 'Zabbix has received errors from API.'
              dependencies:
                - name: 'HPE Synergy: Service is unavailable'
                  expression: 'max(/HPE Synergy by HTTP/net.tcp.service["{$HPE.SYNERGY.API.SCHEME}","{$HPE.SYNERGY.API.HOST}","{$HPE.SYNERGY.API.PORT}"],5m)=0'
              tags:
                - tag: scope
                  value: availability
        - uuid: 11b7e2c9c3ba4c71a2a5b165eea2c105
          name: 'Get ethernet networks data'
          type: DEPENDENT
          key: hpe.synergy.get.ethernet_networks
          history: '0'
          value_type: TEXT
          description: 'Data of the ethernet networks.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.["ethernet-networks"]'
              error_handler: DISCARD_VALUE
          master_item:
            key: hpe.synergy.get.data
          tags:
            - tag: component
              value: raw
        - uuid: d6d0a7fb1f0e47a792cd5197e2aa99b2
          name: 'Get fabrics data'
          type: DEPENDENT
          key: hpe.synergy.get.fabrics
          history: '0'
          value_type: TEXT
          description: 'Data of the fabrics.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.fabrics
              error_handler: DISCARD_VALUE
          master_item:
            key: hpe.synergy.get.data
          tags:
            - tag: component
              value: raw
        - uuid: 789012febb2c44af8cf01b83315f6e99
          name: 'Get FC networks data'
          type: DEPENDENT
          key: hpe.synergy.get.fc_networks
          history: '0'
          value_type: TEXT
          description: 'Data of the FC networks.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.["fc-networks"]'
              error_handler: DISCARD_VALUE
          master_item:
            key: hpe.synergy.get.data
          tags:
            - tag: component
              value: raw
        - uuid: 1b903d33f7ef481687db5f94a94123f5
          name: 'Get hypervisor managers data'
          type: DEPENDENT
          key: hpe.synergy.get.hypervisor_managers
          history: '0'
          value_type: TEXT
          description: 'Data of the hypervisor managers.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.["hypervisor-managers"]'
              error_handler: DISCARD_VALUE
          master_item:
            key: hpe.synergy.get.data
          tags:
            - tag: component
              value: raw
        - uuid: 9724a596f61241f297f5fa8fbd538ea0
          name: 'Get interconnects data'
          type: DEPENDENT
          key: hpe.synergy.get.interconnects
          history: '0'
          value_type: TEXT
          description: 'Data of the interconnects.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.interconnects
              error_handler: DISCARD_VALUE
          master_item:
            key: hpe.synergy.get.data
          tags:
            - tag: component
              value: raw
        - uuid: bff37f5e7576433e85991ca474aae7c8
          name: 'Get logical enclosures data'
          type: DEPENDENT
          key: hpe.synergy.get.logical_enclosures
          history: '0'
          value_type: TEXT
          description: 'Data of the logical enclosures.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.["logical-enclosures"]'
              error_handler: DISCARD_VALUE
          master_item:
            key: hpe.synergy.get.data
          tags:
            - tag: component
              value: raw
        - uuid: 5f44e9a2434e4773ab9d8c5664535a91
          name: 'Get racks data'
          type: DEPENDENT
          key: hpe.synergy.get.racks
          history: '0'
          value_type: TEXT
          description: 'Data of the racks.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.racks
              error_handler: DISCARD_VALUE
          master_item:
            key: hpe.synergy.get.data
          tags:
            - tag: component
              value: raw
        - uuid: 066eacd86e784308a0b3ed53c7fd2482
          name: 'Get server hardware data'
          type: DEPENDENT
          key: hpe.synergy.get.server_hardware
          history: '0'
          value_type: TEXT
          description: 'Data of the server hardware.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.["server-hardware"]'
              error_handler: DISCARD_VALUE
          master_item:
            key: hpe.synergy.get.data
          tags:
            - tag: component
              value: raw
        - uuid: 249afb5967c146799340487196206e01
          name: 'Get storage pools data'
          type: DEPENDENT
          key: hpe.synergy.get.storage_pools
          history: '0'
          value_type: TEXT
          description: 'Data of the storage pools.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.["storage-pools"]'
              error_handler: DISCARD_VALUE
          master_item:
            key: hpe.synergy.get.data
          tags:
            - tag: component
              value: raw
        - uuid: bab0584a38fb4e9ba3270c2882e9cef1
          name: 'Get storage systems data'
          type: DEPENDENT
          key: hpe.synergy.get.storage_systems
          history: '0'
          value_type: TEXT
          description: 'Data of the storage systems.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.["storage-systems"]'
              error_handler: DISCARD_VALUE
          master_item:
            key: hpe.synergy.get.data
          tags:
            - tag: component
              value: raw
        - uuid: f232ebaf34eb474d9596cfe573e7b3fb
          name: 'Get storage volumes data'
          type: DEPENDENT
          key: hpe.synergy.get.storage_volumes
          history: '0'
          value_type: TEXT
          description: 'Data of the storage volumes.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.["storage-volumes"]'
              error_handler: DISCARD_VALUE
          master_item:
            key: hpe.synergy.get.data
          tags:
            - tag: component
              value: raw
        - uuid: d8e6a2b490ab472cb15814c19ed71e16
          name: 'Get uplink sets data'
          type: DEPENDENT
          key: hpe.synergy.get.uplink_sets
          history: '0'
          value_type: TEXT
          description: 'Data of the uplink sets.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.["uplink-sets"]'
              error_handler: DISCARD_VALUE
          master_item:
            key: hpe.synergy.get.data
          tags:
            - tag: component
              value: raw
        - uuid: 86da94cecaa1424e9a22479d556d7b12
          name: 'Service ping'
          type: SIMPLE
          key: 'net.tcp.service["{$HPE.SYNERGY.API.SCHEME}","{$HPE.SYNERGY.API.HOST}","{$HPE.SYNERGY.API.PORT}"]'
          description: 'Checks if the service is running and accepting the TCP connections.'
          valuemap:
            name: 'Service state'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 10m
          tags:
            - tag: component
              value: health
            - tag: component
              value: network
          triggers:
            - uuid: 165774c1ffab46899352a36dd32bb574
              expression: 'max(/HPE Synergy by HTTP/net.tcp.service["{$HPE.SYNERGY.API.SCHEME}","{$HPE.SYNERGY.API.HOST}","{$HPE.SYNERGY.API.PORT}"],5m)=0'
              name: 'HPE Synergy: Service is unavailable'
              priority: HIGH
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: availability
      discovery_rules:
        - uuid: 73d93ade7489472fae4e68b05de52291
          name: 'Appliance bays discovery'
          type: DEPENDENT
          key: hpe.synergy.appliances.discovery
          description: 'A list of the appliance bays in the enclosure.'
          item_prototypes:
            - uuid: d3be63fe949c4960ba5a66c546b4ebcd
              name: 'Appliance bay [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Power state'
              type: DEPENDENT
              key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",bay_power_state]'
              description: |
                The power state of the appliance bay.
                
                *EFuse* - the power state of the bay - it has been EFused.
                *Reset* - the power state of the bay - it has been reset.
                *SoftReset* - the power state of the bay - it has been softly reset.
                *Unknown* - the power state of the bay is unknown.
              valuemap:
                name: 'Power state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.bayPowerState
                - type: STR_REPLACE
                  parameters:
                    - EFuse
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - SoftReset
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - Reset
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '3'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: appliance
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 76d81ddf977f4d3481af82f8a9031b50
              name: 'Appliance bay [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the appliance bay [{#ENCLOSURE_NAME}:{#BAY_NUMBER}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#ENCLOSURE_NAME}")].applianceBays[?(@.bayNumber == "{#BAY_NUMBER}")].first()'
              master_item:
                key: hpe.synergy.get.enclosures
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: appliance
                - tag: component
                  value: raw
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 08e834ca1ea04357b13d0383cfba8503
              name: 'Appliance bay [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Model'
              type: DEPENDENT
              key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",model]'
              value_type: CHAR
              description: 'The model name of the appliance.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.model
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: appliance
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: df7ef9ae030c417e9c3a9b64d22c2bb9
              name: 'Appliance bay [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Part number'
              type: DEPENDENT
              key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",part_number]'
              value_type: CHAR
              description: 'The part number of the appliance.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.partNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: appliance
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 7921c3c8ac07452d9a0cc47436d10aac
              name: 'Appliance bay [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Powered on'
              type: DEPENDENT
              key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",powered_on]'
              description: '*Yes*, if the appliance is powered on; *false*, otherwise.'
              valuemap:
                name: Boolean
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.poweredOn
                - type: BOOL_TO_DECIMAL
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: appliance
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: d4501f70c9e74f5dbe11ab608629c666
              name: 'Appliance bay [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Presence'
              type: DEPENDENT
              key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",presence]'
              description: |
                Indicates whether an appliance is present in the bay:
                
                *Absent* - the device slot is empty;
                *PresenceNoOp* - the device slot is uninitialized;
                *PresenceUnknown* - the device presence is unknown;
                *Present* - the device slot has a device in it;
                *Subsumed* - the device slot is configured to be part of another device slot. Not applicable for the fan or power supply bays.
              valuemap:
                name: 'Device presence'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.devicePresence
                - type: STR_REPLACE
                  parameters:
                    - Absent
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - PresenceNoOp
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - PresenceUnknown
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Present
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Subsumed
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '2'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: appliance
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: f352ca846fa34ba698b28f8d8883a14d
              name: 'Appliance bay [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Serial number'
              type: DEPENDENT
              key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",serial_number]'
              value_type: CHAR
              description: 'The serial number of the appliance.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.serialNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: appliance
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 6d47ed045d904cc780c538a330ba0895
              name: 'Appliance bay [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Spare part number'
              type: DEPENDENT
              key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",spare_part_number]'
              value_type: CHAR
              description: 'The spare part number of the appliance.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.sparePartNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: appliance
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 836036ba1abb43bbaaabddaa8bb438d3
              name: 'Appliance bay [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status]'
              description: |
                The hardware status of the appliance:
                
                *Critical* - requires immediate attention;
                *Disabled* - the resource is currently not operational;
                *OK* - indicates normal/informational behavior;
                *Unknown* - the health status is not yet known or cannot be determined;
                *Warning* - requires attention soon.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: appliance
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
              trigger_prototypes:
                - uuid: d79a138fe0cd4f918e664380af8da355
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status])=0'
                  name: 'HPE Synergy: Appliance bay [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Has critical status'
                  priority: HIGH
                  description: 'The appliance [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] status is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: c4acd5d5451d437ab5366b24643577be
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status])=4'
                  name: 'HPE Synergy: Appliance bay [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Has warning status'
                  priority: WARNING
                  description: 'The appliance [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] status is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 7b8b298e334e409da6dabf6476c80dbf
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.appliance["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status])=1'
                  name: 'HPE Synergy: Appliance bay [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Is disabled'
                  priority: INFO
                  description: 'The appliance [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is currently not operational'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: hpe.synergy.get.enclosures
          lld_macro_paths:
            - lld_macro: '{#BAY_NUMBER}'
              path: $.bayNumber
            - lld_macro: '{#ENCLOSURE_NAME}'
              path: $.enclosureName
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.members.[0].applianceBays'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 2ebb056eceea47d7ab8ca623504feb04
          name: 'Cross bars discovery'
          type: DEPENDENT
          key: hpe.synergy.crossbars.discovery
          description: 'SDX cross fabric module connects to all computing devices installed in the system enclosure and brings in the capability of hard partitioning. Crossbar details are relevant only for enclosures with type "SDX".'
          item_prototypes:
            - uuid: cedc8d60b7c647efbd148d020432861d
              name: 'Crossbar [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.crossbar["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Crossbar [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] data'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#ENCLOSURE_NAME}")].crossbars[?(@.bayNumber == "{#BAY_NUMBER}")].first()'
              master_item:
                key: hpe.synergy.get.enclosures
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: crossbar
                - tag: component
                  value: raw
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: c64e3a01454f473b888e57496ec642d3
              name: 'Crossbar [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: HW version'
              type: DEPENDENT
              key: 'hpe.synergy.crossbar["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",hw_version]'
              value_type: CHAR
              description: 'The hardware version.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.hwVersion
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.crossbar["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: crossbar
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: aaa521f31d2d4e04b918892e8e02911d
              name: 'Crossbar [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Part number'
              type: DEPENDENT
              key: 'hpe.synergy.crossbar["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",part_number]'
              value_type: CHAR
              description: 'The part number provided by the manufacturer.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.partNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.crossbar["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: crossbar
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 4c29bf3ba488474188104c51a483949e
              name: 'Crossbar [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Presence'
              type: DEPENDENT
              key: 'hpe.synergy.crossbar["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",presence]'
              description: |
                The presence in a bay:
                
                *Absent* - the device slot is empty;
                *PresenceNoOp* - the device slot is uninitialized;
                *PresenceUnknown* - the device presence is unknown;
                *Present* - the device slot has a device in it;
                *Subsumed* - the device slot is configured to be part of another device slot. Not applicable for the fan or power supply bays.
              valuemap:
                name: 'Device presence'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.presence
                - type: STR_REPLACE
                  parameters:
                    - Absent
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - PresenceNoOp
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - PresenceUnknown
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Present
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Subsumed
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '2'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.crossbar["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: crossbar
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
              trigger_prototypes:
                - uuid: b414be87e93f4f08a131d46b34b1b478
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.crossbar["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",presence])=4'
                  name: 'HPE Synergy: Crossbar [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Is subsumed'
                  priority: AVERAGE
                  description: 'The device slot is configured to be part of another device slot.'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: c7fe889af0fc43e0b73b20a99b7d193a
              name: 'Crossbar [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Serial number'
              type: DEPENDENT
              key: 'hpe.synergy.crossbar["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",serial_number]'
              value_type: CHAR
              description: 'A serial number.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.serialNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.crossbar["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: crossbar
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 322073fa57dc49df9b12898a647fe255
              name: 'Crossbar [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.crossbar["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status]'
              description: |
                The overall health status of the crossbar:
                
                *Critical* - requires immediate attention;
                *Disabled* - the resource is currently not operational;
                *OK* - indicates normal/informational behavior;
                *Unknown* - the health status is not yet known or cannot be determined;
                *Warning* - requires attention soon.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.crossbar["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: crossbar
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
              trigger_prototypes:
                - uuid: dd23cdf994c848d4b45baf4d1716f198
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.crossbar["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status])=0'
                  name: 'HPE Synergy: Crossbar [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Has critical status'
                  priority: HIGH
                  description: 'The crossbar [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] status is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 264dff5509fb4608b862bfd3e0510e32
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.crossbar["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status])=4'
                  name: 'HPE Synergy: Crossbar [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Has warning status'
                  priority: WARNING
                  description: 'The crossbar [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] status is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 89e007afab2b4331877b3a7c1b6a98fb
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.crossbar["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status])=1'
                  name: 'HPE Synergy: Crossbar [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Is disabled'
                  priority: INFO
                  description: 'The crossbar [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] currently not operational.'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: hpe.synergy.get.enclosures
          lld_macro_paths:
            - lld_macro: '{#BAY_NUMBER}'
              path: $.bayNumber
            - lld_macro: '{#ENCLOSURE_NAME}'
              path: $.enclosureName
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.members.[0].crossBars'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 148ed07fd68049c6976df0bc8ccdc416
          name: 'Datacenters discovery'
          type: DEPENDENT
          key: hpe.synergy.datacenters.discovery
          description: 'A list of the datacenters.'
          item_prototypes:
            - uuid: 08830efa6eb64d7291eaa15bbfc0b851
              name: 'Datacenter [{#NAME}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.datacenter["{#NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the datacenter [{#NAME}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#NAME}")].first()'
              master_item:
                key: hpe.synergy.get.datacenters
              tags:
                - tag: component
                  value: datacenter
                - tag: component
                  value: raw
                - tag: datacenter
                  value: '{#NAME}'
            - uuid: d37c1e2376ba4da5822041ad8ff37c8a
              name: 'Datacenter [{#NAME}]: State'
              type: DEPENDENT
              key: 'hpe.synergy.datacenter["{#NAME}",state]'
              description: 'The current state of the resource. The valid values include Adding, AddError, Configured, CredentialError, Refreshing, RefreshError, Removing, RemoveError, and Unmanaged.'
              valuemap:
                name: 'Rack state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                - type: STR_REPLACE
                  parameters:
                    - Adding
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - AddError
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - Configured
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - CredentialError
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Refreshing
                    - '4'
                - type: STR_REPLACE
                  parameters:
                    - RefreshError
                    - '5'
                - type: STR_REPLACE
                  parameters:
                    - Removing
                    - '6'
                - type: STR_REPLACE
                  parameters:
                    - RemoveError
                    - '7'
                - type: STR_REPLACE
                  parameters:
                    - Unmanaged
                    - '8'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '8'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '9'
              master_item:
                key: 'hpe.synergy.datacenter["{#NAME}",data]'
              tags:
                - tag: component
                  value: datacenter
                - tag: datacenter
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: 4f0d8ded588f4175911edff4efd4d1cd
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.datacenter["{#NAME}",state])=1'
                  name: 'HPE Synergy: Datacenter [{#NAME}]: Add error'
                  priority: AVERAGE
                  description: 'The adding of the datacenter [{#NAME}] has failed.'
                  tags:
                    - tag: scope
                      value: notice
                - uuid: 896d145d3e3e49719a1b8e01117a5987
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.datacenter["{#NAME}",state])=3'
                  name: 'HPE Synergy: Datacenter [{#NAME}]: Has credential error'
                  priority: AVERAGE
                  description: 'The datacenter [{#NAME}] has a credential error.'
                  tags:
                    - tag: scope
                      value: notice
                - uuid: 8ecd353d5f0742aaabd6f65d9a7b8897
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.datacenter["{#NAME}",state])=5'
                  name: 'HPE Synergy: Datacenter [{#NAME}]: Has refresh error'
                  priority: AVERAGE
                  description: 'The datacenter [{#NAME}] has a refresh error.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 091237538cab4e35a19c0f76b9c50539
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.datacenter["{#NAME}",state])=7'
                  name: 'HPE Synergy: Datacenter [{#NAME}]: Has remove error'
                  priority: AVERAGE
                  description: 'The datacenter [{#NAME}] has a remove error.'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: b9b2a869c6364cbc8ac6eb3ff7511b29
              name: 'Datacenter [{#NAME}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.datacenter["{#NAME}",status]'
              description: |
                The overall health status of the resource. The following are the valid values for the status of the resource:
                
                *OK* - indicates normal/informational behavior;
                *Disabled* - indicates that a resource is not operational;
                *Warning* - requires attention soon;
                *Critical* - requires immediate attention;
                *Unknown* - should be avoided, but there may be rare occasions when the status is unknown.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.datacenter["{#NAME}",data]'
              tags:
                - tag: component
                  value: datacenter
                - tag: datacenter
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: 5dbb654f17f345de8279c8249eae3207
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.datacenter["{#NAME}",status])=0'
                  name: 'HPE Synergy: Datacenter [{#NAME}]: Has critical status'
                  priority: HIGH
                  description: 'The datacenter [{#NAME}] status is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: d04a24eceaad4741a877fdf1c58141c5
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.datacenter["{#NAME}",status])=4'
                  name: 'HPE Synergy: Datacenter [{#NAME}]: Has warning status'
                  priority: WARNING
                  description: 'The datacenter [{#NAME}] status is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 7c70db1e75df47aeb8b4f87a634abde9
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.datacenter["{#NAME}",status])=1'
                  name: 'HPE Synergy: Datacenter [{#NAME}]: Is disabled'
                  priority: INFO
                  description: 'the datacenter [{#NAME}] currently not operational.'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: hpe.synergy.get.datacenters
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.members
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 3cde01eb8cbb4977824dc4fd00c56a10
          name: 'Devices discovery'
          type: DEPENDENT
          key: hpe.synergy.devices.discovery
          description: 'A list of device bays in the enclosure.'
          item_prototypes:
            - uuid: 5c7b1315b123482e908229882b6e57c1
              name: 'Device [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.device["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the device [{#ENCLOSURE_NAME}:{#BAY_NUMBER}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#ENCLOSURE_NAME}")].deviceBays[?(@.bayNumber == "{#BAY_NUMBER}")].first()'
              master_item:
                key: hpe.synergy.get.enclosures
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: device
                - tag: component
                  value: raw
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 38ecff044b1d4ff88f8e99b21998181a
              name: 'Device [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Model'
              type: DEPENDENT
              key: 'hpe.synergy.device["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",model]'
              value_type: CHAR
              description: 'The model name of an unsupported device occupying the bay if available.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.model
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.device["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: device
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 125d25085af54d509c6f2401a85042dc
              name: 'Device [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Power allocated'
              type: DEPENDENT
              key: 'hpe.synergy.device["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",power_allocation]'
              units: W
              description: 'The power allocated for the enclosed blade.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.powerAllocationWatts
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.device["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: device
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 9167abd4d23445eba156f2529cb5b827
              name: 'Device [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Presence'
              type: DEPENDENT
              key: 'hpe.synergy.device["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",presence]'
              description: |
                Indicates whether a device is present:
                
                *Absent* - the device slot is empty;
                *PresenceNoOp* - the device slot is uninitialized;
                *PresenceUnknown* - the device presence is unknown;
                *Present* - the device slot has a device in it;
                *Subsumed* - the device slot is configured to be part of another device slot. Not applicable for the fan or power supply bays.
              valuemap:
                name: 'Device presence'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.devicePresence
                - type: STR_REPLACE
                  parameters:
                    - Absent
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - PresenceNoOp
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - PresenceUnknown
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Present
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Subsumed
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '2'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.device["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: device
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
              trigger_prototypes:
                - uuid: 37ccc7acfc56466cb1a0f31e11603bcc
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.device["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",presence])=4'
                  name: 'HPE Synergy: Device [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Is subsumed'
                  priority: AVERAGE
                  description: 'The device slot is configured to be part of another device slot.'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: c2c012eab77d425da1c69f65a5078277
              name: 'Device [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Serial number'
              type: DEPENDENT
              key: 'hpe.synergy.device["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",serial_number]'
              value_type: CHAR
              description: 'If available, the serial number of any device occupying the bay.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.serialNumber
                  error_handler: DISCARD_VALUE
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.device["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: device
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
          master_item:
            key: hpe.synergy.get.enclosures
          lld_macro_paths:
            - lld_macro: '{#BAY_NUMBER}'
              path: $.bayNumber
            - lld_macro: '{#ENCLOSURE_NAME}'
              path: $.enclosureName
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.members.[0].deviceBays'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 62f5e7c29207459c80163148a6231d8a
          name: 'Enclosures discovery'
          type: DEPENDENT
          key: hpe.synergy.enclosures.discovery
          description: 'A list of enclosures resources.'
          item_prototypes:
            - uuid: fb5f6aaec9254d9b998d68d647321a28
              name: 'Enclosure [{#NAME}]: Appliance bays count'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",appliance_bay_count]'
              description: 'The number of the appliance bays in the enclosure.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.applianceBayCount
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: appliance
                - tag: component
                  value: enclosure
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: 2bdee9f0f6fa49928b4cef48b9900859
              name: 'Enclosure [{#NAME}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the enclosure [{#NAME}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#NAME}")].first()'
              master_item:
                key: hpe.synergy.get.enclosures
              tags:
                - tag: component
                  value: enclosure
                - tag: component
                  value: raw
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: e0cc3af5e941491ebbb6227f2ece06a7
              name: 'Enclosure [{#NAME}]: Device bays count'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",device_bay_count]'
              description: 'The number of the device bays in the enclosure.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.deviceBayCount
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: device
                - tag: component
                  value: enclosure
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: e17e34afe0dd4e4ea2534b7762033a83
              name: 'Enclosure [{#NAME}]: Device bays power'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",device_bay_watts]'
              units: W
              description: 'The amount of power allocated for the blades in the enclosure.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.deviceBayWatts
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: device
                - tag: component
                  value: enclosure
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: 732b7bbca90e458ead5558cea465f88e
              name: 'Enclosure [{#NAME}]: Power allocated for fans and management devices'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",fans_mgmt_power]'
              units: W
              description: 'The amount of the power allocated for the fans and management devices of the enclosure.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.fansAndManagementDevicesWatts
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: component
                  value: fan
                - tag: component
                  value: management
                - tag: component
                  value: power
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: d6af8f4c7cf04fe6a41c02e6ff50b98a
              name: 'Enclosure [{#NAME}]: Fan bays count'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",fan_bay_count]'
              description: 'The number of the fan bays in the enclosure.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.fanBayCount
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: component
                  value: fan
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: 8e2740eea20d4a0fb42b0cef4c894fce
              name: 'Enclosure [{#NAME}]: Firmware baseline'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",fw_baseline_name]'
              value_type: CHAR
              description: 'The name of the current firmware baseline.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.fwBaselineName
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: 145729f95cfe42f0a8e8308b856a03a2
              name: 'Enclosure [{#NAME}]: Interconnect bays count'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",interconnect_bay_count]'
              description: 'The number of the interconnect bays in the enclosure.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.interconnectBayCount
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: component
                  value: interconnect
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: 153278ea2f8940d18024f220d922130a
              name: 'Enclosure [{#NAME}]: Interconnect bays power'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",interconnect_bay_watts]'
              units: W
              description: 'The amount of power allocated for the interconnects in the enclosure.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.interconnectBayWatts
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: component
                  value: interconnect
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: 8685fbee85b2412b8c53dc82209ca90a
              name: 'Enclosure [{#NAME}]: Min power supplies'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",min_ps]'
              description: 'The minimum number of the power supplies needed.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.minimumPowerSupplies
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: component
                  value: power
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: 7adece9356e04a7db4e35fa1e1979e78
              name: 'Enclosure [{#NAME}]: Min power supplies for redundant power feed'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",min_ps_redundant]'
              description: 'The minimum number of the power supplies needed to fulfill the redundant line feed power mode.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.minimumPowerSuppliesForRedundantPowerFeed
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: component
                  value: power
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: 19447ecdba484d04aff2ff3c90ccaef7
              name: 'Enclosure [{#NAME}]: Model'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",model]'
              value_type: CHAR
              description: 'The enclosure model name, for example, "BladeSystem c7000 Enclosure G2.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.enclosureModel
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: 2ff00b9a0e2446a88aefc5cd62ca8763
              name: 'Enclosure [{#NAME}]: Part number'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",part_number]'
              value_type: CHAR
              description: 'The part number of the enclosure.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.partNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: 3c2bf0a14a9847c9925e52aa7e6815f1
              name: 'Enclosure [{#NAME}]: Power capacity'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",power_capacity]'
              units: W
              description: 'The power capacity based on power mode.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.powerCapacityWatts
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: component
                  value: power
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: 68ad000d8b4e4bd5b2778802426ec764
              name: 'Enclosure [{#NAME}]: Total allocated power'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",power_total_allocated]'
              units: W
              description: 'The total amount of the power allocated in the enclosure.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.powerAllocatedWatts
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: component
                  value: power
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: af45f99643fa40429e8401bf150cd7a1
              name: 'Enclosure [{#NAME}]: Total available power'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",power_total_available]'
              units: W
              description: 'The amount of the unallocated power in the enclosure.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.powerAvailableWatts
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: component
                  value: power
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: 820f177f59044d28a945642f36b6a193
              name: 'Enclosure [{#NAME}]: Power supply bays count'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",ps_bay_count]'
              description: 'The number of the power supply bays in the enclosure.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.powerSupplyBayCount
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: component
                  value: power
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: 4ee9c37fd5024e3d820f74fe174a42e7
              name: 'Enclosure [{#NAME}]: Serial number'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",serial_number]'
              value_type: CHAR
              description: 'The serial number of the enclosure.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.serialNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: d70426e6912f4128a58ba0f14dd3b5a0
              name: 'Enclosure [{#NAME}]: State'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",state]'
              description: |
                The current resource state of the enclosure:
                
                *Adding* - the enclosure is being added;
                *Configured* - the enclosure is configured and is a part of the logical enclosure. This is the usual state for an enclosure under full management;
                *Configuring* - a transient state while the enclosure is being configured for a logical enclosure;
                *Interrupted* - the previous operation on the enclosure did not complete. The operation should be re-attempted;
                *Monitored* - the enclosure is being monitored. It is not a part of the logical enclosure and only hardware-control operations are available;
                *Pending* - there are pending operations on the enclosure. Additional operations are denied;
                *RemoveFailed* - the previous operation to remove the enclosure did not succeed. The operation should be re-attempted;
                *Removing* - the enclosure is being removed;
                *Unmanaged* - the enclosure has been discovered, but has not yet been added for the management or monitoring;
                *Unsupported* - the enclosure model or version is not currently supported by HPE OneView. It cannot be configured or monitored.
              valuemap:
                name: 'Enclosure state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                - type: STR_REPLACE
                  parameters:
                    - Adding
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Configured
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - Configuring
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Interrupted
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Monitored
                    - '4'
                - type: STR_REPLACE
                  parameters:
                    - Pending
                    - '5'
                - type: STR_REPLACE
                  parameters:
                    - RemoveFailed
                    - '6'
                - type: STR_REPLACE
                  parameters:
                    - Removing
                    - '7'
                - type: STR_REPLACE
                  parameters:
                    - Unmanaged
                    - '8'
                - type: STR_REPLACE
                  parameters:
                    - Unsupported
                    - '9'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '9'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '10'
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: enclosure
                  value: '{#NAME}'
            - uuid: 6947d7dc74744e05a5b2fbd6ae918f16
              name: 'Enclosure [{#NAME}]: State reason'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",state_reason]'
              description: |
                Indicates the reason why the resource in its current state:
                
                *Missing* - the enclosure is no longer connected into the frame link topology;
                *None* - no reason is available, or none applies;
                *NotAdded* - the enclosure has not been added;
                *NotOwner* - the enclosure reports being managed by something other than this HPE OneView;
                *OperationFailed* - a prior operation was interrupted;
                *Unowned* - the enclosure reports are not being under the management;
                *UnsupportedFirmware* - the firmware version of the enclosure is not supported by this version of HPE OneView;
                *UpdatingFirmware* - a firmware update is in progress.
              valuemap:
                name: 'State reason'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.stateReason
                - type: STR_REPLACE
                  parameters:
                    - Missing
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - None
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - NotAdded
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - NotOwner
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - OperationFailed
                    - '4'
                - type: STR_REPLACE
                  parameters:
                    - Unowned
                    - '5'
                - type: STR_REPLACE
                  parameters:
                    - UnsupportedFirmware
                    - '6'
                - type: STR_REPLACE
                  parameters:
                    - UpdatingFirmware
                    - '7'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '7'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '8'
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: enclosure
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: 61f81dcbb3c74f14982bd29b78f6a57b
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.enclosure["{#NAME}",state_reason])=0'
                  name: 'HPE Synergy: Enclosure [{#NAME}]: Is missing'
                  priority: AVERAGE
                  description: 'The enclosure is no longer connected into the frame link topology.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 6101e612efa54715a72263b4ea9d5b7d
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.enclosure["{#NAME}",state_reason])=5'
                  name: 'HPE Synergy: Enclosure [{#NAME}]: Is unowned'
                  priority: AVERAGE
                  description: 'The enclosure reports are not being under the management.'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: a22c6445c8e9491bbd0e08ba63c37659
              name: 'Enclosure [{#NAME}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",status]'
              description: |
                The overall health status of the enclosure.
                The enclosure status reflects the hardware health of the enclosure, all the bays, and the enclosure components (e.g. the enclosure mid-plane, fans, power supplies, Synergy Frame Link Modules, and Synergy Composers). It explicitly does not include the status of the other HPE OneView resources such as the blades (server hardware), the interconnects, and the drive enclosures.
                
                *Critical* - requires immediate attention.
                *Disabled* - the resource is currently not operational.
                *OK* - indicates normal/informational behavior.
                *Unknown* - the health status is not yet known or cannot be determined.
                *Warning* - requires attention soon.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: enclosure
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: 862f37cbe3b144b5ae70998bf7406497
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.enclosure["{#NAME}",status])=0'
                  name: 'HPE Synergy: Enclosure [{#NAME}]: Has critical status'
                  priority: HIGH
                  description: 'The status of the enclosure [{#NAME}] is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 50f4cfc199564b26bf575d88ec5ba57e
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.enclosure["{#NAME}",status])=4'
                  name: 'HPE Synergy: Enclosure [{#NAME}]: Has warning status'
                  priority: WARNING
                  description: 'The status of the enclosure [{#NAME}] is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: c3ce50cdb5374904970903c082a98f72
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.enclosure["{#NAME}",status])=1'
                  name: 'HPE Synergy: Enclosure [{#NAME}]: Is disabled'
                  priority: INFO
                  description: 'The enclosure [{#NAME}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 66d773b8d4794752b3ff9b5913ee32f2
              name: 'Enclosure [{#NAME}]: Type'
              type: DEPENDENT
              key: 'hpe.synergy.enclosure["{#NAME}",type]'
              value_type: CHAR
              description: 'The type of the enclosure, for example, "C7000" or "SY12000" or "SDX".'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.enclosureType
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'hpe.synergy.enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: enclosure
                - tag: enclosure
                  value: '{#NAME}'
          trigger_prototypes:
            - uuid: 7cd90689dd8147949b1da375b055c71f
              expression: 'last(/HPE Synergy by HTTP/hpe.synergy.enclosure["{#NAME}",state])=3 and last(/HPE Synergy by HTTP/hpe.synergy.enclosure["{#NAME}",state_reason])>-1'
              name: 'HPE Synergy: Enclosure [{#NAME}]: Is interrupted'
              opdata: 'Reason: {ITEM.LASTVALUE2}'
              priority: WARNING
              description: 'The previous operation on the enclosure did not complete. The operation should be re-attempted.'
              tags:
                - tag: scope
                  value: notice
            - uuid: 7bfc1a8cde3349cba772a6217df3e275
              expression: 'last(/HPE Synergy by HTTP/hpe.synergy.enclosure["{#NAME}",state])=9 and last(/HPE Synergy by HTTP/hpe.synergy.enclosure["{#NAME}",state_reason])>-1'
              name: 'HPE Synergy: Enclosure [{#NAME}]: Is unsupported'
              opdata: 'Reason: {ITEM.LASTVALUE2}'
              priority: AVERAGE
              description: 'The enclosure model or version is not currently supported by HPE OneView. It cannot be configured or monitored.'
              tags:
                - tag: scope
                  value: availability
            - uuid: ef82fad1874d4dd5918d9c33323b6ae6
              expression: 'last(/HPE Synergy by HTTP/hpe.synergy.enclosure["{#NAME}",state])=6 and last(/HPE Synergy by HTTP/hpe.synergy.enclosure["{#NAME}",state_reason])>-1'
              name: 'HPE Synergy: Enclosure [{#NAME}]: Remove failed'
              opdata: 'Reason: {ITEM.LASTVALUE2}'
              priority: WARNING
              description: 'The previous operation to remove the enclosure did not succeed. The operation should be re-attempted.'
              tags:
                - tag: scope
                  value: notice
          graph_prototypes:
            - uuid: 1f9d74b503f14765ad6a054f604f3e28
              name: 'Enclosure [{#NAME}]: Power capacity'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'HPE Synergy by HTTP'
                    key: 'hpe.synergy.enclosure["{#NAME}",power_capacity]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'HPE Synergy by HTTP'
                    key: 'hpe.synergy.enclosure["{#NAME}",power_total_allocated]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'HPE Synergy by HTTP'
                    key: 'hpe.synergy.enclosure["{#NAME}",power_total_available]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'HPE Synergy by HTTP'
                    key: 'hpe.synergy.enclosure["{#NAME}",fans_mgmt_power]'
                - sortorder: '4'
                  color: FC6EA3
                  item:
                    host: 'HPE Synergy by HTTP'
                    key: 'hpe.synergy.enclosure["{#NAME}",device_bay_watts]'
                - sortorder: '5'
                  color: 6C59DC
                  item:
                    host: 'HPE Synergy by HTTP'
                    key: 'hpe.synergy.enclosure["{#NAME}",interconnect_bay_watts]'
          master_item:
            key: hpe.synergy.get.enclosures
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.members
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 386a121cbef74d0d9f625eedd6ed291c
          name: 'Ethernet networks discovery'
          type: DEPENDENT
          key: hpe.synergy.ethernet.networks.discovery
          description: 'A list of the ethernet networks.'
          item_prototypes:
            - uuid: 0176e96b210b4a778b0b4b9b6fabdf3b
              name: 'Ethernet network [{#NAME}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.ethernet.network["{#NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the ethernet network [{#NAME}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#NAME}")].first()'
              master_item:
                key: hpe.synergy.get.ethernet_networks
              tags:
                - tag: component
                  value: network
                - tag: component
                  value: raw
                - tag: network
                  value: '{#NAME}'
            - uuid: 9b69d74467d6440eb98fc6c69c2f6779
              name: 'Ethernet network [{#NAME}]: State'
              type: DEPENDENT
              key: 'hpe.synergy.ethernet.network["{#NAME}",state]'
              value_type: CHAR
              description: 'The current state of the resource.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.ethernet.network["{#NAME}",data]'
              tags:
                - tag: component
                  value: network
                - tag: network
                  value: '{#NAME}'
            - uuid: ec1c0f1ec9f34c7aa1d6c9509e4fc6a7
              name: 'Ethernet network [{#NAME}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.ethernet.network["{#NAME}",status]'
              description: |
                The overall health status of the resource. The following are the valid values for the status of the resource:
                
                *OK* - indicates normal/informational behavior;
                *Disabled* - indicates that the resource is not operational;
                *Warning* - requires attention soon;
                *Critical* - requires immediate attention;
                *Unknown* - should be avoided, but there may be rare occasions when the status is unknown.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.ethernet.network["{#NAME}",data]'
              tags:
                - tag: component
                  value: network
                - tag: network
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: c658a58285184a82969b520d5be1f9b2
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.ethernet.network["{#NAME}",status])=0'
                  name: 'HPE Synergy: Ethernet network [{#NAME}]: Has critical status'
                  priority: HIGH
                  description: 'The ethernet network [{#NAME}] status is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 6881808352bd4588b42debf5f2703f69
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.ethernet.network["{#NAME}",status])=4'
                  name: 'HPE Synergy: Ethernet network [{#NAME}]: Has warning status'
                  priority: WARNING
                  description: 'The ethernet network [{#NAME}] status is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: eef185ab54584c069df2a4349dff9cc7
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.ethernet.network["{#NAME}",status])=1'
                  name: 'HPE Synergy: Ethernet network [{#NAME}]: Is disabled'
                  priority: INFO
                  description: 'The ethernet network [{#NAME}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: hpe.synergy.get.ethernet_networks
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.members
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 67c37bbfab9345d38ed5e576fdb7cb23
          name: 'Fabrics discovery'
          type: DEPENDENT
          key: hpe.synergy.fabrics.discovery
          description: 'A list of the fabrics.'
          item_prototypes:
            - uuid: 26e6e32676d74347abd8dbf92c649113
              name: 'Fabric [{#NAME}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.fabric["{#NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the fabric [{#NAME}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#NAME}")].first()'
              master_item:
                key: hpe.synergy.get.fabrics
              tags:
                - tag: component
                  value: fabric
                - tag: component
                  value: raw
                - tag: fabric
                  value: '{#NAME}'
            - uuid: 9f38d17239ee45d4a22e8f08dde37910
              name: 'Fabric [{#NAME}]: State'
              type: DEPENDENT
              key: 'hpe.synergy.fabric["{#NAME}",state]'
              value_type: CHAR
              description: 'The current state of the resource.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.fabric["{#NAME}",data]'
              tags:
                - tag: component
                  value: fabric
                - tag: fabric
                  value: '{#NAME}'
            - uuid: 82f8bedd589643d1954f329f5f10b9b9
              name: 'Fabric [{#NAME}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.fabric["{#NAME}",status]'
              description: |
                The overall health status of the resource. The following are the valid values for the status of the resource:
                
                *OK* - indicates normal/informational behavior;
                *Disabled* - indicates that the resource is not operational;
                *Warning* - requires attention soon;
                *Critical* - requires immediate attention;
                *Unknown* - should be avoided, but there may be rare occasions when the status is unknown.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.fabric["{#NAME}",data]'
              tags:
                - tag: component
                  value: fabric
                - tag: fabric
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: 5f67d217108d4e7fbfcaed29f0f8564f
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.fabric["{#NAME}",status])=0'
                  name: 'HPE Synergy: Fabric [{#NAME}]: Has critical status'
                  priority: HIGH
                  description: 'The status of the fabric [{#NAME}] is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: c546f87158ee42ba8d76aa3fd6767efa
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.fabric["{#NAME}",status])=4'
                  name: 'HPE Synergy: Fabric [{#NAME}]: Has warning status'
                  priority: WARNING
                  description: 'The status of the fabric [{#NAME}] is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: c963ad956b0644c394bd58dbbb05858a
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.fabric["{#NAME}",status])=1'
                  name: 'HPE Synergy: Fabric [{#NAME}]: Is disabled'
                  priority: INFO
                  description: 'The status of the fabric [{#NAME}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: hpe.synergy.get.fabrics
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.members
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 5d5303b09c6e43748571c9ea247774be
          name: 'Fans discovery'
          type: DEPENDENT
          key: hpe.synergy.fans.discovery
          description: 'A list of the fan bays in the enclosure.'
          item_prototypes:
            - uuid: 1ee7ddcfd9734abbaef8dc345f9eb85d
              name: 'Fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#ENCLOSURE_NAME}")].fanBays[?(@.bayNumber == "{#BAY_NUMBER}")].first()'
              master_item:
                key: hpe.synergy.get.enclosures
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: fan
                - tag: component
                  value: raw
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 8449918637ab4f98932ca75d859546b2
              name: 'Fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Model'
              type: DEPENDENT
              key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",model]'
              value_type: CHAR
              description: 'The common descriptive model of the fan.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.model
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: fan
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 539f8b373baf46d7bcde5fc090f02284
              name: 'Fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Part number'
              type: DEPENDENT
              key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",part_number]'
              value_type: CHAR
              description: 'The part number of the fan.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.partNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: fan
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: eb7ad5fc3d4947eda9642c2a2d440796
              name: 'Fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Presence'
              type: DEPENDENT
              key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",presence]'
              description: |
                Indicates whether a fan is present:
                
                *Absent* - the device slot is empty;
                *PresenceNoOp* - the device slot is uninitialized;
                *PresenceUnknown* - the device presence is unknown;
                *Present* - the device slot has a device in it;
                *Subsumed* - the device slot is configured to be part of another device slot. Not applicable for the fan or power supply bays.
              valuemap:
                name: 'Device presence'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.devicePresence
                - type: STR_REPLACE
                  parameters:
                    - Absent
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - PresenceNoOp
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - PresenceUnknown
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Present
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Subsumed
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '2'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: fan
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 6782d5441add454384b41d9ede2a8cf2
              name: 'Fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Required'
              type: DEPENDENT
              key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",required]'
              description: 'Indicates whether the enclosure configuration requires a fan to be present in the bay.'
              valuemap:
                name: Boolean
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.deviceRequired
                - type: BOOL_TO_DECIMAL
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: fan
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 16a8b59afdf04df1a070e1249fdd1a61
              name: 'Fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Serial number'
              type: DEPENDENT
              key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",serial_number]'
              value_type: CHAR
              description: 'The serial number of the fan.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.serialNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: fan
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 4e6338579bea4bb7acb06e57d55365e5
              name: 'Fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Spare part number'
              type: DEPENDENT
              key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",spare_part_number]'
              value_type: CHAR
              description: 'The spare part number to be used when ordering an additional or replacement fan of this type.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.sparePartNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: fan
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 19171c26420f4cd894509a817c3245d8
              name: 'Fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: State'
              type: DEPENDENT
              key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",state]'
              description: |
                The current state of the fan:
                
                *Degraded* - a fan is degraded;
                *Failed* -  a fan has failed;
                *Misplaced* - a fan is present, but not required in this bay, and the overall fan configuration is not compliant with the enclosure fan placement rules;
                *Missing* - a fan is required, but is not present;
                *OK* - a fan bay has no issues;
                *Unknown* - the state of a fan is unknown.
              valuemap:
                name: 'Resource state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '5'
                - type: STR_REPLACE
                  parameters:
                    - Degraded
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Failed
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - Misplaced
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Missing
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '5'
              master_item:
                key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: fan
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
              trigger_prototypes:
                - uuid: cc28f87bd5b445c3abd07af689d8ee74
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",state])=0'
                  name: 'HPE Synergy: Fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Is degraded'
                  priority: AVERAGE
                  description: 'The fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is in degraded state.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 113096666e074f8eadab59c0250968af
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",state])=1'
                  name: 'HPE Synergy: Fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Is failed'
                  priority: HIGH
                  description: 'The fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is in failed state.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 63589098cc6b4e9ea7e7855e5a6b980e
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",state])=2'
                  name: 'HPE Synergy: Fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Is misplaced'
                  priority: WARNING
                  description: 'The fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is misplaced.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 6b89f74f468942f789f75fdbb2b6cee6
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",state])=3'
                  name: 'HPE Synergy: Fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Is missing'
                  priority: AVERAGE
                  description: 'The fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is missing.'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: e9ac8ad873a04d549ed492b1c23966cb
              name: 'Fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status]'
              description: |
                The overall health status of the fan:
                
                *Critical* - requires immediate attention;
                *Disabled* - the resource is currently not operational;
                *OK* - indicates normal/informational behavior;
                *Unknown* - the health status is not yet known or cannot be determined;
                *Warning* - requires attention soon.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: fan
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
              trigger_prototypes:
                - uuid: 6b7b21cc6a3144edaf5fb3da2b54370f
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status])=0'
                  name: 'HPE Synergy: Fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Has critical status'
                  priority: HIGH
                  description: 'The fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] status is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 168ea39107c748d0b7008b4525ff4504
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status])=4'
                  name: 'HPE Synergy: Fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Has warning status'
                  priority: WARNING
                  description: 'The fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] status is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 41296079847b49d285e395e77f920e06
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.fan["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status])=1'
                  name: 'HPE Synergy: Fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Is disabled'
                  priority: INFO
                  description: 'The fan [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: hpe.synergy.get.enclosures
          lld_macro_paths:
            - lld_macro: '{#BAY_NUMBER}'
              path: $.bayNumber
            - lld_macro: '{#ENCLOSURE_NAME}'
              path: $.enclosureName
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.members.[0].fanBays'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 100519374fc94a4487a871224c483229
          name: 'FC networks discovery'
          type: DEPENDENT
          key: hpe.synergy.fc.networks.discovery
          description: 'A list of the FC networks.'
          item_prototypes:
            - uuid: 75ca293f7deb4d7faa669f141478f1d7
              name: 'FC network [{#NAME}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.fc.network["{#NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the FC network [{#NAME}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#NAME}")].first()'
              master_item:
                key: hpe.synergy.get.fc_networks
              tags:
                - tag: component
                  value: fc-network
                - tag: component
                  value: raw
                - tag: fc-network
                  value: '{#NAME}'
            - uuid: 1defd79827204bbcaffe79cd7a9df059
              name: 'FC network [{#NAME}]: State'
              type: DEPENDENT
              key: 'hpe.synergy.fc.network["{#NAME}",state]'
              value_type: CHAR
              description: 'The current state of the resource.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.fc.network["{#NAME}",data]'
              tags:
                - tag: component
                  value: fc-network
                - tag: fc-network
                  value: '{#NAME}'
            - uuid: db0c86d17310421088cad2853d35c177
              name: 'FC network [{#NAME}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.fc.network["{#NAME}",status]'
              description: |
                The overall health status of the resource. The following are the valid values for the status of the resource:
                
                *OK* - indicates normal/informational behavior;
                *Disabled* - indicates that the resource is not operational;
                *Warning* - requires attention soon;
                *Critical* - requires immediate attention;
                *Unknown* - should be avoided, but there may be rare occasions when the status is unknown.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.fc.network["{#NAME}",data]'
              tags:
                - tag: component
                  value: fc-network
                - tag: fc-network
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: 38b9aba3f57f4b779f26dcf3d53090cf
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.fc.network["{#NAME}",status])=0'
                  name: 'HPE Synergy: FC network [{#NAME}]: Has critical status'
                  priority: HIGH
                  description: 'The FC network [{#NAME}] status is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: edf33e3c732442c6ac3327e995d0919e
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.fc.network["{#NAME}",status])=4'
                  name: 'HPE Synergy: FC network [{#NAME}]: Has warning status'
                  priority: WARNING
                  description: 'The FC network [{#NAME}] status is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 518a795f68bf4b81ac17332f511ffdb5
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.fc.network["{#NAME}",status])=1'
                  name: 'HPE Synergy: FC network [{#NAME}]: Is disabled'
                  priority: INFO
                  description: 'The FC network [{#NAME}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: hpe.synergy.get.fc_networks
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.members
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 0ac7b7355249475eac517cbc9ac8ba83
          name: 'Managers discovery'
          type: DEPENDENT
          key: hpe.synergy.frame_link_modules.discovery
          description: 'A list of the Synergy Frame Link Module bays.'
          item_prototypes:
            - uuid: 53c899a616a24fc4990363d3f2942417
              name: 'Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#ENCLOSURE_NAME}")].managerBays[?(@.bayNumber == "{#BAY_NUMBER}")].first()'
              master_item:
                key: hpe.synergy.get.enclosures
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: manager
                - tag: component
                  value: raw
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 64e7f977edf34338aa74e8acc88d98fd
              name: 'Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Firmware version'
              type: DEPENDENT
              key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",fw_version]'
              value_type: CHAR
              description: 'The firmware version of the manager.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.fwVersion
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: manager
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: c34aade5cdf1469cbab8fe97ede864ea
              name: 'Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Link port state'
              type: DEPENDENT
              key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",link_port_state]'
              description: |
                The state of the LINK port:
                
                *Disabled* - the port is disabled;
                *Linked* - the port is linked;
                *Unlinked* - the port is unlinked.
              valuemap:
                name: 'Link port state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.linkPortState
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Linked
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - Unlinked
                    - '2'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '2'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
              master_item:
                key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: manager
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: ca60cadc2c0f44e7a281e956bc34d1da
              name: 'Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Link port status'
              type: DEPENDENT
              key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",link_port_status]'
              description: |
                The status of the LINK port:
                
                *Critical* - requires immediate attention;
                *Disabled* - the resource is currently not operational;
                *OK* - indicates normal/informational behavior;
                *Unknown* - the health status is not yet known or cannot be determined;
                *Warning* - requires attention soon.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.linkPortStatus
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: manager
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
              trigger_prototypes:
                - uuid: d0a6196dc2984373916bbb857687d398
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",link_port_status])=0'
                  name: 'HPE Synergy: Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Link port has critical status'
                  priority: HIGH
                  description: 'The link port status of the manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: capacity
                - uuid: 73fd558563794741b1416fb73ba4f173
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",link_port_status])=4'
                  name: 'HPE Synergy: Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Link port has warning status'
                  priority: WARNING
                  description: 'The link port status of the manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: capacity
                - uuid: ab5f51fe1dcd4a859ffb3dff66450b33
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",link_port_status])=1'
                  name: 'HPE Synergy: Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Link port is disabled'
                  priority: INFO
                  description: 'The link port of the manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: capacity
            - uuid: b636ea6e5d994e728579cd5d479fe298
              name: 'Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: MGMT port state'
              type: DEPENDENT
              key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",mgmt_port_state]'
              description: |
                The state of the MGMT port:
                
                *Active* - the port is in active mode;
                *Disabled* - the port is in disabled mode;
                *I3s* - the port is configured for the deployment of an OS network traffic.
                *Other* - the port is in other mode;
                *Standby* - the port is in standby mode;
                *Unknown* - the mode of the port is not known.
              valuemap:
                name: 'MGMT port state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.mgmtPortState
                - type: STR_REPLACE
                  parameters:
                    - Active
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - I3s
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Other
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Standby
                    - '4'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '5'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '5'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '5'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
              master_item:
                key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: manager
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 41a66b669b15425796f1dce9b46545c5
              name: 'Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: MGMT port status'
              type: DEPENDENT
              key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",mgmt_port_status]'
              description: |
                The status of the MGMT port:
                
                *Critical* - requires immediate attention;
                *Disabled* - the resource is currently not operational;
                *OK* - indicates normal/informational behavior;
                *Unknown* - the health status is not yet known or cannot be determined;
                *Warning* - requires attention soon.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.mgmtPortStatus
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: manager
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
              trigger_prototypes:
                - uuid: 514ecd9c1bbd4821ad84e5ddb042d0c6
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",mgmt_port_status])=0'
                  name: 'HPE Synergy: Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: MGMT port has critical status'
                  priority: HIGH
                  description: 'The MGMT port status of the manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 7dd75b26c54d41228199ee9e810272bc
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",mgmt_port_status])=4'
                  name: 'HPE Synergy: Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: MGMT port has warning status'
                  priority: WARNING
                  description: 'The MGMT port status of the manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 1b7b8409bc394f22b940c09e56b3fa5c
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",mgmt_port_status])=1'
                  name: 'HPE Synergy: Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: MGMT port is disabled'
                  priority: INFO
                  description: 'The MGMT port of the manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 99281bb985fe46c6ac9328e2e491665e
              name: 'Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Model'
              type: DEPENDENT
              key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",model]'
              value_type: CHAR
              description: 'The model of the link module.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.model
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: manager
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 90a8d8e504834e4393c3fa0bbcb5e802
              name: 'Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Part number'
              type: DEPENDENT
              key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",part_number]'
              value_type: CHAR
              description: 'The part number of the link module.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.partNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: manager
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 4a9f6da6f67545fb9ed5a8333bd1b303
              name: 'Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Presence'
              type: DEPENDENT
              key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",presence]'
              description: |
                Indicates whether a manager is present in the bay:
                
                *Absent* - the device slot is empty;
                *PresenceNoOp* - the device slot is uninitialized;
                *PresenceUnknown* - the device presence is unknown;
                *Present* - the device slot has a device in it;
                *Subsumed* - the device slot is configured to be part of another device slot. Not applicable for the fan or power supply bays.
              valuemap:
                name: 'Device presence'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.devicePresence
                - type: STR_REPLACE
                  parameters:
                    - Absent
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - PresenceNoOp
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - PresenceUnknown
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Present
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Subsumed
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '2'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: manager
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
              trigger_prototypes:
                - uuid: d47706453e8944e497ff01feaaa19aab
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",presence])=4'
                  name: 'HPE Synergy: Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Is subsumed'
                  priority: AVERAGE
                  description: 'The device slot is configured to be part of another device slot.'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 1d9ac1bcc74048df8358c148c3ed9ce4
              name: 'Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Serial number'
              type: DEPENDENT
              key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",serial_number]'
              value_type: CHAR
              description: 'The serial number of the link module.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.serialNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: manager
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: c6ee7ec806e04600b6826dbb373bcafe
              name: 'Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Spare part number'
              type: DEPENDENT
              key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",spare_part_number]'
              value_type: CHAR
              description: 'The spare part number of the link module.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.sparePartNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: manager
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 0f72a6c8e89b4ea0b66bb0becae93bb1
              name: 'Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status]'
              description: |
                The health status of the link module:
                
                *Critical* - requires immediate attention;
                *Disabled* - the resource is currently not operational;
                *OK* - indicates normal/informational behavior;
                *Unknown* - the health status is not yet known or cannot be determined;
                *Warning* - requires attention soon.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: manager
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
              trigger_prototypes:
                - uuid: c1d8fa7ff1fe444aaefdffdcda810e5c
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status])=0'
                  name: 'HPE Synergy: Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Has critical status'
                  priority: HIGH
                  description: 'The status of the manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 44b30472c18a49cf9c0f7bb2f30fd184
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status])=4'
                  name: 'HPE Synergy: Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Has warning status'
                  priority: WARNING
                  description: 'The status of the manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 34dd6fb0ed264192b7d1b46ba2778b16
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.manager["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status])=1'
                  name: 'HPE Synergy: Manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Is disabled'
                  priority: INFO
                  description: 'The manager [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: notice
          master_item:
            key: hpe.synergy.get.enclosures
          lld_macro_paths:
            - lld_macro: '{#BAY_NUMBER}'
              path: $.bayNumber
            - lld_macro: '{#ENCLOSURE_NAME}'
              path: $.enclosureName
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.members.[0].managerBays'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 6d77748c49de4c6c9c0319a52bec29fc
          name: 'Hypervisor managers discovery'
          type: DEPENDENT
          key: hpe.synergy.hypervisor.managers.discovery
          description: 'A list of the hypervisor managers.'
          item_prototypes:
            - uuid: c6ba70270a424762bb8baf9531f44ed9
              name: 'Hypervisor manager [{#NAME}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.hypervisor_manager["{#NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the hypervisor manager [{#NAME}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.displayName == "{#NAME}")].first()'
              master_item:
                key: hpe.synergy.get.hypervisor_managers
              tags:
                - tag: component
                  value: hypervisor-manager
                - tag: component
                  value: raw
                - tag: hypervisor-manager
                  value: '{#NAME}'
            - uuid: a60a72ddc0de4a9c9b0b7be53542089c
              name: 'Hypervisor manager [{#NAME}]: State'
              type: DEPENDENT
              key: 'hpe.synergy.hypervisor_manager["{#NAME}",state]'
              description: 'The current state of the resource. The valid values include Connected, Disconnected, Configuring and Error.'
              valuemap:
                name: 'Hypervisor manager state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                - type: STR_REPLACE
                  parameters:
                    - Connected
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disconnected
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - Configuring
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Error
                    - '3'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '3'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '4'
              master_item:
                key: 'hpe.synergy.hypervisor_manager["{#NAME}",data]'
              tags:
                - tag: component
                  value: hypervisor-manager
                - tag: hypervisor-manager
                  value: '{#NAME}'
            - uuid: 2f0874b4d0464fc58d64c12a04b8d738
              name: 'Hypervisor manager [{#NAME}]: State reason'
              type: DEPENDENT
              key: 'hpe.synergy.hypervisor_manager["{#NAME}",state_reason]'
              value_type: CHAR
              description: 'Indicates the reason why the resource is in its current state.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.stateReason
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.hypervisor_manager["{#NAME}",data]'
              tags:
                - tag: component
                  value: hypervisor-manager
                - tag: hypervisor-manager
                  value: '{#NAME}'
            - uuid: e5ec285a6c74478d903284ecb67d3f96
              name: 'Hypervisor manager [{#NAME}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.hypervisor_manager["{#NAME}",status]'
              description: |
                The current status of this resource:
                
                *Critical* - requires immediate attention;
                *Disabled* - the resource is currently not operational;
                *OK* - indicates normal/informational behavior;
                *Unknown* - the health status is not yet known or cannot be determined;
                *Warning* - requires attention soon.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.hypervisor_manager["{#NAME}",data]'
              tags:
                - tag: component
                  value: hypervisor-manager
                - tag: hypervisor-manager
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: a942a7ddfad14bb08915c7ba6c3248bc
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.hypervisor_manager["{#NAME}",status])=0'
                  name: 'HPE Synergy: Hypervisor manager [{#NAME}]: Has critical status'
                  priority: HIGH
                  description: 'The hypervisor manager [{#NAME}] status is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: d81f11c478484d77a64049a2716865b4
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.hypervisor_manager["{#NAME}",status])=4'
                  name: 'HPE Synergy: Hypervisor manager [{#NAME}]: Has warning status'
                  priority: WARNING
                  description: 'The hypervisor manager [{#NAME}] status is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: ea85e02ebac94ab2821659c88eb5363c
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.hypervisor_manager["{#NAME}",status])=1'
                  name: 'HPE Synergy: Hypervisor manager [{#NAME}]: Is disabled'
                  priority: INFO
                  description: 'The hypervisor manager [{#NAME}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: availability
          trigger_prototypes:
            - uuid: fd90d819f10d43cc9b18ae5e5ee96b66
              expression: 'last(/HPE Synergy by HTTP/hpe.synergy.hypervisor_manager["{#NAME}",state])=3 and length(last(/HPE Synergy by HTTP/hpe.synergy.hypervisor_manager["{#NAME}",state_reason]))>0'
              name: 'HPE Synergy: Hypervisor manager [{#NAME}]: Is in error state'
              opdata: 'Reason: {ITEM.LASTVALUE2}'
              priority: HIGH
              description: 'The hypervisor manager [{#NAME}] has an error.'
              tags:
                - tag: scope
                  value: availability
          master_item:
            key: hpe.synergy.get.hypervisor_managers
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.displayName
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.members
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: c05507c8d82f4354a813670620298732
          name: 'Interconnects discovery'
          type: DEPENDENT
          key: hpe.synergy.interconnects.discovery
          description: 'Interconnects are centrally managed by their containing logical interconnect. The interconnect provides a physical view of a detailed downlink and uplink port state and configuration, including the current link state, speed, port role (uplink, downlink, or stacking), current pluggable media, power state, and immediate connected neighbor.'
          item_prototypes:
            - uuid: 5c504f8c744244febae87002cd520cbd
              name: 'Interconnect [{#NAME}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.interconnect["{#NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the interconnect [{#NAME}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#NAME}")].first()'
              master_item:
                key: hpe.synergy.get.interconnects
              tags:
                - tag: component
                  value: interconnect
                - tag: component
                  value: raw
                - tag: interconnect
                  value: '{#NAME}'
            - uuid: dc4822f158da4577a47ec4cf920b9b90
              name: 'Interconnect [{#NAME}]: Hardware health'
              type: DEPENDENT
              key: 'hpe.synergy.interconnect["{#NAME}",hw.health]'
              value_type: CHAR
              description: 'The health status of the interconnect hardware.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.interconnectHardwareHealth
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.interconnect["{#NAME}",data]'
              tags:
                - tag: component
                  value: health
                - tag: component
                  value: interconnect
                - tag: interconnect
                  value: '{#NAME}'
            - uuid: 7113bba95f38421a8bcffe77f9a3944d
              name: 'Interconnect [{#NAME}]: Model'
              type: DEPENDENT
              key: 'hpe.synergy.interconnect["{#NAME}",model]'
              value_type: CHAR
              description: 'The interconnect model.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.model
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.interconnect["{#NAME}",data]'
              tags:
                - tag: component
                  value: interconnect
                - tag: interconnect
                  value: '{#NAME}'
            - uuid: d3e8fc007d5e4adf899fdb3d0f786fb1
              name: 'Interconnect [{#NAME}]: Part number'
              type: DEPENDENT
              key: 'hpe.synergy.interconnect["{#NAME}",part_number]'
              value_type: CHAR
              description: 'The part number of the interconnect.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.partNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.interconnect["{#NAME}",data]'
              tags:
                - tag: component
                  value: interconnect
                - tag: interconnect
                  value: '{#NAME}'
            - uuid: c2e482f840184c278c09017623fd96d1
              name: 'Interconnect [{#NAME}]: Port count'
              type: DEPENDENT
              key: 'hpe.synergy.interconnect["{#NAME}",port_count]'
              description: 'The number of ports on the interconnect.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.portCount
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.interconnect["{#NAME}",data]'
              tags:
                - tag: component
                  value: interconnect
                - tag: interconnect
                  value: '{#NAME}'
            - uuid: 27e4c424f81940b1958e0455042bf3d3
              name: 'Interconnect [{#NAME}]: Serial number'
              type: DEPENDENT
              key: 'hpe.synergy.interconnect["{#NAME}",serial_number]'
              value_type: CHAR
              description: 'The serial number of the interconnect.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.serialNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.interconnect["{#NAME}",data]'
              tags:
                - tag: component
                  value: interconnect
                - tag: interconnect
                  value: '{#NAME}'
            - uuid: 8232b536d74846d7a90ce19400418a36
              name: 'Interconnect [{#NAME}]: Spare part number'
              type: DEPENDENT
              key: 'hpe.synergy.interconnect["{#NAME}",spare_part_number]'
              value_type: CHAR
              description: 'The spare part number of the interconnect.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.sparePartNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.interconnect["{#NAME}",data]'
              tags:
                - tag: component
                  value: interconnect
                - tag: interconnect
                  value: '{#NAME}'
            - uuid: bd97faaf4a4c47a1a87d97650d65a375
              name: 'Interconnect [{#NAME}]: State'
              type: DEPENDENT
              key: 'hpe.synergy.interconnect["{#NAME}",state]'
              value_type: CHAR
              description: 'The current state of the resource.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.interconnect["{#NAME}",data]'
              tags:
                - tag: component
                  value: interconnect
                - tag: interconnect
                  value: '{#NAME}'
            - uuid: ac234400f7324bbea2c736c6f7afd131
              name: 'Interconnect [{#NAME}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.interconnect["{#NAME}",status]'
              description: |
                The overall health status of the resource. The following are the valid values for the status of the resource:
                
                *OK* - indicates normal/informational behavior;
                *Disabled* - indicates that the resource is not operational;
                *Warning* - requires attention soon;
                *Critical* - requires immediate attention;
                *Unknown* - should be avoided, but there may be rare occasions when the status is unknown.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.interconnect["{#NAME}",data]'
              tags:
                - tag: component
                  value: interconnect
                - tag: interconnect
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: ccc001583dc6478aa3569b14b65be97d
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.interconnect["{#NAME}",status])=0'
                  name: 'HPE Synergy: Interconnect [{#NAME}]: Has critical status'
                  priority: HIGH
                  description: 'The interconnect [{#NAME}] status is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: a6d1c63e2aa04c71bac2eaef5b693110
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.interconnect["{#NAME}",status])=4'
                  name: 'HPE Synergy: Interconnect [{#NAME}]: Has warning status'
                  priority: WARNING
                  description: 'The interconnect [{#NAME}] status is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 6649436c06c345f8a394356e8a4fe546
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.interconnect["{#NAME}",status])=1'
                  name: 'HPE Synergy: Interconnect [{#NAME}]: Is disabled'
                  priority: INFO
                  description: 'The interconnect [{#NAME}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: hpe.synergy.get.interconnects
          lld_macro_paths:
            - lld_macro: '{#ENCLOSURE_NAME}'
              path: $.enclosureName
            - lld_macro: '{#NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.members
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: eae31026740c4de299a5e52753eb9445
          name: 'Logical enclosures discovery'
          type: DEPENDENT
          key: hpe.synergy.logical_enclosures.discovery
          description: 'A list of the logical enclosures.'
          item_prototypes:
            - uuid: 96e5588599854754b9c7513c6786d9a6
              name: 'Logical enclosure [{#NAME}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.logical_enclosure["{#NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the logical enclosure [{#NAME}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#NAME}")].first()'
              master_item:
                key: hpe.synergy.get.logical_enclosures
              tags:
                - tag: component
                  value: logical-enclosure
                - tag: component
                  value: raw
                - tag: logical-enclosure
                  value: '{#NAME}'
            - uuid: 785f3a94e8614810b7ccc84be779ad1d
              name: 'Logical enclosure [{#NAME}]: State'
              type: DEPENDENT
              key: 'hpe.synergy.logical_enclosure["{#NAME}",state]'
              description: |
                The current resource state of the logical enclosure:
                
                *Consistent* - this is the expected state of the logical enclosure. The logical enclosure configuration is consistent with the enclosure group, and the configuration of the hardware resources is consistent with the logical enclosure configuration;
                *Creating* - the logical enclosure is being created;
                *DeleteFailed* - the prior attempt to delete the logical enclosure failed. Retry the delete operation potentially with the force option. No other logical enclosure operations are allowed in this state;
                *Deleting* - the logical enclosure is being deleted;
                *Inconsistent* - the configuration of the logical enclosure differs from that of the enclosure group, or the configuration of the hardware resources is inconsistent with the logical enclosure configuration. Perform an Update from group, Reapply configuration, or Update firmware action as an appropriate to bring the configuration back into consistency;
                *Updating* - configuration changes are being applied to the hardware configuration.
              valuemap:
                name: 'Logical enclosure state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                - type: STR_REPLACE
                  parameters:
                    - Inconsistent
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Creating
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - DeleteFailed
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Deleting
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Consistent
                    - '4'
                - type: STR_REPLACE
                  parameters:
                    - Updating
                    - '5'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '5'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '6'
              master_item:
                key: 'hpe.synergy.logical_enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: logical-enclosure
                - tag: logical-enclosure
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: 1c17c2f49bea47bc978698e4b8d8281b
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.logical_enclosure["{#NAME}",state])=2'
                  name: 'HPE Synergy: Logical enclosure [{#NAME}]: Delete failed'
                  priority: AVERAGE
                  description: 'Indicator that the deletion of a logical enclosure failed.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 85354d24f47d45f48c5dda86b9f22fe3
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.logical_enclosure["{#NAME}",state])=0'
                  name: 'HPE Synergy: Logical enclosure [{#NAME}]: Is inconsistent'
                  priority: AVERAGE
                  description: 'The configuration of the logical enclosure differs from that of the enclosure group, or the configuration of the hardware resources is inconsistent with the logical enclosure configuration. Perform an Update from group, Reapply configuration, or Update firmware action as an appropriate to bring the configuration back into consistency.'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 0f1e0448aeaf464cb608d576eb42a481
              name: 'Logical enclosure [{#NAME}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.logical_enclosure["{#NAME}",status]'
              description: |
                The overall health status of the resource. The following are the valid values for the status of the resource:
                
                *OK* - indicates normal/informational behavior;
                *Disabled* - indicates that the resource is not operational;
                *Warning* - requires attention soon;
                *Critical* - requires immediate attention;
                *Unknown* - should be avoided, but there may be rare occasions when the status is unknown.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.logical_enclosure["{#NAME}",data]'
              tags:
                - tag: component
                  value: logical-enclosure
                - tag: logical-enclosure
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: b3af6beba595455eb7774b3c609e9108
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.logical_enclosure["{#NAME}",status])=0'
                  name: 'HPE Synergy: Logical enclosure [{#NAME}]: Has critical status'
                  priority: HIGH
                  description: 'The status of the logical enclosure [{#NAME}] is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 32061fadb9c74abab1a1d1371e2cf3e8
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.logical_enclosure["{#NAME}",status])=4'
                  name: 'HPE Synergy: Logical enclosure [{#NAME}]: Has warning status'
                  priority: WARNING
                  description: 'The status of the logical enclosure [{#NAME}] is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: c7ec2fb26b794b28b99eb321a3201fce
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.logical_enclosure["{#NAME}",status])=1'
                  name: 'HPE Synergy: Logical enclosure [{#NAME}]: Is disabled'
                  priority: INFO
                  description: 'The logical enclosure [{#NAME}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: hpe.synergy.get.logical_enclosures
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.members
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: b800eed59653494cb5383e91627f0ef7
          name: 'nPar discovery'
          type: DEPENDENT
          key: hpe.synergy.npar.discovery
          description: 'Electrically isolated hardware partition (nPar). Partition details are relevant only for enclosures with type "SDX".'
          item_prototypes:
            - uuid: 440aa83c441d490491b12ef31675428e
              name: 'Partition [{#ENCLOSURE_NAME}:{#PARTITION_ID}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.partition["{#PARTITION_ID}","{#ENCLOSURE_NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the partition [{#ENCLOSURE_NAME}:{#PARTITION_ID}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#ENCLOSURE_NAME}")].partitions[?(@.partitionID == "{#PARTITION_ID}")].first()'
              master_item:
                key: hpe.synergy.get.enclosures
              tags:
                - tag: component
                  value: partition
                - tag: component
                  value: raw
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
                - tag: partition
                  value: '{#PARTITION_ID}'
            - uuid: 8ee334ce899341a8b1292dd84d7b0af4
              name: 'Partition [{#ENCLOSURE_NAME}:{#PARTITION_ID}]: Devices count'
              type: DEPENDENT
              key: 'hpe.synergy.partition["{#PARTITION_ID}","{#ENCLOSURE_NAME}",device_count]'
              description: 'The number of blades in the partition.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.deviceCount
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
              master_item:
                key: 'hpe.synergy.partition["{#PARTITION_ID}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: component
                  value: partition
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
                - tag: partition
                  value: '{#PARTITION_ID}'
            - uuid: e090ef309a9a4f8a98d3c5e24bd53d4d
              name: 'Partition [{#ENCLOSURE_NAME}:{#PARTITION_ID}]: Health'
              type: DEPENDENT
              key: 'hpe.synergy.partition["{#PARTITION_ID}","{#ENCLOSURE_NAME}",health]'
              description: |
                Indicates the health of the partition and the health of its owned resources (blades and IO bays) as reported by the firmware. If a problem is detected with one of the resources, the health of the partition is reported as Degraded. If all the resources in the partition are operating correctly, the health of the partition is reported as OK.
                
                *NparDegrade* - one or more resources in the partition are unhealthy.
                *NparHealthInvalid* - a partition health is invalid.
                *NparHealthMax* - a delimiter defined by the firmware.
                *NparOk* - all the resources in the partition are healthy.
              valuemap:
                name: 'Partition health'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.partitionHealth
                - type: STR_REPLACE
                  parameters:
                    - NparDegrade
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - NparHealthInvalid
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - NparHealthMax
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - NparOk
                    - '3'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '3'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '4'
              master_item:
                key: 'hpe.synergy.partition["{#PARTITION_ID}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: component
                  value: health
                - tag: component
                  value: partition
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
                - tag: partition
                  value: '{#PARTITION_ID}'
              trigger_prototypes:
                - uuid: 1c85a47cfa96487f8c338afe21ad7ce3
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.partition["{#PARTITION_ID}","{#ENCLOSURE_NAME}",health])=0'
                  name: 'HPE Synergy: Partition [{#ENCLOSURE_NAME}:{#PARTITION_ID}]: Health is degraded'
                  priority: HIGH
                  description: 'One or more resources in the partition are unhealthy.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: fdf5fa892eda46aaa2551168e36428bc
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.partition["{#PARTITION_ID}","{#ENCLOSURE_NAME}",health])=1'
                  name: 'HPE Synergy: Partition [{#ENCLOSURE_NAME}:{#PARTITION_ID}]: Health is invalid'
                  priority: AVERAGE
                  description: 'The partition health is invalid.'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: fc5d550b6bdd4e2a891f4faa5e51f792
              name: 'Partition [{#ENCLOSURE_NAME}:{#PARTITION_ID}]: Memory'
              type: DEPENDENT
              key: 'hpe.synergy.partition["{#PARTITION_ID}","{#ENCLOSURE_NAME}",memory]'
              units: B
              description: 'The total memory of the partition.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.memoryMb
                - type: MULTIPLIER
                  parameters:
                    - '1048576'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.partition["{#PARTITION_ID}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: component
                  value: memory
                - tag: component
                  value: partition
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
                - tag: partition
                  value: '{#PARTITION_ID}'
            - uuid: b388a6aeae4e4bd4b14b0eb334b67934
              name: 'Partition [{#ENCLOSURE_NAME}:{#PARTITION_ID}]: Processors Count'
              type: DEPENDENT
              key: 'hpe.synergy.partition["{#PARTITION_ID}","{#ENCLOSURE_NAME}",processor_count]'
              description: 'The number of processors in the partition.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.processorCount
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
              master_item:
                key: 'hpe.synergy.partition["{#PARTITION_ID}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: component
                  value: cpu
                - tag: component
                  value: partition
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
                - tag: partition
                  value: '{#PARTITION_ID}'
            - uuid: ed4ad1bb9a534b40af4754cf31dc87f9
              name: 'Partition [{#ENCLOSURE_NAME}:{#PARTITION_ID}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.partition["{#PARTITION_ID}","{#ENCLOSURE_NAME}",status]'
              description: |
                Indicates whether the partition has been booted and also indicates its current power state:
                
                *ParStatusActive* - a partition is active when a 'poweron' operation is initiated on the partition and the firmware boot process is started;
                *ParStatusInactive* - a partition is in an inactive state after it has been created or shut down;
                *ParStatusInvalid* - a partition status is invalid;
                *ParStatusManualRepair* -  a partition under manual repair;
                *ParStatusMax* - a delimiter defined by the OA firmware;
                *ParStatusUndefined* - partition status is undefined;
                *ParStatusUnknown* - a partition might report an Unknown state after an OA restart. This state is possible when the firmware is not able to identify the correct partition state due to the internal firmware errors at an OA startup. The state is persistent and can only be cleared by force powering off of the partition from the OA. A partition in this state will not accept any partition operation except parstatus and force poweroff. Any active OS instances continue to run unhindered even when the partition is in an unknown state.
              valuemap:
                name: 'Partition status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.partitionStatus
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - ParStatusActive
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - ParStatusInactive
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - ParStatusInvalid
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - ParStatusManualRepair
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - ParStatusMax
                    - '4'
                - type: STR_REPLACE
                  parameters:
                    - ParStatusUndefined
                    - '5'
                - type: STR_REPLACE
                  parameters:
                    - ParStatusUnknown
                    - '6'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '6'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '6'
              master_item:
                key: 'hpe.synergy.partition["{#PARTITION_ID}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: component
                  value: partition
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
                - tag: partition
                  value: '{#PARTITION_ID}'
              trigger_prototypes:
                - uuid: 1a9c705957d34bfc976c23a8b1f38e14
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.partition["{#PARTITION_ID}","{#ENCLOSURE_NAME}",status])=2'
                  name: 'HPE Synergy: Partition [{#ENCLOSURE_NAME}:{#PARTITION_ID}]: Is invalid'
                  priority: AVERAGE
                  description: 'The partition status is invalid.'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: hpe.synergy.get.enclosures
          lld_macro_paths:
            - lld_macro: '{#ENCLOSURE_NAME}'
              path: $.enclosureName
            - lld_macro: '{#PARTITION_ID}'
              path: $.partitionID
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.members.[0].partitions'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 8346025282a044cd8dafc2521a596f18
          name: 'Power supplies discovery'
          type: DEPENDENT
          key: hpe.synergy.ps.discovery
          description: 'List of power supply bays in the enclosure.'
          item_prototypes:
            - uuid: 92d8618ee81742f6bb1cfdd63b51f3ea
              name: 'Power Supply [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the power Supply [{#ENCLOSURE_NAME}:{#BAY_NUMBER}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#ENCLOSURE_NAME}")].powerSupplyBays[?(@.bayNumber == "{#BAY_NUMBER}")].first()'
              master_item:
                key: hpe.synergy.get.enclosures
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: power
                - tag: component
                  value: raw
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: e748215b1d4a404ca0269909d321cdc6
              name: 'Power Supply [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Model'
              type: DEPENDENT
              key: 'hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",model]'
              value_type: CHAR
              description: 'The common descriptive model of the power supply.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.model
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: power
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: e0ac31d34ab34af383e56fb1c0a9972a
              name: 'Power Supply [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Output capacity'
              type: DEPENDENT
              key: 'hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",output_capacity]'
              units: W
              description: 'The output capacity of the power supply.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.outputCapacityWatts
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: power
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 98c72f6e11ab4dcba08c82793de9af96
              name: 'Power Supply [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Part number'
              type: DEPENDENT
              key: 'hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",part_number]'
              value_type: CHAR
              description: 'The part number of the power supply.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.partNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: power
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 31cc380acfec455bbb4828d4aeae1ddc
              name: 'Power Supply [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Presence'
              type: DEPENDENT
              key: 'hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",presence]'
              description: |
                Indicates whether a power supply is present:
                
                *Absent* - the device slot is empty;
                *PresenceNoOp* - the device slot is uninitialized;
                *PresenceUnknown* - the device presence is unknown;
                *Present* - the device slot has a device in it;
                *Subsumed* - the device slot is configured to be part of another device slot. Not applicable for the fan or power supply bays.
              valuemap:
                name: 'Device presence'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.devicePresence
                - type: STR_REPLACE
                  parameters:
                    - Absent
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - PresenceNoOp
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - PresenceUnknown
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Present
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Subsumed
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '2'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: power
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: 87ee5abdfdcf41459dd11678469a2fb4
              name: 'Power Supply [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Serial number'
              type: DEPENDENT
              key: 'hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",serial_number]'
              value_type: CHAR
              description: 'The unique serial number of the power supply.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.serialNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: power
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: ada2815275ce488f8ec1bc7a4a536681
              name: 'Power Supply [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Spare part number'
              type: DEPENDENT
              key: 'hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",spare_part_number]'
              value_type: CHAR
              description: 'The spare part number to be used when ordering an additional or replacement power supply of this type.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.sparePartNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: power
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
            - uuid: a2c1cf1e0f714e46af414d8c7427d3db
              name: 'Power Supply [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status]'
              description: |
                The overall health status of the resource. The following are the valid values for the status of the resource:
                
                *OK* - indicates normal/informational behavior;
                *Disabled* - indicates that the resource is not operational;
                *Warning* - requires attention soon;
                *Critical* - requires immediate attention;
                *Unknown* - should be avoided, but there may be rare occasions when the status is unknown.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",data]'
              tags:
                - tag: bay-number
                  value: '{#BAY_NUMBER}'
                - tag: component
                  value: power
                - tag: enclosure
                  value: '{#ENCLOSURE_NAME}'
              trigger_prototypes:
                - uuid: ce96e032cf49415aa341b238abcabd1b
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status])=0'
                  name: 'HPE Synergy: Power Supply [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Has critical status'
                  priority: HIGH
                  description: 'The status of the power supply [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 711695d95bc14ddfbe54be917c5e3340
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status])=4'
                  name: 'HPE Synergy: Power Supply [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Has warning status'
                  priority: WARNING
                  description: 'The status of the power supply [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 6d286b675b7546a5b429792345867d16
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.power_supply["{#BAY_NUMBER}","{#ENCLOSURE_NAME}",status])=1'
                  name: 'HPE Synergy: Power Supply [{#ENCLOSURE_NAME}:{#BAY_NUMBER}]: Is disabled'
                  priority: INFO
                  description: 'The status of Power Supply [{#ENCLOSURE_NAME}:{#BAY_NUMBER}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: hpe.synergy.get.enclosures
          lld_macro_paths:
            - lld_macro: '{#BAY_NUMBER}'
              path: $.bayNumber
            - lld_macro: '{#ENCLOSURE_NAME}'
              path: $.enclosureName
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.members.[0].powerSupplyBays'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: de1819e3eab74663b7cbd893c12ea540
          name: 'Racks discovery'
          type: DEPENDENT
          key: hpe.synergy.racks.discovery
          description: 'A list of the racks.'
          item_prototypes:
            - uuid: 8a68ba795abd445bb6832f8fb6fa5416
              name: 'Rack [{#NAME}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.rack["{#NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the rack [{#NAME}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#NAME}")].first()'
              master_item:
                key: hpe.synergy.get.racks
              tags:
                - tag: component
                  value: rack
                - tag: component
                  value: raw
                - tag: rack
                  value: '{#NAME}'
            - uuid: 921fa76608e4437d961af2409dddde0b
              name: 'Rack [{#NAME}]: State'
              type: DEPENDENT
              key: 'hpe.synergy.rack["{#NAME}",state]'
              description: 'The current state of the resource. the valid values include Adding, AddError, Configured, CredentialError, Refreshing, RefreshError, Removing, RemoveError, and Unmanaged.'
              valuemap:
                name: 'Rack state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                - type: STR_REPLACE
                  parameters:
                    - Adding
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - AddError
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - Configured
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - CredentialError
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Refreshing
                    - '4'
                - type: STR_REPLACE
                  parameters:
                    - RefreshError
                    - '5'
                - type: STR_REPLACE
                  parameters:
                    - Removing
                    - '6'
                - type: STR_REPLACE
                  parameters:
                    - RemoveError
                    - '7'
                - type: STR_REPLACE
                  parameters:
                    - Unmanaged
                    - '8'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '8'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '9'
              master_item:
                key: 'hpe.synergy.rack["{#NAME}",data]'
              tags:
                - tag: component
                  value: rack
                - tag: rack
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: 3a4eebe27b2046d3af9f6b7dca4f1aeb
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.rack["{#NAME}",state])=1'
                  name: 'HPE Synergy: Rack [{#NAME}]: Add error'
                  priority: AVERAGE
                  description: 'Adding the rack [{#NAME}] failed.'
                  tags:
                    - tag: scope
                      value: capacity
                    - tag: scope
                      value: notice
                - uuid: 73d7062711f4440dad2b20865dbc79f6
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.rack["{#NAME}",state])=3'
                  name: 'HPE Synergy: Rack [{#NAME}]: Has credential error'
                  priority: AVERAGE
                  description: 'The rack [{#NAME}] has credential error.'
                  tags:
                    - tag: scope
                      value: notice
                - uuid: 32b884dfb5164ae78f6274dc6ca4e0cb
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.rack["{#NAME}",state])=5'
                  name: 'HPE Synergy: Rack [{#NAME}]: Has refresh error'
                  priority: AVERAGE
                  description: 'The rack [{#NAME}] has refresh error.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 9ae1160a1bc242a9a1fe3fbf3b155ea7
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.rack["{#NAME}",state])=7'
                  name: 'HPE Synergy: Rack [{#NAME}]: Has remove error'
                  priority: AVERAGE
                  description: 'The rack [{#NAME}] has remove error.'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: b9473388000e4107b7a419611bc1b81a
              name: 'Rack [{#NAME}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.rack["{#NAME}",status]'
              description: |
                The overall health status of the resource. The following are the valid values for the status of the resource:
                
                *OK* - indicates normal/informational behavior;
                *Disabled* - indicates that the resource is not operational;
                *Warning* - requires attention soon;
                *Critical* - requires immediate attention;
                *Unknown* - should be avoided, but there may be rare occasions when the status is unknown.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.rack["{#NAME}",data]'
              tags:
                - tag: component
                  value: rack
                - tag: rack
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: f03657d149374102837fef92efc0bf28
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.rack["{#NAME}",status])=0'
                  name: 'HPE Synergy: Rack [{#NAME}]: Has critical status'
                  priority: HIGH
                  description: 'The rack [{#NAME}] status is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 74b635c0c6a7412395f36ac71fe56ec8
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.rack["{#NAME}",status])=4'
                  name: 'HPE Synergy: Rack [{#NAME}]: Has warning status'
                  priority: WARNING
                  description: 'The rack [{#NAME}] status is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 1e4124bef22448f7b99b3b0ecd29a3ab
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.rack["{#NAME}",status])=1'
                  name: 'HPE Synergy: Rack [{#NAME}]: Is disabled'
                  priority: INFO
                  description: 'The rack [{#NAME}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: hpe.synergy.get.racks
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.members
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: dfe04e3e5bfd4c73b0f02a6329e3149b
          name: 'Server hardware discovery'
          type: DEPENDENT
          key: hpe.synergy.server_hardware.discovery
          description: 'The server hardware resource is a representation of a physical server.'
          item_prototypes:
            - uuid: 44f23870429347fb8930669c98ded461
              name: 'Server [{#SERVER_NAME}:{#LOCATION}]: Processor cores count'
              type: DEPENDENT
              key: 'hpe.synergy.server_hardware.processor["{#LOCATION}",cores_count]'
              description: 'The number of cores available per processor.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.processorCoreCount
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.server_hardware["{#LOCATION}",data]'
              tags:
                - tag: component
                  value: cpu
                - tag: component
                  value: server
                - tag: location
                  value: '{#LOCATION}'
                - tag: server
                  value: '{#SERVER_NAME}'
            - uuid: 5c9d2faf103241879fd19b0e18774dbd
              name: 'Server [{#SERVER_NAME}:{#LOCATION}]: Processors count'
              type: DEPENDENT
              key: 'hpe.synergy.server_hardware.processor["{#LOCATION}",count]'
              description: 'The number of processors installed on this server hardware.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.processorCount
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.server_hardware["{#LOCATION}",data]'
              tags:
                - tag: component
                  value: cpu
                - tag: component
                  value: server
                - tag: location
                  value: '{#LOCATION}'
                - tag: server
                  value: '{#SERVER_NAME}'
            - uuid: dd1e7364fb614b2b9177f92b2ffe42a0
              name: 'Server [{#SERVER_NAME}:{#LOCATION}]: Processor speed'
              type: DEPENDENT
              key: 'hpe.synergy.server_hardware.processor["{#LOCATION}",speed]'
              units: '!MHz'
              description: 'The speed of the CPUs.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.processorSpeedMhz
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.server_hardware["{#LOCATION}",data]'
              tags:
                - tag: component
                  value: cpu
                - tag: component
                  value: server
                - tag: location
                  value: '{#LOCATION}'
                - tag: server
                  value: '{#SERVER_NAME}'
            - uuid: a62de8aa573146d1a2118abff9f43245
              name: 'Server [{#SERVER_NAME}:{#LOCATION}]: Processor type'
              type: DEPENDENT
              key: 'hpe.synergy.server_hardware.processor["{#LOCATION}",type]'
              value_type: CHAR
              description: 'The type of the CPU installed on this server hardware.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.processorType
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.server_hardware["{#LOCATION}",data]'
              tags:
                - tag: component
                  value: cpu
                - tag: component
                  value: server
                - tag: location
                  value: '{#LOCATION}'
                - tag: server
                  value: '{#SERVER_NAME}'
            - uuid: ee38861bdb044352a8937fe0d13d2e45
              name: 'Server [{#SERVER_NAME}:{#LOCATION}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.server_hardware["{#LOCATION}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the server [{#SERVER_NAME}:{#LOCATION}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#LOCATION}")].first()'
              master_item:
                key: hpe.synergy.get.server_hardware
              tags:
                - tag: component
                  value: raw
                - tag: component
                  value: server
                - tag: location
                  value: '{#LOCATION}'
                - tag: server
                  value: '{#SERVER_NAME}'
            - uuid: 67d50f909325417b9c47241cda44aa6b
              name: 'Server [{#SERVER_NAME}:{#LOCATION}]: Maintenance state'
              type: DEPENDENT
              key: 'hpe.synergy.server_hardware["{#LOCATION}",maintenance_state]'
              description: 'The maintenance flag of the Server Hardware - disruptive maintenance operations, such as firmware update, can cause many server hardware alerts to be generated in a short period of time. Example: network connectivity is lost or the server reset is detected. When this field is set, predefined alerts for this particular device are suppressed. This field is set only when firmware update is ongoing. The alerts are processed normally once firmware update operation completes. Possible values are Maintenance and Normal.'
              valuemap:
                name: 'Maintenance state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.maintenanceState
                  error_handler: DISCARD_VALUE
                - type: STR_REPLACE
                  parameters:
                    - Maintenance
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Normal
                    - '1'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '1'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '2'
              master_item:
                key: 'hpe.synergy.server_hardware["{#LOCATION}",data]'
              tags:
                - tag: component
                  value: server
                - tag: location
                  value: '{#LOCATION}'
                - tag: server
                  value: '{#SERVER_NAME}'
            - uuid: 90dc2db2bb6c4a968899ef04b8e2f96e
              name: 'Server [{#SERVER_NAME}:{#LOCATION}]: Maintenance state reason'
              type: DEPENDENT
              key: 'hpe.synergy.server_hardware["{#LOCATION}",maintenance_state_reason]'
              value_type: CHAR
              description: 'This field is set to Firmware update when the server is put under maintenance.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.maintenanceStateReason
                  error_handler: DISCARD_VALUE
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.server_hardware["{#LOCATION}",data]'
              tags:
                - tag: component
                  value: server
                - tag: location
                  value: '{#LOCATION}'
                - tag: server
                  value: '{#SERVER_NAME}'
            - uuid: 7239def772f84acfbfd017e1e835e7c5
              name: 'Server [{#SERVER_NAME}:{#LOCATION}]: Memory'
              type: DEPENDENT
              key: 'hpe.synergy.server_hardware["{#LOCATION}",memory]'
              units: B
              description: 'The amount of memory installed on this server hardware.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.memoryMb
                - type: MULTIPLIER
                  parameters:
                    - '1048576'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.server_hardware["{#LOCATION}",data]'
              tags:
                - tag: component
                  value: memory
                - tag: component
                  value: server
                - tag: location
                  value: '{#LOCATION}'
                - tag: server
                  value: '{#SERVER_NAME}'
            - uuid: 1a3dfc33d4d14d82846197e66550786d
              name: 'Server [{#SERVER_NAME}:{#LOCATION}]: Migration state'
              type: DEPENDENT
              key: 'hpe.synergy.server_hardware["{#LOCATION}",migration_state]'
              description: |
                The state of an ongoing virtual connect manager (VCM) migration:
                
                *Migrating* - the enclosure is in the process of migrating from VCM;
                *NotApplicable* - the enclosure did not require or has already completed the migration;
                *Unknown* - the migration state is unknown.
              valuemap:
                name: 'Migration state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.migrationState
                  error_handler: DISCARD_VALUE
                - type: STR_REPLACE
                  parameters:
                    - Migrating
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - NotApplicable
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '2'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '2'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '2'
              master_item:
                key: 'hpe.synergy.server_hardware["{#LOCATION}",data]'
              tags:
                - tag: component
                  value: server
                - tag: location
                  value: '{#LOCATION}'
                - tag: server
                  value: '{#SERVER_NAME}'
            - uuid: 0b6a9c030b154aa6ae112b809bfaf498
              name: 'Server [{#SERVER_NAME}:{#LOCATION}]: Model'
              type: DEPENDENT
              key: 'hpe.synergy.server_hardware["{#LOCATION}",model]'
              value_type: CHAR
              description: 'The model string of the full server hardware.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.model
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.server_hardware["{#LOCATION}",data]'
              tags:
                - tag: component
                  value: server
                - tag: location
                  value: '{#LOCATION}'
                - tag: server
                  value: '{#SERVER_NAME}'
            - uuid: 21edfb42e64e42878cccf66125d28b96
              name: 'Server [{#SERVER_NAME}:{#LOCATION}]: Part number'
              type: DEPENDENT
              key: 'hpe.synergy.server_hardware["{#LOCATION}",part_number]'
              value_type: CHAR
              description: 'The part number for this server hardware.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.partNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.server_hardware["{#LOCATION}",data]'
              tags:
                - tag: component
                  value: server
                - tag: location
                  value: '{#LOCATION}'
                - tag: server
                  value: '{#SERVER_NAME}'
            - uuid: a2c03713255841d38f0152a432920252
              name: 'Server [{#SERVER_NAME}:{#LOCATION}]: Power state'
              type: DEPENDENT
              key: 'hpe.synergy.server_hardware["{#LOCATION}",power_state]'
              description: 'The current power state of the server hardware. The values are Unknown, On, Off, PoweringOn, PoweringOff or Resetting.'
              valuemap:
                name: 'Physical server power state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.powerState
                - type: STR_REPLACE
                  parameters:
                    - PoweringOff
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - PoweringOn
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - Resetting
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - 'Off'
                    - '4'
                - type: STR_REPLACE
                  parameters:
                    - 'On'
                    - '5'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '5'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.server_hardware["{#LOCATION}",data]'
              tags:
                - tag: component
                  value: power
                - tag: component
                  value: server
                - tag: location
                  value: '{#LOCATION}'
                - tag: server
                  value: '{#SERVER_NAME}'
            - uuid: eaf38e9c25fb46de8e621220bca8aed5
              name: 'Server [{#SERVER_NAME}:{#LOCATION}]: Serial number'
              type: DEPENDENT
              key: 'hpe.synergy.server_hardware["{#LOCATION}",serial_number]'
              value_type: CHAR
              description: 'The serial number of the server hardware.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.serialNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1d
              master_item:
                key: 'hpe.synergy.server_hardware["{#LOCATION}",data]'
              tags:
                - tag: component
                  value: server
                - tag: location
                  value: '{#LOCATION}'
                - tag: server
                  value: '{#SERVER_NAME}'
            - uuid: 01be2f5f8b594caaab4ec25e3955405e
              name: 'Server [{#SERVER_NAME}:{#LOCATION}]: State'
              type: DEPENDENT
              key: 'hpe.synergy.server_hardware["{#LOCATION}",state]'
              description: |
                The current resource state of the server hardware. The allowable values are:
                
                *Unknown* - not initialized;
                *Adding* - a server is being added;
                *NoProfileApplied* - a server successfully added;
                *Monitored* - a server is being monitored;
                *Unmanaged* - a discovered and supported server;
                *Removing* - a server is being removed;
                *RemoveFailed* - an unsuccessful server removal;
                *Removed* - a server is successfully removed;
                *ApplyingProfile* - a server is successfully removed;
                *ProfileApplied* - a profile is successfully applied;
                *RemovingProfile* - a profile is being removed;
                *ProfileError* -  an Unsuccessful profile is applied or removed;
                *Unsupported* - a server model or version is not currently supported by the appliance;
                *UpdatingFirmware* - a server firmware update is in progress.
              valuemap:
                name: 'Server hardware state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Adding
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - NoProfileApplied
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Monitored
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Unmanaged
                    - '4'
                - type: STR_REPLACE
                  parameters:
                    - Removing
                    - '5'
                - type: STR_REPLACE
                  parameters:
                    - RemoveFailed
                    - '6'
                - type: STR_REPLACE
                  parameters:
                    - Removed
                    - '7'
                - type: STR_REPLACE
                  parameters:
                    - ApplyingProfile
                    - '8'
                - type: STR_REPLACE
                  parameters:
                    - ProfileApplied
                    - '9'
                - type: STR_REPLACE
                  parameters:
                    - RemovingProfile
                    - '10'
                - type: STR_REPLACE
                  parameters:
                    - ProfileError
                    - '11'
                - type: STR_REPLACE
                  parameters:
                    - Unsupported
                    - '12'
                - type: STR_REPLACE
                  parameters:
                    - UpdatingFirmware
                    - '13'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '13'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
              master_item:
                key: 'hpe.synergy.server_hardware["{#LOCATION}",data]'
              tags:
                - tag: component
                  value: server
                - tag: location
                  value: '{#LOCATION}'
                - tag: server
                  value: '{#SERVER_NAME}'
              trigger_prototypes:
                - uuid: ce0f72a3fe5e495cb8dd20b94a2779d6
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.server_hardware["{#LOCATION}",state])=11'
                  name: 'HPE Synergy: Server [{#SERVER_NAME}:{#LOCATION}]: Has profile error'
                  priority: AVERAGE
                  description: 'The unsuccessful profile application or removal.'
                  tags:
                    - tag: scope
                      value: notice
                - uuid: 5af93ca2f30d443ea18e8cf6ce139575
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.server_hardware["{#LOCATION}",state])=0'
                  name: 'HPE Synergy: Server [{#SERVER_NAME}:{#LOCATION}]: Is not initialized'
                  priority: WARNING
                  description: 'The server is not initialized.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: c03e5c9a910c4953bb18e6347a037ea6
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.server_hardware["{#LOCATION}",state])=12'
                  name: 'HPE Synergy: Server [{#SERVER_NAME}:{#LOCATION}]: Is unsupported'
                  priority: AVERAGE
                  description: 'The server model or version is not currently supported by the appliance.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 1364b9806a104d6d8412329d47e3e505
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.server_hardware["{#LOCATION}",state])=6'
                  name: 'HPE Synergy: Server [{#SERVER_NAME}:{#LOCATION}]: Remove failed'
                  priority: AVERAGE
                  description: 'The previous operation to remove the server hardware did not succeed. The operation should be re-attempted.'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 4c09bde33af048b7a3d7cfbcaae6ff54
              name: 'Server [{#SERVER_NAME}:{#LOCATION}]: State reason'
              type: DEPENDENT
              key: 'hpe.synergy.server_hardware["{#LOCATION}",state_reason]'
              value_type: CHAR
              description: |
                The reason for the current resource state of the server hardware. This only applies if the state is Unmanaged, otherwise it is set to NotApplicable. The allowable values are:
                
                *Unsupported* - a server model or version is not currently supported by the appliance;
                *UpdatingFirmware* - a server firmware update is in progress;
                *NotApplicable* - when PhysicalServerState is anything besides Unmanaged;
                *NotOwner* -  no claim on the server;
                *Inventory* - a server is added by the PDU;
                *Unconfigured* - the discovery data is incomplete or an iLO configuration has failed;
                *UnsupportedFirmware* - an iLO firmware version is below the minimum support level;
                *Interrupted* - when PhysicalServerState is a result of an operation that was terminated before completing;
                *CommunicationError* - an appliance cannot communicate with an iLO or an OA.
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.stateReason
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.server_hardware["{#LOCATION}",data]'
              tags:
                - tag: component
                  value: server
                - tag: location
                  value: '{#LOCATION}'
                - tag: server
                  value: '{#SERVER_NAME}'
            - uuid: 1fec814f88b6400ab70b9a164a25b297
              name: 'Server [{#SERVER_NAME}:{#LOCATION}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.server_hardware["{#LOCATION}",status]'
              description: |
                The overall health status of the resource. The following are the valid values for the status of the resource:
                
                *OK* - indicates normal/informational behavior;
                *Disabled* - indicates that the resource is not operational;
                *Warning* - requires attention soon;
                *Critical* - requires immediate attention;
                *Unknown* - should be avoided, but there may be rare occasions when the status is unknown.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.server_hardware["{#LOCATION}",data]'
              tags:
                - tag: component
                  value: server
                - tag: location
                  value: '{#LOCATION}'
                - tag: server
                  value: '{#SERVER_NAME}'
              trigger_prototypes:
                - uuid: 7db1e7eff2624546a065863a2d821287
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.server_hardware["{#LOCATION}",status])=0'
                  name: 'HPE Synergy: Server [{#SERVER_NAME}:{#LOCATION}]: Has critical status'
                  priority: HIGH
                  description: 'The status of the server [{#SERVER_NAME}:{#LOCATION}] is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 5c0da62e9a704d5ca556c04dbaa8e243
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.server_hardware["{#LOCATION}",status])=4'
                  name: 'HPE Synergy: Server [{#SERVER_NAME}:{#LOCATION}]: Has warning status'
                  priority: WARNING
                  description: 'The status of the server [{#SERVER_NAME}:{#LOCATION}] is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 79f661ed3a764515a915ba79a009ec4c
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.server_hardware["{#LOCATION}",status])=1'
                  name: 'HPE Synergy: Server [{#SERVER_NAME}:{#LOCATION}]: Is disabled'
                  priority: INFO
                  description: 'The server [{#SERVER_NAME}:{#LOCATION}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: availability
          trigger_prototypes:
            - uuid: cd1156d4df6e411690f94a2857beab16
              expression: 'last(/HPE Synergy by HTTP/hpe.synergy.server_hardware["{#LOCATION}",maintenance_state])=0 and length(last(/HPE Synergy by HTTP/hpe.synergy.server_hardware["{#LOCATION}",maintenance_state_reason]))>0'
              name: 'HPE Synergy: Server [{#SERVER_NAME}:{#LOCATION}]: Is in maintenance mode'
              opdata: 'Reason: {ITEM.LASTVALUE2}'
              priority: INFO
              description: 'The disruptive maintenance operations like firmware update can cause many server hardware alerts to be generated in a short period of time. Example: Network connectivity is lost or the server reset is detected.'
              tags:
                - tag: scope
                  value: notice
            - uuid: f74bf53c1b394aad9019b603de9a2c09
              expression: 'last(/HPE Synergy by HTTP/hpe.synergy.server_hardware["{#LOCATION}",state])=4 and length(last(/HPE Synergy by HTTP/hpe.synergy.server_hardware["{#LOCATION}",state_reason]))>0'
              name: 'HPE Synergy: Server [{#SERVER_NAME}:{#LOCATION}]: Is unmanaged'
              opdata: 'Reason: {ITEM.LASTVALUE2}'
              priority: AVERAGE
              description: 'Discovered a supported server.'
              tags:
                - tag: scope
                  value: notice
          master_item:
            key: hpe.synergy.get.server_hardware
          lld_macro_paths:
            - lld_macro: '{#LOCATION}'
              path: $.name
            - lld_macro: '{#SERVER_NAME}'
              path: $.serverName
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.members
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: a295686d8b5b4970b1ea5eb67bee55f1
          name: 'Storage pools discovery'
          type: DEPENDENT
          key: hpe.synergy.storage_pools.discovery
          description: 'A list of the storage pools.'
          item_prototypes:
            - uuid: 6f21fd88ccdb46ac83cd6a4beba12f95
              name: 'Storage pool [{#NAME}]: Capacity allocated'
              type: DEPENDENT
              key: 'hpe.synergy.storage.pools.capacity["{#NAME}",allocated]'
              units: B
              description: 'The capacity allocated from the storage pool in bytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.allocatedCapacity
              master_item:
                key: 'hpe.synergy.storage.pools["{#NAME}",data]'
              tags:
                - tag: component
                  value: storage
                - tag: pool
                  value: '{#NAME}'
            - uuid: e6ffbb837f2945418f200f8d57b8bf39
              name: 'Storage pool [{#NAME}]: Capacity free'
              type: DEPENDENT
              key: 'hpe.synergy.storage.pools.capacity["{#NAME}",free]'
              units: B
              description: 'The free capacity available from the storage pool in bytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.freeCapacity
              master_item:
                key: 'hpe.synergy.storage.pools["{#NAME}",data]'
              tags:
                - tag: component
                  value: storage
                - tag: pool
                  value: '{#NAME}'
            - uuid: b3f2dc2c62574ead8986ace6751738d0
              name: 'Storage pool [{#NAME}]: Capacity allocated to snapshots'
              type: DEPENDENT
              key: 'hpe.synergy.storage.pools.capacity["{#NAME}",snapshot]'
              units: B
              description: 'The pool capacity allocated to the snapshots in bytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.deviceSpecificAttributes.allocatedCapacity.snapshotAllocatedCapacity
              master_item:
                key: 'hpe.synergy.storage.pools["{#NAME}",data]'
              tags:
                - tag: component
                  value: storage
                - tag: pool
                  value: '{#NAME}'
            - uuid: 5d172531ae344037a94e23fd5c72165a
              name: 'Storage pool [{#NAME}]: Capacity total'
              type: DEPENDENT
              key: 'hpe.synergy.storage.pools.capacity["{#NAME}",total]'
              units: B
              description: 'The total capacity of the storage pool in bytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.totalCapacity
              master_item:
                key: 'hpe.synergy.storage.pools["{#NAME}",data]'
              tags:
                - tag: component
                  value: storage
                - tag: pool
                  value: '{#NAME}'
            - uuid: ee254d7b254641c7a5f762cbdd2dabf2
              name: 'Storage pool [{#NAME}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.storage.pools["{#NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the storage pool [{#NAME}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#NAME}")].first()'
              master_item:
                key: hpe.synergy.get.storage_pools
              tags:
                - tag: component
                  value: raw
                - tag: component
                  value: storage
                - tag: pool
                  value: '{#NAME}'
            - uuid: 52f63554126b4ee0a6fd6efdfea36356
              name: 'Storage pool [{#NAME}]: State'
              type: DEPENDENT
              key: 'hpe.synergy.storage.pools["{#NAME}",state]'
              description: |
                The current state of the resource:
                
                *AddFailed* - an attempt to add the resource failed;
                *Adding* - the resource is in the process of being added;
                *Configured* - the resource is configured;
                *Connected* - the appliance has connected to the resource;
                *Copying* - the resource is in the process of being copied;
                *CreateFailed* - an attempt to create the resource failed;
                *Creating* - the resource is in the process of being created;
                *DeleteFailed* - an attempt to delete the resource failed;
                *Deleting* - the resource is in the process of being deleted;
                *Discovered* - the resource has been discovered by the appliance, but it is not managed by the appliance;
                *Managed* - the resource is managed by the appliance;
                *Normal* - the resource is in a normal state;
                *UpdateFailed* - an attempt to update the resource failed;
                *Updating* - the resource is in the process of being updated.
              valuemap:
                name: 'Storage volume state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                - type: STR_REPLACE
                  parameters:
                    - AddFailed
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Adding
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - Configured
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Connected
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Copying
                    - '4'
                - type: STR_REPLACE
                  parameters:
                    - CreateFailed
                    - '5'
                - type: STR_REPLACE
                  parameters:
                    - Creating
                    - '6'
                - type: STR_REPLACE
                  parameters:
                    - DeleteFailed
                    - '7'
                - type: STR_REPLACE
                  parameters:
                    - Deleting
                    - '8'
                - type: STR_REPLACE
                  parameters:
                    - Discovered
                    - '9'
                - type: STR_REPLACE
                  parameters:
                    - Managed
                    - '10'
                - type: STR_REPLACE
                  parameters:
                    - Normal
                    - '11'
                - type: STR_REPLACE
                  parameters:
                    - UpdateFailed
                    - '12'
                - type: STR_REPLACE
                  parameters:
                    - Updating
                    - '13'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '13'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '14'
              master_item:
                key: 'hpe.synergy.storage.pools["{#NAME}",data]'
              tags:
                - tag: component
                  value: storage
                - tag: pool
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: ae6ac88132f14763ba1ab0488d78d79d
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.pools["{#NAME}",state])=0'
                  name: 'HPE Synergy: Storage pool [{#NAME}]: Add error'
                  priority: AVERAGE
                  description: 'Adding of the storage pool [{#NAME}] failed.'
                  tags:
                    - tag: scope
                      value: capacity
                    - tag: scope
                      value: notice
                - uuid: 439cee82cd6744d09b4597a6aeeda91a
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.pools["{#NAME}",state])=5'
                  name: 'HPE Synergy: Storage pool [{#NAME}]: Create failed'
                  priority: AVERAGE
                  description: 'Creating of the storage pool [{#NAME}] failed.'
                  tags:
                    - tag: scope
                      value: capacity
                    - tag: scope
                      value: notice
                - uuid: 91031655fd16446995f316b20e2c0bed
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.pools["{#NAME}",state])=7'
                  name: 'HPE Synergy: Storage pool [{#NAME}]: Delete failed'
                  priority: AVERAGE
                  description: 'Deletion of the storage pool [{#NAME}] failed.'
                  tags:
                    - tag: scope
                      value: notice
                - uuid: d0a7155241b34e1f9dd3e01203aee3ba
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.pools["{#NAME}",state])=12'
                  name: 'HPE Synergy: Storage pool [{#NAME}]: Update failed'
                  priority: AVERAGE
                  description: 'Updating of the storage pool [{#NAME}] failed.'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 9f3c42f517c64f9bb8869617438a9aff
              name: 'Storage pool [{#NAME}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.storage.pools["{#NAME}",status]'
              description: |
                The overall health status of the resource. The following are the valid values for the status of the resource:
                
                *OK* - indicates normal/informational behavior;
                *Disabled* - indicates that the resource is not operational;
                *Warning* - requires attention soon;
                *Critical* - requires immediate attention;
                *Unknown* - should be avoided, but there may be rare occasions when the status is unknown.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.storage.pools["{#NAME}",data]'
              tags:
                - tag: component
                  value: storage
                - tag: pool
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: bace21ba544d45b58541a3e2affde554
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.pools["{#NAME}",status])=0'
                  name: 'HPE Synergy: Storage pool [{#NAME}]: Has critical status'
                  priority: HIGH
                  description: 'The status of the storage pool [{#NAME}] is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: capacity
                - uuid: 135683c55d81457e90ba97d8e02165a6
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.pools["{#NAME}",status])=4'
                  name: 'HPE Synergy: Storage pool [{#NAME}]: Has warning status'
                  priority: WARNING
                  description: 'The status of the storage pool [{#NAME}] is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: capacity
                - uuid: 4d7c963326d54600b639ec2d14babeb7
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.pools["{#NAME}",status])=1'
                  name: 'HPE Synergy: Storage pool [{#NAME}]: Is disabled'
                  priority: INFO
                  description: 'The storage pool [{#NAME}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: capacity
          graph_prototypes:
            - uuid: a248b84392c44b4bbf9594550b35b8f8
              name: 'Storage pool [{#NAME}]: Capacity'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'HPE Synergy by HTTP'
                    key: 'hpe.synergy.storage.pools.capacity["{#NAME}",allocated]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'HPE Synergy by HTTP'
                    key: 'hpe.synergy.storage.pools.capacity["{#NAME}",free]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'HPE Synergy by HTTP'
                    key: 'hpe.synergy.storage.pools.capacity["{#NAME}",snapshot]'
          master_item:
            key: hpe.synergy.get.storage_pools
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.members
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 65c71880235345d69327b8cdfbd526e6
          name: 'Storage systems discovery'
          type: DEPENDENT
          key: hpe.synergy.storage_systems.discovery
          description: 'A list of the storage systems.'
          item_prototypes:
            - uuid: f1047d18a75f4981a5d1b16ccdafce5b
              name: 'Storage system [{#NAME}]: Capacity allocated'
              type: DEPENDENT
              key: 'hpe.synergy.storage.system.capacity["{#NAME}",allocated]'
              units: B
              description: 'The capacity allocated in bytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.allocatedCapacity
              master_item:
                key: 'hpe.synergy.storage.system["{#NAME}",data]'
              tags:
                - tag: component
                  value: storage
                - tag: system
                  value: '{#NAME}'
            - uuid: 501b587b1aa14263ac8d77325c8adfd3
              name: 'Storage system [{#NAME}]: Capacity free'
              type: DEPENDENT
              key: 'hpe.synergy.storage.system.capacity["{#NAME}",free]'
              units: B
              description: 'The free capacity of the storage system in bytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.freeCapacity
              master_item:
                key: 'hpe.synergy.storage.system["{#NAME}",data]'
              tags:
                - tag: component
                  value: storage
                - tag: system
                  value: '{#NAME}'
            - uuid: 1ee384a67e0c49b99beaca7c682e7f54
              name: 'Storage system [{#NAME}]: Capacity total'
              type: DEPENDENT
              key: 'hpe.synergy.storage.system.capacity["{#NAME}",total]'
              units: B
              description: 'The total capacity of the storage system in bytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.totalCapacity
              master_item:
                key: 'hpe.synergy.storage.system["{#NAME}",data]'
              tags:
                - tag: component
                  value: storage
                - tag: system
                  value: '{#NAME}'
            - uuid: 2f9bf8f7699945488201922c76f51675
              name: 'Storage system [{#NAME}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.storage.system["{#NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the storage system [{#NAME}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#NAME}")].first()'
              master_item:
                key: hpe.synergy.get.storage_systems
              tags:
                - tag: component
                  value: raw
                - tag: component
                  value: storage
                - tag: system
                  value: '{#NAME}'
            - uuid: 5de77ea6bd76408792e45e111d46c501
              name: 'Storage system [{#NAME}]: State'
              type: DEPENDENT
              key: 'hpe.synergy.storage.system["{#NAME}",state]'
              description: |
                The current state of the resource:
                
                *AddFailed* - an attempt to add the resource failed;
                *Adding* - the resource is in the process of being added;
                *Configured* - the resource is configured;
                *Connected* - the appliance has connected to the resource;
                *Copying* - the resource is in the process of being copied;
                *CreateFailed* - an attempt to create the resource failed;
                *Creating* - the resource is in the process of being created;
                *DeleteFailed* - an attempt to delete the resource failed;
                *Deleting* - the resource is in the process of being deleted;
                *Discovered* - the resource has been discovered by the appliance, but it is not managed by the appliance;
                *Managed* - the resource is managed by the appliance;
                *Normal* - the resource is in a normal state;
                *UpdateFailed* - an attempt to update the resource failed;
                *Updating* - the resource is in the process of being updated.
              valuemap:
                name: 'Storage volume state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                - type: STR_REPLACE
                  parameters:
                    - AddFailed
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Adding
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - Configured
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Connected
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Copying
                    - '4'
                - type: STR_REPLACE
                  parameters:
                    - CreateFailed
                    - '5'
                - type: STR_REPLACE
                  parameters:
                    - Creating
                    - '6'
                - type: STR_REPLACE
                  parameters:
                    - DeleteFailed
                    - '7'
                - type: STR_REPLACE
                  parameters:
                    - Deleting
                    - '8'
                - type: STR_REPLACE
                  parameters:
                    - Discovered
                    - '9'
                - type: STR_REPLACE
                  parameters:
                    - Managed
                    - '10'
                - type: STR_REPLACE
                  parameters:
                    - Normal
                    - '11'
                - type: STR_REPLACE
                  parameters:
                    - UpdateFailed
                    - '12'
                - type: STR_REPLACE
                  parameters:
                    - Updating
                    - '13'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '13'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '14'
              master_item:
                key: 'hpe.synergy.storage.system["{#NAME}",data]'
              tags:
                - tag: component
                  value: storage
                - tag: system
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: cfdbabe4ff584b96a961e395b3a4cda8
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.system["{#NAME}",state])=0'
                  name: 'HPE Synergy: Storage system [{#NAME}]: Add error'
                  priority: AVERAGE
                  description: 'Adding the storage system [{#NAME}] failed.'
                  tags:
                    - tag: scope
                      value: capacity
                    - tag: scope
                      value: notice
                - uuid: e759872ffa334bc2b73335b612238c82
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.system["{#NAME}",state])=5'
                  name: 'HPE Synergy: Storage system [{#NAME}]: Create failed'
                  priority: AVERAGE
                  description: 'Creating of the storage system [{#NAME}] failed.'
                  tags:
                    - tag: scope
                      value: capacity
                    - tag: scope
                      value: notice
                - uuid: 1df4613458b748b59d761d45f494920a
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.system["{#NAME}",state])=7'
                  name: 'HPE Synergy: Storage system [{#NAME}]: Delete failed'
                  priority: AVERAGE
                  description: 'Deletion of the storage system [{#NAME}] failed.'
                  tags:
                    - tag: scope
                      value: notice
                - uuid: 3c856acaa42e4ee0807713afba3937ac
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.system["{#NAME}",state])=12'
                  name: 'HPE Synergy: Storage system [{#NAME}]: Update failed'
                  priority: AVERAGE
                  description: 'Updating of the storage system [{#NAME}] failed.'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 5f9b2be3d232468e98451b380a624ae9
              name: 'Storage system [{#NAME}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.storage.system["{#NAME}",status]'
              description: |
                The overall health status of the resource. The following are the valid values for the status of the resource:
                
                *OK* - indicates normal/informational behavior;
                *Disabled* - indicates that the resource is not operational;
                *Warning* - requires attention soon;
                *Critical* - requires immediate attention;
                *Unknown* - should be avoided, but there may be rare occasions when the status is unknown.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.storage.system["{#NAME}",data]'
              tags:
                - tag: component
                  value: storage
                - tag: system
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: f8533d36153b4269916c7a9843ea8d5c
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.system["{#NAME}",status])=0'
                  name: 'HPE Synergy: Storage system [{#NAME}]: Has critical status'
                  priority: HIGH
                  description: 'The status of the storage system [{#NAME}] is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: capacity
                - uuid: fc278fec8e3d452bb953599a1cd42336
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.system["{#NAME}",status])=4'
                  name: 'HPE Synergy: Storage system [{#NAME}]: Has warning status'
                  priority: WARNING
                  description: 'The status of the storage system [{#NAME}] is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: capacity
                - uuid: 4e60a92c30ed4cf7960d7979a8e2fb77
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.system["{#NAME}",status])=1'
                  name: 'HPE Synergy: Storage system [{#NAME}]: Is disabled'
                  priority: INFO
                  description: 'The storage system [{#NAME}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: capacity
          graph_prototypes:
            - uuid: c5c21884eb714c009dc0289f426b62e7
              name: 'Storage system [{#NAME}]: Capacity'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'HPE Synergy by HTTP'
                    key: 'hpe.synergy.storage.system.capacity["{#NAME}",allocated]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'HPE Synergy by HTTP'
                    key: 'hpe.synergy.storage.system.capacity["{#NAME}",free]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'HPE Synergy by HTTP'
                    key: 'hpe.synergy.storage.system.capacity["{#NAME}",total]'
          master_item:
            key: hpe.synergy.get.storage_systems
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.members
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 8f274eade77c49abb1185f3545630653
          name: 'Storage volumes discovery'
          type: DEPENDENT
          key: hpe.synergy.storage_volumes.discovery
          description: 'A list of the storage volumes.'
          item_prototypes:
            - uuid: 6c5fcfa5f07e4c07a1a05d6a49e1e5cd
              name: 'Storage volume [{#NAME}]: Capacity allocated'
              type: DEPENDENT
              key: 'hpe.synergy.storage.volumes.capacity["{#NAME}",allocated]'
              units: B
              description: 'The capacity allocated in bytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.allocatedCapacity
              master_item:
                key: 'hpe.synergy.storage.volumes["{#NAME}",data]'
              tags:
                - tag: component
                  value: storage
                - tag: volume
                  value: '{#NAME}'
            - uuid: 67076354bbb34d839c23873898dab4bd
              name: 'Storage volume [{#NAME}]: Capacity provisioned'
              type: DEPENDENT
              key: 'hpe.synergy.storage.volumes.capacity["{#NAME}",provisioned]'
              units: B
              description: 'The total provisioned capacity of the volume in bytes.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.provisionedCapacity
              master_item:
                key: 'hpe.synergy.storage.volumes["{#NAME}",data]'
              tags:
                - tag: component
                  value: storage
                - tag: volume
                  value: '{#NAME}'
            - uuid: e02b8e2f502b4bfb8fa9fd17d2d4e416
              name: 'Storage volume [{#NAME}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.storage.volumes["{#NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the storage volume [{#NAME}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#NAME}")].first()'
              master_item:
                key: hpe.synergy.get.storage_volumes
              tags:
                - tag: component
                  value: raw
                - tag: component
                  value: storage
                - tag: volume
                  value: '{#NAME}'
            - uuid: 169c6201cabe48b89ff7591e9112394b
              name: 'Storage volume [{#NAME}]: State'
              type: DEPENDENT
              key: 'hpe.synergy.storage.volumes["{#NAME}",state]'
              description: |
                The current state of the resource:
                
                *AddFailed* - an attempt to add the resource failed;
                *Adding* - the resource is in the process of being added;
                *Configured* - the resource is configured;
                *Connected* - the appliance has connected to the resource;
                *Copying* - the resource is in the process of being copied;
                *CreateFailed* - an attempt to create the resource failed;
                *Creating* - the resource is in the process of being created;
                *DeleteFailed* - an attempt to delete the resource failed;
                *Deleting* - the resource is in the process of being deleted;
                *Discovered* - the resource has been discovered by the appliance, but it is not managed by the appliance;
                *Managed* - the resource is managed by the appliance;
                *Normal* - the resource is in a normal state;
                *UpdateFailed* - an attempt to update the resource failed;
                *Updating* - the resource is in the process of being updated.
              valuemap:
                name: 'Storage volume state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                - type: STR_REPLACE
                  parameters:
                    - AddFailed
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Adding
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - Configured
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Connected
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Copying
                    - '4'
                - type: STR_REPLACE
                  parameters:
                    - CreateFailed
                    - '5'
                - type: STR_REPLACE
                  parameters:
                    - Creating
                    - '6'
                - type: STR_REPLACE
                  parameters:
                    - DeleteFailed
                    - '7'
                - type: STR_REPLACE
                  parameters:
                    - Deleting
                    - '8'
                - type: STR_REPLACE
                  parameters:
                    - Discovered
                    - '9'
                - type: STR_REPLACE
                  parameters:
                    - Managed
                    - '10'
                - type: STR_REPLACE
                  parameters:
                    - Normal
                    - '11'
                - type: STR_REPLACE
                  parameters:
                    - UpdateFailed
                    - '12'
                - type: STR_REPLACE
                  parameters:
                    - Updating
                    - '13'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '13'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '14'
              master_item:
                key: 'hpe.synergy.storage.volumes["{#NAME}",data]'
              tags:
                - tag: component
                  value: storage
                - tag: volume
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: b13d8a034a214bb5bd82d9e573d06e7b
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.volumes["{#NAME}",state])=0'
                  name: 'HPE Synergy: Storage volume [{#NAME}]: Add error'
                  priority: AVERAGE
                  description: 'Adding the storage volume [{#NAME}] failed.'
                  tags:
                    - tag: scope
                      value: capacity
                    - tag: scope
                      value: notice
                - uuid: 15f5b0ded7d8430d9b6338d8ab4a26e7
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.volumes["{#NAME}",state])=5'
                  name: 'HPE Synergy: Storage volume [{#NAME}]: Create failed'
                  priority: AVERAGE
                  description: 'Creating of the storage volume [{#NAME}] failed.'
                  tags:
                    - tag: scope
                      value: capacity
                    - tag: scope
                      value: notice
                - uuid: d7b4d59197dc4471b3db746c527213ae
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.volumes["{#NAME}",state])=7'
                  name: 'HPE Synergy: Storage volume [{#NAME}]: Delete failed'
                  priority: AVERAGE
                  description: 'Deletion of the storage volume [{#NAME}] failed.'
                  tags:
                    - tag: scope
                      value: notice
                - uuid: c0b2dc67758446fa82c6bf9c92c76e93
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.volumes["{#NAME}",state])=12'
                  name: 'HPE Synergy: Storage volume [{#NAME}]: Update failed'
                  priority: AVERAGE
                  description: 'Updating of the storage volume [{#NAME}] failed.'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 6c9927a095e04feb808c05aa44b672d0
              name: 'Storage volume [{#NAME}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.storage.volumes["{#NAME}",status]'
              description: |
                The overall health status of the resource. The following are the valid values for the status of the resource:
                
                *OK* - indicates normal/informational behavior;
                *Disabled* - indicates that the resource is not operational;
                *Warning* - requires attention soon;
                *Critical* - requires immediate attention;
                *Unknown* - should be avoided, but there may be rare occasions when the status is unknown.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.storage.volumes["{#NAME}",data]'
              tags:
                - tag: component
                  value: storage
                - tag: volume
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: 284d76cba28a4fc195b4b825665bc570
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.volumes["{#NAME}",status])=0'
                  name: 'HPE Synergy: Storage volume [{#NAME}]: Has critical status'
                  priority: HIGH
                  description: 'The status of the storage volume [{#NAME}] is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: capacity
                - uuid: ab040784159040a1ad031015e9ebef73
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.volumes["{#NAME}",status])=4'
                  name: 'HPE Synergy: Storage volume [{#NAME}]: Has warning status'
                  priority: WARNING
                  description: 'The status of the storage volume [{#NAME}] is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: capacity
                - uuid: ea9c2c2993b74859b30caaeac8871982
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.storage.volumes["{#NAME}",status])=1'
                  name: 'HPE Synergy: Storage volume [{#NAME}]: Is disabled'
                  priority: INFO
                  description: 'The storage volume [{#NAME}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: availability
                    - tag: scope
                      value: capacity
          graph_prototypes:
            - uuid: f5530d63e0704ad884731cffc3a50051
              name: 'Storage volume [{#NAME}]: Capacity'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'HPE Synergy by HTTP'
                    key: 'hpe.synergy.storage.volumes.capacity["{#NAME}",allocated]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'HPE Synergy by HTTP'
                    key: 'hpe.synergy.storage.volumes.capacity["{#NAME}",provisioned]'
          master_item:
            key: hpe.synergy.get.storage_volumes
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.members
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: d4ba209881884b75b1edd7cca832be79
          name: 'Uplink sets discovery'
          type: DEPENDENT
          key: hpe.synergy.uplink_sets.discovery
          description: 'A list of the uplink sets.'
          item_prototypes:
            - uuid: 1469992463264badb3a80839414e9f2e
              name: 'Uplink set [{#NAME}]: Get data'
              type: DEPENDENT
              key: 'hpe.synergy.uplink_set["{#NAME}",data]'
              history: '0'
              value_type: TEXT
              description: 'Data of the uplink set [{#NAME}].'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.members[?(@.name == "{#NAME}")].first()'
              master_item:
                key: hpe.synergy.get.uplink_sets
              tags:
                - tag: component
                  value: network
                - tag: component
                  value: raw
                - tag: component
                  value: uplink-set
                - tag: uplink-set
                  value: '{#NAME}'
            - uuid: be09b2f2848d4143a396a9b0cb945ecc
              name: 'Uplink set [{#NAME}]: State'
              type: DEPENDENT
              key: 'hpe.synergy.uplink_set["{#NAME}",state]'
              value_type: CHAR
              description: 'The current state of the resource.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'hpe.synergy.uplink_set["{#NAME}",data]'
              tags:
                - tag: component
                  value: network
                - tag: component
                  value: uplink-set
                - tag: uplink-set
                  value: '{#NAME}'
            - uuid: 08fe02575307492ea4ad42a6bfa4a2a9
              name: 'Uplink set [{#NAME}]: Status'
              type: DEPENDENT
              key: 'hpe.synergy.uplink_set["{#NAME}",status]'
              description: |
                The overall health status of the resource. The following are the valid values for the status of the resource:
                
                *OK* - indicates normal/informational behavior;
                *Disabled* - indicates that the resource is not operational;
                *Warning* - requires attention soon;
                *Critical* - requires immediate attention;
                *Unknown* - should be avoided, but there may be rare occasions when the status is unknown.
              valuemap:
                name: 'Health status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 10m
                - type: STR_REPLACE
                  parameters:
                    - Critical
                    - '0'
                - type: STR_REPLACE
                  parameters:
                    - Disabled
                    - '1'
                - type: STR_REPLACE
                  parameters:
                    - OK
                    - '2'
                - type: STR_REPLACE
                  parameters:
                    - Unknown
                    - '3'
                - type: STR_REPLACE
                  parameters:
                    - Warning
                    - '4'
                - type: IN_RANGE
                  parameters:
                    - '0'
                    - '4'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '3'
              master_item:
                key: 'hpe.synergy.uplink_set["{#NAME}",data]'
              tags:
                - tag: component
                  value: network
                - tag: component
                  value: uplink-set
                - tag: uplink-set
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: 89514e78b6e949278e83c3a2372d0fb9
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.uplink_set["{#NAME}",status])=0'
                  name: 'HPE Synergy: Uplink set [{#NAME}]: Has critical status'
                  priority: HIGH
                  description: 'The status of the uplink set [{#NAME}] is critical. Needs immediate attention.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 09f23615c85f43758a05d89466b3ca31
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.uplink_set["{#NAME}",status])=4'
                  name: 'HPE Synergy: Uplink set [{#NAME}]: Has warning status'
                  priority: WARNING
                  description: 'The status of the uplink set [{#NAME}] is warning. Needs attention soon.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 57187189c1bc4269873b51ef91a010c4
                  expression: 'last(/HPE Synergy by HTTP/hpe.synergy.uplink_set["{#NAME}",status])=1'
                  name: 'HPE Synergy: Uplink set [{#NAME}]: Is disabled'
                  priority: INFO
                  description: 'The uplink set [{#NAME}] is currently not operational.'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: hpe.synergy.get.uplink_sets
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.members
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
      tags:
        - tag: class
          value: hardware
        - tag: class
          value: storage
        - tag: subclass
          value: server
        - tag: target
          value: hpe
        - tag: target
          value: synergy
      macros:
        - macro: '{$HPE.SYNERGY.API.HOST}'
          description: 'The hostname or IP address of the API host.'
          config:
            type: TEXT
            priority: '5'
            label: 'API host'
            description: 'The hostname or IP address of the API host.'
            required: 'YES'
        - macro: '{$HPE.SYNERGY.API.LOGIN_DOMAIN}'
          value: LOCAL
          description: 'User domain.'
          config:
            type: TEXT
            priority: '7'
            label: 'User domain'
            description: 'User domain.'
        - macro: '{$HPE.SYNERGY.API.PASSWORD}'
          type: SECRET_TEXT
          description: 'Specify password for API.'
          config:
            type: TEXT
            priority: '1'
            label: 'API password'
            description: 'Specify password for API.'
            required: 'YES'
        - macro: '{$HPE.SYNERGY.API.PORT}'
          value: '443'
          description: 'The API port.'
          config:
            type: TEXT
            priority: '6'
            label: 'API port'
            description: 'The API port. In the range from 1 to 65535 inclusive.'
            required: 'YES'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$HPE.SYNERGY.API.SCHEME}'
          value: https
          description: 'The API scheme (http/https).'
          config:
            type: TEXT
            priority: '4'
            label: 'API scheme (http/https)'
            description: 'The API scheme (http/https).'
            required: 'YES'
        - macro: '{$HPE.SYNERGY.API.USERNAME}'
          value: zabbix
          description: 'Specify user name for API.'
          config:
            type: TEXT
            priority: '2'
            label: 'API username'
            description: 'Specify user name for API.'
            required: 'YES'
        - macro: '{$HPE.SYNERGY.DATA.TIMEOUT}'
          value: 15s
          description: 'Response timeout for API.'
          config:
            type: TEXT
            priority: '3'
            section_name: Other
            label: 'API response timeout'
            description: 'Response timeout for API.'
      dashboards:
        - uuid: 144b6727a17542d58449cc66728c40b9
          name: 'Server overview'
          auto_start: 'NO'
          pages:
            - name: Enclosures
              widgets:
                - type: graphprototype
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'HPE Synergy by HTTP'
                        name: 'Enclosure [{#NAME}]: Power capacity'
                    - type: STRING
                      name: reference
                      value: AAAAA
            - name: 'Storage pools'
              widgets:
                - type: graphprototype
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'HPE Synergy by HTTP'
                        name: 'Storage pool [{#NAME}]: Capacity'
                    - type: STRING
                      name: reference
                      value: AAAAB
            - name: 'Storage systems'
              widgets:
                - type: graphprototype
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'HPE Synergy by HTTP'
                        name: 'Storage system [{#NAME}]: Capacity'
                    - type: STRING
                      name: reference
                      value: AAAAC
            - name: 'Storage volumes'
              widgets:
                - type: graphprototype
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'HPE Synergy by HTTP'
                        name: 'Storage volume [{#NAME}]: Capacity'
                    - type: STRING
                      name: reference
                      value: AAAAD
      valuemaps:
        - uuid: 20d3a73c6cc84329a5dfafff29de32cc
          name: Boolean
          mappings:
            - value: '0'
              newvalue: 'No'
            - value: '1'
              newvalue: 'Yes'
        - uuid: d3641b3e94ad495f8e0c5c49984a5aa1
          name: 'Device presence'
          mappings:
            - value: '0'
              newvalue: Absent
            - value: '1'
              newvalue: PresenceNoOp
            - value: '2'
              newvalue: PresenceUnknown
            - value: '3'
              newvalue: Present
            - value: '4'
              newvalue: Subsumed
        - uuid: 082018b109e24116bbd92f0657113165
          name: 'Enclosure state'
          mappings:
            - value: '0'
              newvalue: Adding
            - value: '1'
              newvalue: Configured
            - value: '2'
              newvalue: Configuring
            - value: '3'
              newvalue: Interrupted
            - value: '4'
              newvalue: Monitored
            - value: '5'
              newvalue: Pending
            - value: '6'
              newvalue: RemoveFailed
            - value: '7'
              newvalue: Removing
            - value: '8'
              newvalue: Unmanaged
            - value: '9'
              newvalue: Unsupported
            - value: '10'
              newvalue: Unknown
        - uuid: 05742432aca048ca96684ba52bd058ae
          name: 'Health status'
          mappings:
            - value: '0'
              newvalue: Critical
            - value: '1'
              newvalue: Disabled
            - value: '2'
              newvalue: OK
            - value: '3'
              newvalue: Unknown
            - value: '4'
              newvalue: Warning
        - uuid: 6cd4b888faa442c19392b959f1605179
          name: 'Hypervisor manager state'
          mappings:
            - value: '0'
              newvalue: Connected
            - value: '1'
              newvalue: Disconnected
            - value: '2'
              newvalue: Configuring
            - value: '3'
              newvalue: Error
            - value: '4'
              newvalue: Unknown
        - uuid: 930add5553ea42668e590c9824d9e8d3
          name: 'Link port state'
          mappings:
            - value: '0'
              newvalue: Disabled
            - value: '1'
              newvalue: Linked
            - value: '2'
              newvalue: Unlinked
            - value: '3'
              newvalue: Unknown
        - uuid: 556391b7f9c045c89d28ac52a1082635
          name: 'Logical enclosure state'
          mappings:
            - value: '0'
              newvalue: Inconsistent
            - value: '1'
              newvalue: Creating
            - value: '2'
              newvalue: DeleteFailed
            - value: '3'
              newvalue: Deleting
            - value: '4'
              newvalue: Consistent
            - value: '5'
              newvalue: Updating
            - value: '6'
              newvalue: Unknown
        - uuid: e26c553cffab4766866bf25639fb89da
          name: 'Maintenance state'
          mappings:
            - value: '0'
              newvalue: Maintenance
            - value: '1'
              newvalue: Normal
            - value: '2'
              newvalue: Unknown
        - uuid: c66615691cba4abc9c7adecc29bb346b
          name: 'MGMT port state'
          mappings:
            - value: '0'
              newvalue: Active
            - value: '1'
              newvalue: Disabled
            - value: '2'
              newvalue: I3s
            - value: '3'
              newvalue: Other
            - value: '4'
              newvalue: Standby
            - value: '5'
              newvalue: Unknown
        - uuid: 6feb2826df9244a8b6b7732c98090b63
          name: 'Migration state'
          mappings:
            - value: '0'
              newvalue: Migrating
            - value: '1'
              newvalue: NotApplicable
            - value: '2'
              newvalue: Unknown
        - uuid: b878a1503ac14781a142f69a587264ed
          name: 'Partition health'
          mappings:
            - value: '0'
              newvalue: NparDegrade
            - value: '1'
              newvalue: NparHealthInvalid
            - value: '2'
              newvalue: NparHealthMax
            - value: '3'
              newvalue: NparOk
            - value: '4'
              newvalue: Unknown
        - uuid: 2c6d8b81e7ee4407b17ca06739ac71f1
          name: 'Partition status'
          mappings:
            - value: '0'
              newvalue: ParStatusActive
            - value: '1'
              newvalue: ParStatusInactive
            - value: '2'
              newvalue: ParStatusInvalid
            - value: '3'
              newvalue: ParStatusManualRepair
            - value: '4'
              newvalue: ParStatusMax
            - value: '5'
              newvalue: ParStatusUndefined
            - value: '6'
              newvalue: ParStatusUnknown
        - uuid: 7daddccc109d41f8abf1e04ba1fbd358
          name: 'Physical server power state'
          mappings:
            - value: '0'
              newvalue: PoweringOff
            - value: '1'
              newvalue: PoweringOn
            - value: '2'
              newvalue: Resetting
            - value: '3'
              newvalue: Unknown
            - value: '4'
              newvalue: 'Off'
            - value: '5'
              newvalue: 'On'
        - uuid: fe093138fdd14f7f80fa4498d91d7fa0
          name: 'Power state'
          mappings:
            - value: '0'
              newvalue: EFuse
            - value: '1'
              newvalue: Reset
            - value: '2'
              newvalue: SoftReset
            - value: '3'
              newvalue: Unknown
        - uuid: 5a4901bdd6024256afbfebee6827e103
          name: 'Rack state'
          mappings:
            - value: '0'
              newvalue: Adding
            - value: '1'
              newvalue: AddError
            - value: '2'
              newvalue: Configured
            - value: '3'
              newvalue: CredentialError
            - value: '4'
              newvalue: Refreshing
            - value: '5'
              newvalue: RefreshError
            - value: '6'
              newvalue: Removing
            - value: '7'
              newvalue: RemoveError
            - value: '8'
              newvalue: Unmanaged
            - value: '9'
              newvalue: Unknown
        - uuid: ba5903d60953477aafd313d3688c8dd8
          name: 'Resource state'
          mappings:
            - value: '0'
              newvalue: Degraded
            - value: '1'
              newvalue: Failed
            - value: '2'
              newvalue: Misplaced
            - value: '3'
              newvalue: Missing
            - value: '4'
              newvalue: OK
            - value: '5'
              newvalue: Unknown
        - uuid: a545b93c790741a29b726f04f03cbc8f
          name: 'Server hardware state'
          mappings:
            - value: '0'
              newvalue: Unknown
            - value: '1'
              newvalue: Adding
            - value: '2'
              newvalue: NoProfileApplied
            - value: '3'
              newvalue: Monitored
            - value: '4'
              newvalue: Unmanaged
            - value: '5'
              newvalue: Removing
            - value: '6'
              newvalue: RemoveFailed
            - value: '7'
              newvalue: Removed
            - value: '8'
              newvalue: ApplyingProfile
            - value: '9'
              newvalue: ProfileApplied
            - value: '10'
              newvalue: RemovingProfile
            - value: '11'
              newvalue: ProfileError
            - value: '12'
              newvalue: Unsupported
            - value: '13'
              newvalue: UpdatingFirmware
        - uuid: 2d6f2f67dc114502ae699e873130ba23
          name: 'Service state'
          mappings:
            - value: '0'
              newvalue: Down
            - value: '1'
              newvalue: Up
        - uuid: 647f5a6d2ce54e78af163f8676f3f1e0
          name: 'State reason'
          mappings:
            - value: '0'
              newvalue: Missing
            - value: '1'
              newvalue: None
            - value: '2'
              newvalue: 'Not Added'
            - value: '3'
              newvalue: 'Not Owner'
            - value: '4'
              newvalue: 'Operation Failed'
            - value: '5'
              newvalue: Unowned
            - value: '6'
              newvalue: 'Unsupported Firmware'
            - value: '7'
              newvalue: 'Updating Firmware'
            - value: '8'
              newvalue: Unknown
        - uuid: e20d58a33c3b4a8891dda5da8b86cd5a
          name: 'Storage volume state'
          mappings:
            - value: '0'
              newvalue: AddFailed
            - value: '1'
              newvalue: Adding
            - value: '2'
              newvalue: Configured
            - value: '3'
              newvalue: Connected
            - value: '4'
              newvalue: Copying
            - value: '5'
              newvalue: CreateFailed
            - value: '6'
              newvalue: Creating
            - value: '7'
              newvalue: DeleteFailed
            - value: '8'
              newvalue: Deleting
            - value: '9'
              newvalue: Discovered
            - value: '10'
              newvalue: Managed
            - value: '11'
              newvalue: Normal
            - value: '12'
              newvalue: UpdateFailed
            - value: '13'
              newvalue: Updating
            - value: '14'
              newvalue: Unknown
    - uuid: 85ce114c802e4e28a5f3597e07d07032
      template: 'Kubernetes API server by HTTP'
      name: 'Kubernetes API server by HTTP'
      description: |
        Get Kubernetes API server metrics by HTTP agent from Prometheus metrics endpoint.
        
        Don't forget change macros {$KUBE.API.SERVER.URL}, {$KUBE.API.TOKEN}.
        Some metrics may not be collected depending on your Kubernetes API server instance version and configuration.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        The template to monitor Kubernetes API server that works without any external scripts.
        Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.
        
        Template `Kubernetes API server by HTTP` - collects metrics by HTTP agent from API server /metrics endpoint.
        
        ## Setup
        
        Internal service metrics are collected from /metrics endpoint.
        Template needs to use Authorization via API token.
        
        Set the following fields: `Kubernetes API server URL`, `API Authorization Token`.
        
        **Note:** Some metrics may not be collected depending on your Kubernetes API server instance version and configuration.
      vendor:
        name: Zabbix
        version: 8.0-2
      groups:
        - name: Templates/Applications
      items:
        - uuid: 28944ee2c0a3478e84612cd5650f3cd5
          name: 'Request terminations, rate'
          type: DEPENDENT
          key: kubernetes.api.apiserver_request_terminations
          value_type: FLOAT
          description: 'Number of requests which apiserver terminated in self-defense per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - apiserver_request_terminations_total
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: requests
        - uuid: 1ac74141a4b241b196bc47d0dee37a2c
          name: 'API server requests: 0'
          type: DEPENDENT
          key: kubernetes.api.apiserver_request_total_0.rate
          value_type: FLOAT
          description: 'Counter of apiserver requests broken out for each HTTP response code.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'apiserver_request_total{code = "0"}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: requests
            - tag: http-code
              value: '0'
        - uuid: d7f8363e1bc5424f89c7386fcbe6fb06
          name: 'API server requests: 2xx, rate'
          type: DEPENDENT
          key: kubernetes.api.apiserver_request_total_200.rate
          value_type: FLOAT
          description: 'Counter of apiserver requests broken out for each HTTP response code.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'apiserver_request_total{code =~ "2.."}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: requests
            - tag: http-code
              value: 2xx
        - uuid: 453852b621ca4a7cbc4d80e5327c80da
          name: 'API server requests: 3xx, rate'
          type: DEPENDENT
          key: kubernetes.api.apiserver_request_total_300.rate
          value_type: FLOAT
          description: 'Counter of apiserver requests broken out for each HTTP response code.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'apiserver_request_total{code =~ "3.."}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: requests
            - tag: http-code
              value: 3xx
        - uuid: 1f72779899f94620bc55870f5e2c2ca0
          name: 'API server requests: 4xx, rate'
          type: DEPENDENT
          key: kubernetes.api.apiserver_request_total_400.rate
          value_type: FLOAT
          description: 'Counter of apiserver requests broken out for each HTTP response code.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'apiserver_request_total{code =~ "4.."}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: requests
            - tag: http-code
              value: 4xx
        - uuid: 1c24d58b28bc423e868a965d689cf146
          name: 'API server requests: 5xx, rate'
          type: DEPENDENT
          key: kubernetes.api.apiserver_request_total_500.rate
          value_type: FLOAT
          description: 'Counter of apiserver requests broken out for each HTTP response code.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'apiserver_request_total{code =~ "5.."}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: requests
            - tag: http-code
              value: 5xx
          triggers:
            - uuid: 0e1ef1630b5d4cb98270564f324f5382
              expression: 'min(/Kubernetes API server by HTTP/kubernetes.api.apiserver_request_total_500.rate,5m)>{$KUBE.API.HTTP.SERVER.ERROR}'
              name: 'Kubernetes API server: Too many server errors'
              event_name: 'Kubernetes API server: Too many server errors (over {$KUBE.API.HTTP.SERVER.ERROR} for 5m)'
              priority: WARNING
              description: '"Kubernetes API server is experiencing high error rate (with 5xx HTTP code).'
              tags:
                - tag: scope
                  value: availability
        - uuid: 5bd8b2deaf1142369ba67afc7a41ab11
          name: 'TLS handshake errors, rate'
          type: DEPENDENT
          key: kubernetes.api.apiserver_tls_handshake_errors_total.rate
          value_type: FLOAT
          description: 'Number of requests dropped with ''TLS handshake error from'' error per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - apiserver_tls_handshake_errors_total
                - function
                - sum
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: tls
        - uuid: 54723f57a20a47a698fbf47cbec0f7a1
          name: 'Audit events, total'
          type: DEPENDENT
          key: kubernetes.api.audit_event_total
          value_type: FLOAT
          description: 'Accumulated number audit events generated and sent to the audit backend.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - apiserver_audit_event_total
                - function
                - sum
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: audit
        - uuid: de87284b8bd644398e4a88a064e206bb
          name: CPU
          type: DEPENDENT
          key: kubernetes.api.cpu.util
          value_type: FLOAT
          units: '%'
          description: 'Total user and system CPU usage ratio.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_cpu_seconds_total
                - value
                - ''
            - type: CHANGE_PER_SECOND
            - type: MULTIPLIER
              parameters:
                - '100'
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: cpu
        - uuid: e4e3c570a55a48689c145c4a2310c597
          name: 'Get API instance metrics'
          type: HTTP_AGENT
          key: kubernetes.api.get_metrics
          history: '0'
          value_type: TEXT
          description: 'Get raw metrics from API instance /metrics endpoint.'
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
          timeout: 15s
          url: '{$KUBE.API.SERVER.URL}'
          headers:
            - name: Authorization
              value: 'Bearer {$KUBE.API.TOKEN}'
          tags:
            - tag: component
              value: raw
        - uuid: 79db985ac8f645999fe8aa73b4073bfb
          name: Goroutines
          type: DEPENDENT
          key: kubernetes.api.go_goroutines
          value_type: FLOAT
          description: 'Number of goroutines that currently exist.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - go_goroutines
                - function
                - sum
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: goroutines
        - uuid: 2022d65c2f7a4f07bc1cba435a2be1e9
          name: 'Go threads'
          type: DEPENDENT
          key: kubernetes.api.go_threads
          value_type: FLOAT
          description: 'Number of OS threads created.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - go_threads
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: go-threads
        - uuid: 837c546cb3bc400ab7a62a672792f88b
          name: 'gRPCs messages received, rate'
          type: DEPENDENT
          key: kubernetes.api.grpc_client_msg_received.rate
          value_type: FLOAT
          description: 'Total number of gRPC stream messages received per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - grpc_client_msg_received_total
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: grpc
        - uuid: 353559f3b9684647a74bd429d80731b9
          name: 'gRPCs messages sent, rate'
          type: DEPENDENT
          key: kubernetes.api.grpc_client_msg_sent.rate
          value_type: FLOAT
          description: 'Total number of gRPC stream messages sent per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - grpc_client_msg_sent_total
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: grpc
        - uuid: 0850afe759684950be79135ed4f32c79
          name: 'gRPCs client started, rate'
          type: DEPENDENT
          key: kubernetes.api.grpc_client_started.rate
          value_type: FLOAT
          description: 'Total number of RPCs started per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - grpc_client_started_total
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: grpc
        - uuid: 187702b1c3a24d07aaf9cc07fa359095
          name: 'Fds max'
          type: DEPENDENT
          key: kubernetes.api.max_fds
          value_type: FLOAT
          description: 'Maximum allowed open file descriptors.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_max_fds
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: fds
        - uuid: 41f802305a234b1ab9fb0e89d1e40290
          name: 'Fds open'
          type: DEPENDENT
          key: kubernetes.api.open_fds
          value_type: FLOAT
          description: 'Number of open file descriptors.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_open_fds
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: fds
        - uuid: 53fd5211b6da47d3b3fc87ab8a2d0c33
          name: 'Resident memory, bytes'
          type: DEPENDENT
          key: kubernetes.api.process_resident_memory_bytes
          value_type: FLOAT
          units: B
          description: 'Resident memory size in bytes.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_resident_memory_bytes
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: memory
        - uuid: 010a983426c9407eb4b6bf7822b411ce
          name: 'Virtual memory, bytes'
          type: DEPENDENT
          key: kubernetes.api.process_virtual_memory_bytes
          value_type: FLOAT
          units: B
          description: 'Virtual memory size in bytes.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_virtual_memory_bytes
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: memory
        - uuid: 3f15d60ef7cb4a068424d5835d04a817
          name: 'HTTP requests: 2xx, rate'
          type: DEPENDENT
          key: kubernetes.api.rest_client_requests_total_200.rate
          value_type: FLOAT
          description: 'Number of HTTP requests with 2xx status code per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'rest_client_requests_total{code =~ "2.."}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: requests
            - tag: http-code
              value: 2xx
        - uuid: 450607dda045428fb6d4a96ca8888c19
          name: 'HTTP requests: 3xx, rate'
          type: DEPENDENT
          key: kubernetes.api.rest_client_requests_total_300.rate
          value_type: FLOAT
          description: 'Number of HTTP requests with 3xx status code per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'rest_client_requests_total{code =~ "3.."}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: requests
            - tag: http-code
              value: 3xx
        - uuid: f11b87e0bc5a41ff956391b6cb7115c5
          name: 'HTTP requests: 4xx, rate'
          type: DEPENDENT
          key: kubernetes.api.rest_client_requests_total_400.rate
          value_type: FLOAT
          description: 'Number of HTTP requests with 4xx status code per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'rest_client_requests_total{code =~ "4.."}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: requests
            - tag: http-code
              value: 4xx
        - uuid: 2588c2332fea48f8bae414e8b7c42184
          name: 'HTTP requests: 5xx, rate'
          type: DEPENDENT
          key: kubernetes.api.rest_client_requests_total_500.rate
          value_type: FLOAT
          description: 'Number of HTTP requests with 5xx status code per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'rest_client_requests_total{code =~ "5.."}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.api.get_metrics
          tags:
            - tag: component
              value: requests
            - tag: http-code
              value: 5xx
          triggers:
            - uuid: 4c79888da91448738092c86e5f427a6a
              expression: 'min(/Kubernetes API server by HTTP/kubernetes.api.rest_client_requests_total_500.rate,5m)>{$KUBE.API.HTTP.CLIENT.ERROR}'
              name: 'Kubernetes API server: Too many client errors'
              event_name: 'Kubernetes API server: Too many client errors (over {$KUBE.API.HTTP.CLIENT.ERROR} for 5m)'
              priority: WARNING
              description: '"Kubernetes API client is experiencing high error rate (with 5xx HTTP code).'
              tags:
                - tag: scope
                  value: availability
      discovery_rules:
        - uuid: 22c5e2a84d9542c1905d0c20f4ca6700
          name: 'Watchers metrics discovery'
          type: DEPENDENT
          key: kubernetes.api.apiserver_registered_watchers.discovery
          description: 'Discovery watchers by kind.'
          item_prototypes:
            - uuid: 09d0815f893c42c1b95721f7f908940a
              name: 'Watchers: {#KIND}'
              type: DEPENDENT
              key: 'kubernetes.api.apiserver_registered_watchers["{#KIND}"]'
              value_type: FLOAT
              description: 'Number of currently registered watchers for a given resource.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'apiserver_registered_watchers{kind = "{#KIND}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kubernetes.api.get_metrics
              tags:
                - tag: component
                  value: watchers
                - tag: kind
                  value: '{#KIND}'
          master_item:
            key: kubernetes.api.get_metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - 'apiserver_registered_watchers{kind =~ ".*"}'
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                  	var kind = item.labels.kind;
                  	if (!(lookup[kind])) {
                  		lookup[kind] = 1;
                  		result.push({ '{#KIND}': kind });
                  	}
                  });
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: 45ad0dd7331d4b9391d26b78838b0433
          name: 'Authentication requests discovery'
          type: DEPENDENT
          key: kubernetes.api.authenticated_user_requests.discovery
          description: 'Discovery authentication attempts by name.'
          item_prototypes:
            - uuid: 6950d30d0b1d4162acee45f184453fbd
              name: 'Authenticated requests: {#NAME}, rate'
              type: DEPENDENT
              key: 'kubernetes.api.authenticated_user_requests.rate["{#NAME}"]'
              value_type: FLOAT
              description: 'Counter of authenticated requests broken out by username per second.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'authenticated_user_requests{result = "{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: CHANGE_PER_SECOND
              master_item:
                key: kubernetes.api.get_metrics
              tags:
                - tag: component
                  value: authentication
                - tag: name
                  value: '{#NAME}'
          master_item:
            key: kubernetes.api.get_metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - 'authenticated_user_requests{username =~ ".*"}'
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                  	var name = item.labels.username;
                  	if (!(lookup[result])) {
                  		lookup[name] = 1;
                  		result.push({ '{#NAME}': name });
                  	}
                  });
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: ca23c310c71f4e88891ceae883527389
          name: 'Authentication attempts discovery'
          type: DEPENDENT
          key: kubernetes.api.authentication_attempts.discovery
          description: 'Discovery authentication attempts by result.'
          item_prototypes:
            - uuid: d9ddaa016a7c4ca381fbe857959dd0fd
              name: 'Authentication attempts: {#RESULT}, rate'
              type: DEPENDENT
              key: 'kubernetes.api.authentication_attempts.rate["{#RESULT}"]'
              value_type: FLOAT
              description: 'Authentication attempts by result per second.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'authentication_attempts{result = "{#RESULT}"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
                - type: CHANGE_PER_SECOND
              master_item:
                key: kubernetes.api.get_metrics
              tags:
                - tag: component
                  value: authentication
                - tag: result
                  value: '{#RESULT}'
          master_item:
            key: kubernetes.api.get_metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - 'authentication_attempts{result =~ ".*"}'
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                  	var result_api = item.labels.result;
                  	if (!(lookup[result])) {
                  		lookup[result_api] = 1;
                  		result.push({ '{#RESULT}': result_api });
                  	}
                  });
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: 8dcd7c95a9364efdb2fe64c651360ad4
          name: 'Etcd objects metrics discovery'
          type: DEPENDENT
          key: kubernetes.api.etcd_object_counts.discovery
          description: 'Discovery etcd objects by resource.'
          item_prototypes:
            - uuid: 75c15b57189d4cbeb6ed6397fc377e2a
              name: 'etcd objects: {#RESOURCE}'
              type: DEPENDENT
              key: 'kubernetes.api.etcd_object_counts["{#RESOURCE}"]'
              value_type: FLOAT
              description: 'Number of stored objects at the time of last check split by kind.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'etcd_object_counts{ resource = "{#RESOURCE}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kubernetes.api.get_metrics
              tags:
                - tag: component
                  value: etcd
                - tag: resource
                  value: '{#RESOURCE}'
          master_item:
            key: kubernetes.api.get_metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - 'etcd_object_counts{resource =~ ".*"}'
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                  	var resource = item.labels.resource;
                  	if (!(lookup[resource])) {
                  		lookup[resource] = 1;
                  		result.push({ '{#RESOURCE}': resource });
                  	}
                  });
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: 099e6ff46075457cba6b669a5880ceef
          name: 'gRPC completed requests discovery'
          type: DEPENDENT
          key: kubernetes.api.grpc_client_handled.discovery
          description: 'Discovery grpc completed requests by grpc code.'
          item_prototypes:
            - uuid: 690dc00ad92d44d0b9bc7db58c07bd8f
              name: 'gRPCs completed: {#GRPC_CODE}, rate'
              type: DEPENDENT
              key: 'kubernetes.api.grpc_client_handled_total.rate["{#GRPC_CODE}"]'
              value_type: FLOAT
              description: 'Total number of RPCs completed by the client regardless of success or failure per second.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'grpc_client_handled_total{grpc_code = "{#GRPC_CODE}"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
                - type: CHANGE_PER_SECOND
              master_item:
                key: kubernetes.api.get_metrics
              tags:
                - tag: component
                  value: grpc
                - tag: grpc-code
                  value: '{#GRPC_CODE}'
          master_item:
            key: kubernetes.api.get_metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - 'grpc_client_handled_total{grpc_code =~ ".*"}'
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                  	var grpc_code = item.labels.grpc_code;
                  	if (!(lookup[grpc_code])) {
                  		lookup[grpc_code] = 1;
                  		result.push({ '{#GRPC_CODE}': grpc_code });
                  	}
                  });
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: 948e1d84d44642a78f59c92271a21a68
          name: 'Requests inflight discovery'
          type: DEPENDENT
          key: kubernetes.api.inflight_requests.discovery
          description: 'Discovery requests inflight by kind.'
          item_prototypes:
            - uuid: 5076679154cc464ebab0b678f65c8853
              name: 'Requests current: {#KIND}'
              type: DEPENDENT
              key: 'kubernetes.api.current_inflight_requests["{#KIND}"]'
              value_type: FLOAT
              description: 'Maximal number of currently used inflight request limit of this apiserver per request kind in last second.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'apiserver_current_inflight_requests{request_kind = "{#KIND}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kubernetes.api.get_metrics
              tags:
                - tag: component
                  value: requests
                - tag: kind
                  value: '{#KIND}'
          master_item:
            key: kubernetes.api.get_metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - 'apiserver_current_inflight_requests{request_kind =~ ".*"}'
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                  	var request_kind = item.labels.request_kind;
                  	if (!(lookup[request_kind])) {
                  		lookup[request_kind] = 1;
                  		result.push({ '{#KIND}': request_kind });
                  	}
                  });
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: 7cd3ef5e2c874db18088b3531c944b25
          name: 'Long-running requests'
          type: DEPENDENT
          key: kubernetes.api.longrunning_gauge.discovery
          description: 'Discovery of long-running requests by verb, resource and scope.'
          item_prototypes:
            - uuid: feee53d3fc69401ba359ecd97788e552
              name: 'Long-running ["{#VERB}"] requests ["{#RESOURCE}"]: {#SCOPE}'
              type: DEPENDENT
              key: 'kubernetes.api.longrunning_gauge["{#RESOURCE}","{#SCOPE}","{#VERB}"]'
              value_type: FLOAT
              description: 'Gauge of all active long-running apiserver requests broken out by verb, resource and scope. Not all requests are tracked this way.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'apiserver_longrunning_gauge{resource = "{#RESOURCE}", scope = "{#SCOPE}", verb = "{#VERB}"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kubernetes.api.get_metrics
              tags:
                - tag: component
                  value: requests
                - tag: resource
                  value: '{#RESOURCE}'
                - tag: scope
                  value: '{#SCOPE}'
                - tag: verb
                  value: '{#VERB}'
          master_item:
            key: kubernetes.api.get_metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - 'apiserver_longrunning_gauge{resource =~ ".*", scope =~ ".*", verb =~ ".*"}'
              error_handler: DISCARD_VALUE
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                  	var request_kind = item.labels.resource + item.labels.scope + item.labels.verb;
                  	if (!(lookup[request_kind])) {
                  		lookup[request_kind] = 1;
                  		result.push({
                  			'{#RESOURCE}': item.labels.resource,
                  			'{#SCOPE}': item.labels.scope,
                  			'{#VERB}': item.labels.verb
                  		});
                  	}
                  });
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: 7c5ffdbafc5e4e349cc62ed0d0c0f20f
          name: 'Request duration histogram'
          type: DEPENDENT
          key: kubernetes.api.requests_bucket.discovery
          description: 'Discovery raw data and percentile items of request duration.'
          item_prototypes:
            - uuid: 5135a1bc92514c79965edea9d7d2a47e
              name: '["{#VERB}"] Requests bucket: {#LE}'
              type: DEPENDENT
              key: 'kubernetes.api.request_duration_seconds_bucket[{#LE},"{#VERB}"]'
              history: 1h
              value_type: FLOAT
              trends: '0'
              discover: NO_DISCOVER
              description: 'Response latency distribution in seconds for each verb.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'apiserver_request_duration_seconds_bucket{le="{#LE}",verb="{#VERB}"}'
                    - function
                    - sum
              master_item:
                key: kubernetes.api.get_metrics
              tags:
                - tag: component
                  value: requests
                - tag: verb
                  value: '{#VERB}'
            - uuid: a4f39bb87ef248edbb578c0c89baba46
              name: '["{#VERB}"] Requests, p50'
              type: CALCULATED
              key: 'kubernetes.api.request_duration_seconds_p50["{#VERB}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.api.request_duration_seconds_bucket[*,"{#VERB}"],5m,50)'
              description: '50 percentile of response latency distribution in seconds for each verb.'
              tags:
                - tag: component
                  value: requests
                - tag: verb
                  value: '{#VERB}'
            - uuid: 12d65aff584e459586284967e570fc0a
              name: '["{#VERB}"] Requests, p90'
              type: CALCULATED
              key: 'kubernetes.api.request_duration_seconds_p90["{#VERB}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.api.request_duration_seconds_bucket[*,"{#VERB}"],5m,90)'
              description: '90 percentile of response latency distribution in seconds for each verb.'
              tags:
                - tag: component
                  value: requests
                - tag: verb
                  value: '{#VERB}'
            - uuid: 3e900f1e4cab4edba4d068f1b6759428
              name: '["{#VERB}"] Requests, p95'
              type: CALCULATED
              key: 'kubernetes.api.request_duration_seconds_p95["{#VERB}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.api.request_duration_seconds_bucket[*,"{#VERB}"],5m,95)'
              description: '95 percentile of response latency distribution in seconds for each verb.'
              tags:
                - tag: component
                  value: requests
                - tag: verb
                  value: '{#VERB}'
            - uuid: a34c3c5f5f844c46a4d3f148cacd3fd3
              name: '["{#VERB}"] Requests, p99'
              type: CALCULATED
              key: 'kubernetes.api.request_duration_seconds_p99["{#VERB}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.api.request_duration_seconds_bucket[*,"{#VERB}"],5m,99)'
              description: '99 percentile of response latency distribution in seconds for each verb.'
              tags:
                - tag: component
                  value: requests
                - tag: verb
                  value: '{#VERB}'
          graph_prototypes:
            - uuid: a974cb068f184b7385bf5eb2e4ba084a
              name: 'Kubernetes API: ["{#VERB}"] Requests latency'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'Kubernetes API server by HTTP'
                    key: 'kubernetes.api.request_duration_seconds_p90["{#VERB}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'Kubernetes API server by HTTP'
                    key: 'kubernetes.api.request_duration_seconds_p95["{#VERB}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'Kubernetes API server by HTTP'
                    key: 'kubernetes.api.request_duration_seconds_p99["{#VERB}"]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'Kubernetes API server by HTTP'
                    key: 'kubernetes.api.request_duration_seconds_p50["{#VERB}"]'
          master_item:
            key: kubernetes.api.get_metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - '{__name__=~ "apiserver_request_duration_*", verb =~ ".*"}'
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	lookup_histogram = {},
                  	result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                  	if (item.name === 'apiserver_request_duration_seconds_count') {
                  		var label_verb = item.labels.verb;
                  		if (lookup[label_verb]) {
                  			return;
                  		}
                  		lookup[label_verb] = 1;
                  		result.push({
                  			'{#TYPE}': 'totals',
                  			'{#VERB}': label_verb
                  		});
                  
                  	}
                  	else if (item.name === 'apiserver_request_duration_seconds_bucket') {
                  		var labels = item.labels.verb + item.labels.le;
                  
                  		if (lookup_histogram[labels]) {
                  			return;
                  		}
                  
                  		lookup_histogram[labels] = 1;
                  		result.push({
                  			'{#TYPE}': 'buckets',
                  			'{#VERB}': item.labels.verb,
                  			'{#LE}': item.labels.le
                  		});
                  	}
                  });
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          overrides:
            - name: 'bucket item'
              step: '1'
              filter:
                conditions:
                  - macro: '{#TYPE}'
                    value: buckets
              operations:
                - operator: LIKE
                  value: bucket
                  discover: DISCOVER
            - name: 'total item'
              step: '2'
              filter:
                conditions:
                  - macro: '{#TYPE}'
                    value: totals
              operations:
                - operator: NOT_LIKE
                  value: bucket
                  discover: DISCOVER
        - uuid: d015cafd6e9f4707bb78125ff17cc679
          name: 'Workqueue metrics discovery'
          type: DEPENDENT
          key: kubernetes.api.workqueue.discovery
          description: 'Discovery workqueue metrics by name.'
          item_prototypes:
            - uuid: cf58e773a5684eafa74b56ed43490148
              name: '["{#NAME}"] Workqueue adds total, rate'
              type: DEPENDENT
              key: 'kubernetes.api.workqueue_adds_total.rate["{#NAME}"]'
              value_type: FLOAT
              description: 'Total number of adds handled by workqueue per second.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'workqueue_adds_total{name = "{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: CHANGE_PER_SECOND
              master_item:
                key: kubernetes.api.get_metrics
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
            - uuid: 4fe45ff01cdf4bdf85e74a52d2d3b917
              name: '["{#NAME}"] Workqueue depth'
              type: DEPENDENT
              key: 'kubernetes.api.workqueue_depth["{#NAME}"]'
              value_type: FLOAT
              description: 'Current depth of workqueue.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'workqueue_depth{name = "{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kubernetes.api.get_metrics
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
          master_item:
            key: kubernetes.api.get_metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - 'workqueue_adds_total{name =~ ".*"}'
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                  	var name = item.labels.name;
                  	if (!(lookup[name])) {
                  		lookup[name] = 1;
                  		result.push({ '{#NAME}': name });
                  	}
                  });
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
      tags:
        - tag: class
          value: software
        - tag: subclass
          value: automation
        - tag: subclass
          value: containers
        - tag: subclass
          value: deploy
        - tag: subclass
          value: development
        - tag: subclass
          value: virtualization
        - tag: target
          value: api-server
        - tag: target
          value: kubernetes
      macros:
        - macro: '{$KUBE.API.HTTP.CLIENT.ERROR}'
          value: '2'
          description: 'Maximum number of HTTP client requests failures used for trigger.'
          config:
            type: TEXT
            priority: '3'
            section_name: Thresholds
            label: 'HTTP Client Error Threshold'
            description: 'Maximum number of HTTP client request failures allowed before triggering an alert. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$KUBE.API.HTTP.SERVER.ERROR}'
          value: '2'
          description: 'Maximum number of HTTP server requests failures used for trigger.'
          config:
            type: TEXT
            priority: '4'
            section_name: Thresholds
            label: 'HTTP Server Error Threshold'
            description: 'Maximum number of HTTP server request failures allowed before triggering an alert. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$KUBE.API.SERVER.URL}'
          value: 'https://localhost:6443/metrics'
          description: 'Kubernetes API server metrics endpoint URL.'
          config:
            type: TEXT
            priority: '2'
            label: 'Kubernetes API server URL'
            description: 'URL to access the Kubernetes API server metrics endpoint.'
            required: 'YES'
        - macro: '{$KUBE.API.TOKEN}'
          type: SECRET_TEXT
          description: 'API Authorization Token.'
          config:
            type: TEXT
            priority: '1'
            label: 'API Authorization Token'
            description: 'Token used for API authorization to access the Kubernetes API server.'
            required: 'YES'
      dashboards:
        - uuid: 5dd45bdfb5ed45bd9e3b26f01806820f
          name: 'API server overview'
          pages:
            - name: 'HTTP requests rate'
              widgets:
                - type: graph
                  width: '72'
                  height: '10'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Kubernetes API server by HTTP'
                        name: 'Kubernetes API: HTTP requests rate'
                    - type: STRING
                      name: reference
                      value: AAAAA
            - name: 'Requests duration histogram'
              widgets:
                - type: graphprototype
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Kubernetes API server by HTTP'
                        name: 'Kubernetes API: ["{#VERB}"] Requests latency'
                    - type: STRING
                      name: reference
                      value: AAAAB
    - uuid: 07695028a2ba4b66a5414797bec791df
      template: 'Kubernetes cluster state by HTTP'
      name: 'Kubernetes cluster state by HTTP'
      description: |
        Get Kubernetes state metrics by HTTP.
        Metrics are collected by requests to Kubernetes API.
        
        Don't forget to read the README.md for the correct setup of the template.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        The template to monitor Kubernetes state.
        It works without external scripts and uses the script item to make HTTP requests to the Kubernetes API.
        
        Template `Kubernetes cluster state by HTTP` - collects metrics by HTTP agent from kube-state-metrics endpoint and Kubernetes API.
        
        **Note:** Some metrics may not be collected depending on your Kubernetes version and configuration.
        
        ## Setup
        
        Install the [Zabbix Helm Chart](https://git.zabbix.com/projects/ZT/repos/kubernetes-helm/browse?at=refs%2Fheads%2Fmaster) in your Kubernetes cluster.
        Internal service metrics are collected from kube-state-metrics endpoint.
        
        Template needs to use authorization via API token.
        
        Set the `Kubernetes API URL` such as `<scheme>://<host>:<port>`.
        
        Get the generated service account token using the command:
        
        `kubectl get secret zabbix-zabbix-helm-chart -n monitoring -o jsonpath={.data.token} | base64 -d`
        
        Then set it to the field: `API Authorization Token`.
        Set `State Endpoint Name` with Kube state metrics endpoint name. See `kubectl -n monitoring get ep`. Default: `zabbix-kube-state-metrics`.
        
        **Note:** If you wish to monitor Controller Manager and Scheduler components, you might need to set the `--binding-address` option for them to the address where Zabbix proxy can reach them.
        For example, for clusters created with `kubeadm` it can be set in the following manifest files (changes will be applied immediately):
        
        - /etc/kubernetes/manifests/kube-controller-manager.yaml
        - /etc/kubernetes/manifests/kube-scheduler.yaml
        
        Depending on your Kubernetes distribution, you might need to adjust `Control Plane Taint` field (for example, set it to `node-role.kubernetes.io/master` for OpenShift).
        
        **Note:** Some metrics may not be collected depending on your Kubernetes version and configuration.
        
        Set up the fields to filter the metrics of discovered Kubelets by node names:
        
        - `Kubelet Node Matches Filter`
        - `Kubelet Node Exclude Filter`
        
        Set up fields to filter metrics by namespace:
        
        - `Namespace Matches Filter`
        - `Namespace Exclude Filter`
        
        Set up fields to filter node metrics by nodename:
        
        - `Node Matches Filter`
        - `Node Exclude Filter`
        
        **Note:** If you have a large cluster, it is highly recommended to set a filter for discoverable namespaces.
        
        You can use the `Kubelet Labels Filter` and `Kubelet Annotations Filter` fields for advanced filtering of kubelets by node labels and annotations.
        
        Notes about labels and annotations filters:
        
        - Values should be specified separated by commas and must have the key/value form with support for regular expressions in the value (`key1: value, key2: regexp`).
        - ECMAScript syntax is used for regular expressions.
        - Filters are applied if such label key exists for the entity that is being filtered (it means that if you specify a key in the filter, entities that do not have this key will not be affected by the filter and will still be discovered, and only entities containing that key will be filtered by the value).
        - You can also use the exclamation point symbol (`!`) to invert the filter (`!key: value`).
        
        For example: `kubernetes.io/hostname: kubernetes-node[5-25], !node-role.kubernetes.io/ingress: .*`. As a result, the kubelets on nodes 5-25 without the "ingress" role will be discovered.
        
        
        See the Kubernetes documentation for details about labels and annotations:
        
        - <https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/>
        - <https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/>
        
        You can also set up evaluation periods for replica mismatch triggers (Deployments, ReplicaSets, StatefulSets) with the field `Replica Mismatch Evaluation Period`, which supports context and regular expressions.
      vendor:
        name: Zabbix
        version: 8.0-3
      groups:
        - name: Templates/Applications
      items:
        - uuid: 41c79d9286734cc3b0e3aa5ef729e5fe
          name: 'Get component statuses'
          type: HTTP_AGENT
          key: kube.componentstatuses
          history: '0'
          value_type: TEXT
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
          timeout: 10s
          url: '{$KUBE.API.URL}{$KUBE.API.COMPONENTSTATUSES.ENDPOINT}'
          status_codes: '200, 403'
          headers:
            - name: Authorization
              value: 'Bearer {$KUBE.API.TOKEN}'
          tags:
            - tag: component
              value: raw
        - uuid: e40b126a0cf64ce6bfed3b3de1d4dfa8
          name: 'Control plane LLD'
          type: SCRIPT
          key: kube.control_plane.lld
          history: '0'
          value_type: TEXT
          params: |
            var Kube = {
            	params: {},
            
            	setParams: function (params) {
            		['api_token', 'api_url', 'api_server_scheme', 'api_server_port', 'controller_scheme', 'controller_port',
            			'scheduler_scheme', 'scheduler_port', 'control_plane_taint'].forEach(function (field) {
            				if (typeof params !== 'object' || typeof params[field] === 'undefined'
            					|| params[field] === '') {
            					throw 'Required param is not set: "' + field + '".';
            				}
            			});
            
            		Kube.params = params;
            		if (typeof Kube.params.api_url === 'string' && !Kube.params.api_url.endsWith('/')) {
            			Kube.params.api_url += '/';
            		}
            	},
            
            	apiRequest: function (query) {
            		var request = new HttpRequest(),
            			response,
            			url = encodeURI(Kube.params.api_url + query);
            		if (typeof Kube.params.http_proxy !== 'undefined' && Kube.params.http_proxy !== '') {
            			request.setProxy(Kube.params.http_proxy);
            		}
            		request.addHeader('Content-Type: application/json');
            		request.addHeader('Authorization: Bearer ' + Kube.params.api_token);
            
            		Zabbix.log(4, '[ Kubernetes ] Sending request: ' + url);
            
            		if (Kube.params.http_proxy) {
            			Zabbix.log(4, '[ Kubernetes ] Using http proxy: ' + Kube.params.http_proxy);
            		}
            
            		response = request.get(url);
            
            		Zabbix.log(4, '[ Kubernetes ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            		if (request.getStatus() < 200 || request.getStatus() >= 300) {
            			throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
            		}
            
            		try {
            			response = JSON.parse(response);
            		}
            		catch (error) {
            			throw 'Failed to parse response received from Kubernetes API. Check debug log for more information.';
            		}
            		return response;
            	},
            
            	getField: function (data, path) {
            		var steps = path.split('.');
            		for (var i = 0; i < steps.length; i++) {
            			var step = steps[i];
            			if (typeof data !== 'object' || typeof data[step] === 'undefined') {
            				throw 'Required field was not found: ' + path;
            			}
            
            			data = data[step];
            		}
            
            		return data;
            	},
            
            	getNodes: function () {
            		var result = Kube.apiRequest('api/v1/nodes?labelSelector=' + Kube.params.control_plane_taint);
            
            		if (typeof result !== 'object'
            			|| typeof result.items === 'undefined') {
            			throw 'Cannot get control plane nodes from Kubernetes API. Check debug log for more information.';
            		};
            
            		var nodes = result.items,
            			IPv4 = /(?:\d{1,3}\.){3}\d{1,3}/,
            			controlPlaneNodes = [],
            			hostname = Kube.params.api_url.match(/https?:\/\/([\w.-]+|\[[a-f0-9:]+\]|[^a-zA-Z:]+)(?::\d+)?/);
            
            		if (typeof hostname[1] === 'undefined') {
            			Zabbix.log(4, '[ Kubernetes ] Received incorrect Kubernetes API url: ' + api_url + '. Expected format: <scheme>://<host>:<port>');
            			throw 'Cannot get hostname from Kubernetes API url. Check debug log for more information.';
            		};
            
            		controlPlaneNodes = nodes.map(function (node) {
            			var internalIPs = Kube.getField(node, 'status.addresses').filter(function (addr) {
            				return addr.type === 'InternalIP';
            			});
            			var internalIP = internalIPs.length && internalIPs[0].address;
            
            			return {
            				'{#NAME}': Kube.getField(node, 'metadata.name'),
            				'{#IP}': internalIP,
            				'{#KUBE.API.SERVER.URL}': Kube.params.api_server_scheme + '://' + (IPv4.test(internalIP) ? internalIP : '[' + internalIP + ']') + ':' + Kube.params.api_server_port + '/metrics',
            				'{#KUBE.CONTROLLER.SERVER.URL}': Kube.params.controller_scheme + '://' + (IPv4.test(internalIP) ? internalIP : '[' + internalIP + ']') + ':' + Kube.params.controller_port + '/metrics',
            				'{#KUBE.SCHEDULER.SERVER.URL}': Kube.params.scheduler_scheme + '://' + (IPv4.test(internalIP) ? internalIP : '[' + internalIP + ']') + ':' + Kube.params.scheduler_port + '/metrics',
            				'{#COMPONENT.API}': 'API',
            				'{#COMPONENT.CONTROLLER}': 'Controller manager',
            				'{#COMPONENT.SCHEDULER}': 'Scheduler',
            				'{#CLUSTER_HOSTNAME}': hostname[1]
            			};
            		});
            
            		return JSON.stringify(controlPlaneNodes);
            	}
            };
            
            try {
            	Kube.setParams(JSON.parse(value));
            	return Kube.getNodes();
            }
            catch (error) {
            	error += (String(error).endsWith('.')) ? '' : '.';
            	Zabbix.log(3, '[ Kubernetes ] ERROR: ' + error);
            	return JSON.stringify({ error: error });
            }
          description: 'Generation of data for Control plane discovery rules.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          timeout: 10s
          parameters:
            - name: api_server_port
              value: '{$KUBE.API_SERVER.PORT}'
            - name: api_server_scheme
              value: '{$KUBE.API_SERVER.SCHEME}'
            - name: api_token
              value: '{$KUBE.API.TOKEN}'
            - name: api_url
              value: '{$KUBE.API.URL}'
            - name: controller_port
              value: '{$KUBE.CONTROLLER_MANAGER.PORT}'
            - name: controller_scheme
              value: '{$KUBE.CONTROLLER_MANAGER.SCHEME}'
            - name: control_plane_taint
              value: '{$KUBE.CONTROL_PLANE.TAINT}'
            - name: http_proxy
              value: '{$KUBE.HTTP.PROXY}'
            - name: scheduler_port
              value: '{$KUBE.SCHEDULER.PORT}'
            - name: scheduler_scheme
              value: '{$KUBE.SCHEDULER.SCHEME}'
          tags:
            - tag: component
              value: raw
        - uuid: 6f22e81d69d04eeca88a7992463556a7
          name: 'CronJob count'
          type: DEPENDENT
          key: kube.cronjob.count
          description: 'Number of cronjobs.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - kube_cronjob_created
                - function
                - count
              error_handler: DISCARD_VALUE
          master_item:
            key: kube.state.metrics
          tags:
            - tag: component
              value: cronjob
        - uuid: 483fc2c315264ae5963d34a45f80156e
          name: 'Deployment count'
          type: DEPENDENT
          key: kube.deployment.count
          description: 'The number of deployments.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - kube_deployment_created
                - function
                - count
              error_handler: DISCARD_VALUE
          master_item:
            key: kube.state.metrics
          tags:
            - tag: component
              value: deployment
        - uuid: 93126582e30e45b8a70f6e45402e2f54
          name: 'Endpoint count'
          type: DEPENDENT
          key: kube.endpoint.count
          description: 'Number of endpoints.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - kube_endpoint_created
                - function
                - count
              error_handler: DISCARD_VALUE
          master_item:
            key: kube.state.metrics
          tags:
            - tag: component
              value: endpoint
        - uuid: c08df3a8ae044ae9a331db33bcca7db3
          name: 'Job count'
          type: DEPENDENT
          key: kube.job.count
          description: 'Number of jobs (generated by cronjob + job).'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - kube_job_created
                - function
                - count
              error_handler: DISCARD_VALUE
          master_item:
            key: kube.state.metrics
          tags:
            - tag: component
              value: job
        - uuid: d731fb05f0284921ab3548ba631f019c
          name: 'Get livez'
          type: HTTP_AGENT
          key: kube.livez
          history: '0'
          value_type: TEXT
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var output = [],
                  	component;
                  
                  value.split(/\n/).forEach(function (entry) {
                  	if (component = entry.match(/^\[.+\](.+)\s(\w+)$/)) {
                  		output.push({
                  			name: component[1],
                  			value: component[2]
                  		});
                  	}
                  });
                  
                  return JSON.stringify(output);
          timeout: 10s
          url: '{$KUBE.API.URL}{$KUBE.API.LIVEZ.ENDPOINT}?verbose'
          status_codes: '200, 403'
          headers:
            - name: Authorization
              value: 'Bearer {$KUBE.API.TOKEN}'
          tags:
            - tag: component
              value: raw
        - uuid: d266edd6dda34e15888b572569a1f301
          name: 'Namespace count'
          type: DEPENDENT
          key: kube.namespace.count
          description: 'The number of namespaces.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - kube_namespace_created
                - function
                - count
              error_handler: DISCARD_VALUE
          master_item:
            key: kube.state.metrics
          tags:
            - tag: component
              value: namespace
        - uuid: 968e1dcaf76645aebd4979b9ad4eca9e
          name: 'Node count'
          type: DEPENDENT
          key: kube.node.count
          description: 'The number of nodes.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - kube_node_created
                - function
                - count
              error_handler: DISCARD_VALUE
          master_item:
            key: kube.state.metrics
          tags:
            - tag: component
              value: node
        - uuid: aae78585c668466da5d0ab8d8b899828
          name: 'Node LLD'
          type: SCRIPT
          key: kube.node.lld
          history: '0'
          value_type: TEXT
          params: |
            var Kube = {
            	params: {},
            
            	setParams: function (params) {
            		['api_url', 'api_token', 'kubelet_scheme', 'kubelet_port'].forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined'
            				|| params[field] === '') {
            				throw 'Required param is not set: "' + field + '".';
            			}
            		});
            		['node_filter_labels', 'node_filter_annotations'].forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined') {
            				throw 'Parameter can be empty but not removed: "' + field + '".';
            			}
            		});
            
            		Kube.params = params;
            		if (typeof Kube.params.api_url === 'string' && !Kube.params.api_url.endsWith('/')) {
            			Kube.params.api_url += '/';
            		}
            
            	},
            
            	apiRequest: function (query) {
            		var request = new HttpRequest(),
            			response,
            			url = encodeURI(Kube.params.api_url + query);
            
            		if (typeof Kube.params.http_proxy !== 'undefined' && Kube.params.http_proxy !== '') {
            			request.setProxy(Kube.params.http_proxy);
            		}
            
            		request.addHeader('Content-Type: application/json');
            		request.addHeader('Authorization: Bearer ' + Kube.params.api_token);
            
            		Zabbix.log(4, '[ Kubernetes ] Sending request: ' + url);
            
            		if (Kube.params.http_proxy) {
            			Zabbix.log(4, '[ Kubernetes ] Using http proxy: ' + Kube.params.http_proxy);
            		}
            
            		response = request.get(url);
            
            		Zabbix.log(4, '[ Kubernetes ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            		if (request.getStatus() < 200 || request.getStatus() >= 300) {
            			throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
            
            		}
            		try {
            			response = JSON.parse(response);
            		}
            		catch (error) {
            			throw 'Failed to parse response received from Kubernetes API. Check debug log for more information.';
            		}
            		return response;
            
            	},
            
            	parseFilters: function (csv) {
            		if (!csv)
            			return [];
            
            		var filters = [];
            		const filterCapture = /([!\w\-\.\/]+)\s*:\s*(.*)/;
            		const onComma = /\s*,\s*/;
            
            		csv.split(onComma).forEach(function (kv) {
            			var match = kv.match(filterCapture);
            			if (!match) {
            				Zabbix.log(3, 'Cannot parse filter from: "' + kv + '"');
            				return;
            			}
            
            			filters.push({ key: match[1], expression: match[2] });
            		});
            
            		return filters;
            	},
            
            	filter: function (name, data, filters) {
            		if (typeof data !== 'object') {
            			return true;
            		}
            
            		return filters.every(function (filter) {
            			const filter_key = filter.key.startsWith('!') ? filter.key.substring(1) : filter.key;
            
            			if (!(filter_key in data)) {
            				return true;
            			}
            
            			const isExcludingFilter = filter.key.startsWith('!');
            			const isMatchForFilter = new RegExp(filter.expression).test(data[filter_key]);
            
            			if ((isExcludingFilter && isMatchForFilter) ||
            				(!isExcludingFilter && !isMatchForFilter)) {
            				Zabbix.log(4, '[ Kubernetes ] Discarded "' + name + '" by filter "' + filter.key + ': ' + filter.expression + '"');
            				return false;
            			}
            
            			return true;
            		});
            	},
            
            	getField: function (data, path) {
            		var steps = path.split('.');
            		for (var i = 0; i < steps.length; i++) {
            			var step = steps[i];
            			if (typeof data !== 'object' || typeof data[step] === 'undefined') {
            				throw 'Required field was not found: ' + path;
            			}
            
            			data = data[step];
            		}
            
            		return data;
            	},
            
            	getNodes: function () {
            		var result = Kube.apiRequest('api/v1/nodes');
            		if (typeof result !== 'object'
            			|| typeof result.items === 'undefined') {
            			throw 'Cannot get nodes from Kubernetes API. Check debug log for more information.';
            		};
            		var nodes = result.items,
            			IPv4 = /(?:\d{1,3}\.){3}\d{1,3}/,
            			kubeNodes = [],
            			hostname = Kube.params.api_url.match(/https?:\/\/([\w.-]+|\[[a-f0-9:]+\]|[^a-zA-Z:]+)(?::\d+)?/),
            			filterNodeLabels = Kube.parseFilters(Kube.params.node_filter_labels),
            			filterNodeAnnotations = Kube.parseFilters(Kube.params.node_filter_annotations);
            
            		if (typeof hostname[1] === 'undefined') {
            			Zabbix.log(4, '[ Kubernetes ] Received incorrect Kubernetes API url: ' + api_url + '. Expected format: <scheme>://<host>:<port>');
            			throw 'Cannot get hostname from Kubernetes API url. Check debug log for more information.';
            		};
            
            		kubeNodes = nodes.map(function (node) {
            			if (Kube.filter(Kube.getField(node, 'metadata.name'), Kube.getField(node, 'metadata.labels'), filterNodeLabels)
            				&& Kube.filter(Kube.getField(node, 'metadata.name'), Kube.getField(node, 'metadata.annotations'), filterNodeAnnotations)) {
            				Zabbix.log(4, '[ Kubernetes ] Filtered node "' + node.metadata.name + '"');
            
            				var internalIPs = Kube.getField(node, 'status.addresses').filter(function (addr) {
            					return addr.type === 'InternalIP';
            				});
            
            				var internalIP = internalIPs.length && internalIPs[0].address;
            
            				return {
            					'{#NAME}': node.metadata.name,
            					'{#IP}': internalIP,
            					'{#KUBE.KUBELET.URL}': Kube.params.kubelet_scheme + '://' + (IPv4.test(internalIP) ? internalIP : '[' + internalIP + ']') + ':' + Kube.params.kubelet_port,
            					'{#COMPONENT}': 'Kubelet',
            					'{#CLUSTER_HOSTNAME}': hostname[1]
            				};
            			}
            		});
            
            		return JSON.stringify(kubeNodes);
            
            	},
            };
            
            try {
            	Kube.setParams(JSON.parse(value));
            	return Kube.getNodes();
            }
            catch (error) {
            	error += (String(error).endsWith('.')) ? '' : '.';
            	Zabbix.log(3, '[ Kubernetes ] ERROR: ' + error);
            	return JSON.stringify({ error: error });
            }
          description: 'Generation of data for Kubelet discovery rules.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          timeout: 10s
          parameters:
            - name: api_token
              value: '{$KUBE.API.TOKEN}'
            - name: api_url
              value: '{$KUBE.API.URL}'
            - name: http_proxy
              value: '{$KUBE.HTTP.PROXY}'
            - name: kubelet_port
              value: '{$KUBE.KUBELET.PORT}'
            - name: kubelet_scheme
              value: '{$KUBE.KUBELET.SCHEME}'
            - name: node_filter_annotations
              value: '{$KUBE.KUBELET.FILTER.ANNOTATIONS}'
            - name: node_filter_labels
              value: '{$KUBE.KUBELET.FILTER.LABELS}'
          tags:
            - tag: component
              value: raw
        - uuid: 3a5eaef4e8134dfb9f2935f98a8b88f7
          name: 'Get readyz'
          type: HTTP_AGENT
          key: kube.readyz
          history: '0'
          value_type: TEXT
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var output = [],
                  	component;
                  
                  value.split(/\n/).forEach(function (entry) {
                  	if (component = entry.match(/^\[.+\](.+)\s(\w+)$/)) {
                  		output.push({
                  			name: component[1],
                  			value: component[2]
                  		});
                  	}
                  });
                  
                  return JSON.stringify(output);
          timeout: 10s
          url: '{$KUBE.API.URL}{$KUBE.API.READYZ.ENDPOINT}?verbose'
          status_codes: '200, 403'
          headers:
            - name: Authorization
              value: 'Bearer {$KUBE.API.TOKEN}'
          tags:
            - tag: component
              value: raw
        - uuid: 262b0114fed14fec91d50589e97307a7
          name: 'Service count'
          type: DEPENDENT
          key: kube.service.count
          description: 'The number of services.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - kube_service_created
                - function
                - count
              error_handler: DISCARD_VALUE
          master_item:
            key: kube.state.metrics
          tags:
            - tag: component
              value: service
        - uuid: 66e69f9970ce478f8f0ff13f26b248e3
          name: 'Get state metrics'
          type: SCRIPT
          key: kube.state.metrics
          history: '0'
          value_type: TEXT
          params: |
            var Kube = {
            	params: {},
            
            	setParams: function (params) {
            		['api_url', 'api_token', 'state_endpoint_name'].forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined'
            				|| params[field] === '') {
            				throw 'Required param is not set: "' + field + '".';
            			}
            		});
            
            		Kube.params = params;
            		if (typeof Kube.params.api_url === 'string' && !Kube.params.api_url.endsWith('/')) {
            			Kube.params.api_url += '/';
            		}
            	},
            
            	apiRequest: function (query) {
            		var request = new HttpRequest(),
            			response,
            			url = encodeURI(Kube.params.api_url + query);
            
            		if (typeof Kube.params.http_proxy !== 'undefined' && Kube.params.http_proxy !== '') {
            			request.setProxy(Kube.params.http_proxy);
            		}
            
            		request.addHeader('Content-Type: application/json');
            		request.addHeader('Authorization: Bearer ' + Kube.params.api_token);
            
            		Zabbix.log(4, '[ Kubernetes ] Sending request: ' + url);
            
            		if (Kube.params.http_proxy) {
            			Zabbix.log(4, '[ Kubernetes ] Using http proxy: ' + Kube.params.http_proxy);
            		}
            
            		response = request.get(url);
            
            		Zabbix.log(4, '[ Kubernetes ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            		if (request.getStatus() < 200 || request.getStatus() >= 300) {
            			throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
            		}
            		try {
            			response = JSON.parse(response);
            		}
            		catch (error) {
            			throw 'Failed to parse response received from Kubernetes API. Check debug log for more information.';
            		}
            		return response;
            	},
            
            	getEndpoint: function (ep) {
            		if (typeof ep.subsets[0].addresses !== 'undefined') {
            			var scheme,
            				addr,
            				port;
            			ep.subsets.forEach(function (subset) {
            				var lp = subset.ports.filter(function (port) {
            					if (port.name !== 'http' &&
            						port.name !== 'https' &&
            						port.name !== 'https-main') {
            						return false;
            					}
            					scheme = port.name.match(/https?/);
            					return true;
            				})
            				if (lp.length) {
            					port = lp[0].port
            					addr = subset.addresses[0].ip
            				}
            			})
            			return {
            				scheme: scheme || 'http',
            				address: addr || ep.subsets[0].addresses[0].ip,
            				port: port || 8080
            			}
            		}
            	},
            
            	getMetricsEndpoint: function () {
            		var result = Kube.apiRequest('api/v1/endpoints'),
            			endpoint = [];
            
            		if (typeof result !== 'object'
            			|| typeof result.items === 'undefined') {
            			throw 'Cannot get endpoints from Kubernetes API. Check debug log for more information.';
            		};
            
            		result.items.forEach(function (ep) {
            			if (ep.metadata.name === Kube.params.state_endpoint_name && Array.isArray(ep.subsets)) {
            				endpoint.push(Kube.getEndpoint(ep));
            			}
            			if (typeof Kube.params.openshift_endpoint_name !== 'undefined' && Kube.params.openshift_endpoint_name !== ''
            				&& ep.metadata.name === Kube.params.openshift_endpoint_name && Array.isArray(ep.subsets)) {
            				endpoint.push(Kube.getEndpoint(ep));
            			}
            		});
            		if (endpoint.length === 0) {
            			throw 'Cannot get state metrics endpoints from Kubernetes API. Check debug log for more information.';
            		}
            		return endpoint;
            	},
            
            	getStateMetrics: function () {
            		var metrics_endpoint = Kube.getMetricsEndpoint(),
            			IPv4 = /(?:\d{1,3}\.){3}\d{1,3}/,
            			result = '',
            			request = new HttpRequest();
            
            		request.addHeader('Content-Type: application/json');
            		request.addHeader('Authorization: Bearer ' + Kube.params.api_token);
            
            		if (typeof Kube.params.http_proxy !== 'undefined' && Kube.params.http_proxy !== '') {
            			request.setProxy(Kube.params.http_proxy);
            			Zabbix.log(4, '[ Kubernetes ] Using http proxy: ' + Kube.params.http_proxy);
            		}
            
            		metrics_endpoint.forEach(function (endpoint) {
            			var url = endpoint.scheme + '://' + (IPv4.test(endpoint.address) ? endpoint.address : '[' + endpoint.address + ']') + ':' + endpoint.port + '/metrics';
            
            			Zabbix.log(4, '[ Kubernetes ] Sending request: ' + url);
            			response = request.get(url);
            			Zabbix.log(4, '[ Kubernetes ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            			if (request.getStatus() < 200 || request.getStatus() >= 300) {
            				throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
            			}
            			if (response === null) {
            				throw 'Failed to get state metrics. Check debug log for more information.';
            			}
            			result += response + '\n';
            		}
            		);
            
            		return result;
            
            	}
            };
            
            try {
            	Kube.setParams(JSON.parse(value));
            
            	var stateMetrics = Kube.getStateMetrics();
            
            	return stateMetrics;
            }
            catch (error) {
            	error += (String(error).endsWith('.')) ? '' : '.';
            	Zabbix.log(3, '[ Kubernetes ] ERROR: ' + error);
            	return JSON.stringify({ error: error });
            }
          description: 'Collecting Kubernetes metrics from kube-state-metrics.'
          timeout: 10s
          parameters:
            - name: api_token
              value: '{$KUBE.API.TOKEN}'
            - name: api_url
              value: '{$KUBE.API.URL}'
            - name: http_proxy
              value: '{$KUBE.HTTP.PROXY}'
            - name: openshift_endpoint_name
              value: '{$OPENSHIFT.STATE.ENDPOINT.NAME}'
            - name: state_endpoint_name
              value: '{$KUBE.STATE.ENDPOINT.NAME}'
          tags:
            - tag: component
              value: raw
        - uuid: 3940412bea334e139a72b223197582eb
          name: 'StatefulSet count'
          type: DEPENDENT
          key: kube.statefulset.count
          description: 'The number of statefulsets.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - kube_statefulset_created
                - function
                - count
              error_handler: DISCARD_VALUE
          master_item:
            key: kube.state.metrics
          tags:
            - tag: component
              value: statefulset
      discovery_rules:
        - uuid: dbfd8959361f4cdd973ed552eb18eb86
          name: 'API servers discovery'
          type: DEPENDENT
          key: kube.api_servers.discovery
          host_prototypes:
            - uuid: a67ac5100e6d499088e4c81856f947fc
              host: 'API {#NAME}'
              name: 'API {#NAME}'
              group_links:
                - group:
                    name: Applications
              group_prototypes:
                - name: '{#CLUSTER_HOSTNAME}: Kubernetes/Components: {#COMPONENT.API}'
              templates:
                - name: 'Kubernetes API server by HTTP'
              macros:
                - macro: '{$KUBE.API.SERVER.URL}'
                  value: '{#KUBE.API.SERVER.URL}'
              tags:
                - tag: addr
                  value: '{#IP}'
              custom_interfaces: 'YES'
              interfaces:
                - ip: '{#IP}'
          master_item:
            key: kube.control_plane.lld
        - uuid: 920b56d5e9234da6b60717763e206736
          name: 'Component statuses discovery'
          type: DEPENDENT
          key: kube.componentstatuses.discovery
          item_prototypes:
            - uuid: 766e311f05f646d18eaaaa9ea9afa691
              name: 'Component [{#NAME}]: Healthy'
              type: DEPENDENT
              key: 'kube.componentstatuses.healthy[{#NAME}]'
              value_type: CHAR
              description: 'Cluster component healthy.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.items.[?(@.metadata.name == "{#NAME}")].conditions[?(@.type == "Healthy")].status.first()'
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.componentstatuses
              tags:
                - tag: component
                  value: component
                - tag: component
                  value: '{#NAME}'
                - tag: status
                  value: healthy
              trigger_prototypes:
                - uuid: 58828a692aa2418ba98c6d66a23f1506
                  expression: 'count(/Kubernetes cluster state by HTTP/kube.componentstatuses.healthy[{#NAME}],#2,"ne","True")=2 and length(last(/Kubernetes cluster state by HTTP/kube.componentstatuses.healthy[{#NAME}]))>0'
                  recovery_mode: RECOVERY_EXPRESSION
                  recovery_expression: 'count(/Kubernetes cluster state by HTTP/kube.componentstatuses.healthy[{#NAME}],#3,"eq","True")=3'
                  name: 'Kubernetes cluster state: Component [{#NAME}] is unhealthy'
                  priority: WARNING
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: kube.componentstatuses
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.metadata.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.items
              error_handler: DISCARD_VALUE
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: 08463c66bce845e7acff0d91785e0982
          name: 'Controller manager nodes discovery'
          type: DEPENDENT
          key: kube.controller_manager.discovery
          host_prototypes:
            - uuid: 9d529f3924fc4831a62fb1eec79b64d7
              host: 'Controller manager {#NAME}'
              name: 'Controller manager {#NAME}'
              group_links:
                - group:
                    name: Applications
              group_prototypes:
                - name: '{#CLUSTER_HOSTNAME}: Kubernetes/Components: {#COMPONENT.CONTROLLER}'
              templates:
                - name: 'Kubernetes Controller manager by HTTP'
              macros:
                - macro: '{$KUBE.CONTROLLER.SERVER.URL}'
                  value: '{#KUBE.CONTROLLER.SERVER.URL}'
              tags:
                - tag: addr
                  value: '{#IP}'
              custom_interfaces: 'YES'
              interfaces:
                - ip: '{#IP}'
          master_item:
            key: kube.control_plane.lld
        - uuid: 9bb7532f14dd42c6a532636126e507f9
          name: 'CronJob discovery'
          type: DEPENDENT
          key: kube.cronjob.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.MATCHES}'
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          lifetime: '0'
          item_prototypes:
            - uuid: fd1afcc4646146588fd3c22cf2f7e040
              name: 'Namespace [{#NAMESPACE}] CronJob [{#NAME}]: Completion failed'
              type: DEPENDENT
              key: 'kube.cronjob.completion.failed[{#NAMESPACE}/{#NAME}]'
              description: 'Number of jobs the execution of which has failed.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_job_failed{namespace="{#NAMESPACE}", job_name=~"{#NAME}-*", condition="true"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: cronjob
                - tag: cronjob
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: 5ba1dfd55c784f8597575b38399d5e36
              name: 'Namespace [{#NAMESPACE}] CronJob [{#NAME}]: Completion succeeded'
              type: DEPENDENT
              key: 'kube.cronjob.completion.succeeded[{#NAMESPACE}/{#NAME}]'
              description: 'Number of jobs the execution of which has been completed.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_job_complete{namespace="{#NAMESPACE}", job_name=~"{#NAME}-*", condition="true"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: cronjob
                - tag: cronjob
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: 7ae683d5a1ed4f84a09b38863bd263a7
              name: 'Namespace [{#NAMESPACE}] CronJob [{#NAME}]: Last schedule'
              type: DEPENDENT
              key: 'kube.cronjob.last_schedule_time[{#NAMESPACE}/{#NAME}]'
              units: unixtime
              description: 'LastScheduleTime keeps information of when was the last time the job was successfully scheduled.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_cronjob_status_last_schedule_time{namespace="{#NAMESPACE}", cronjob="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: MULTIPLIER
                  parameters:
                    - '1'
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: cronjob
                - tag: cronjob
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: 8ad7e96b34604a4991698288a7af8027
              name: 'Namespace [{#NAMESPACE}] CronJob [{#NAME}]: Next schedule'
              type: DEPENDENT
              key: 'kube.cronjob.next_schedule_time[{#NAMESPACE}/{#NAME}]'
              units: unixtime
              description: 'Next time the cronjob should be scheduled. The time after lastScheduleTime or after the cron job''s creation time if it''s never been scheduled. Use this to determine if the job is delayed.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_cronjob_next_schedule_time{namespace="{#NAMESPACE}", cronjob="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: MULTIPLIER
                  parameters:
                    - '1'
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: cronjob
                - tag: cronjob
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: 329e8166d1ec42cca7508580efaad366
              name: 'Namespace [{#NAMESPACE}] CronJob [{#NAME}]: Suspend'
              type: DEPENDENT
              key: 'kube.cronjob.spec_suspend[{#NAMESPACE}/{#NAME}]'
              description: 'Suspend flag tells the controller to suspend subsequent executions.'
              valuemap:
                name: 'Boolean format'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_cronjob_spec_suspend{namespace="{#NAMESPACE}", cronjob="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: cronjob
                - tag: cronjob
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: ce13a921915a4232971f2e29102cac64
              name: 'Namespace [{#NAMESPACE}] CronJob [{#NAME}]: Active'
              type: DEPENDENT
              key: 'kube.cronjob.status_active[{#NAMESPACE}/{#NAME}]'
              description: 'Active holds pointers to currently running jobs.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_cronjob_status_active{namespace="{#NAMESPACE}", cronjob="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: cronjob
                - tag: cronjob
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: 26993138717242079583b1c17d0e8dc8
              name: 'Namespace [{#NAMESPACE}] CronJob [{#NAME}]: Failed'
              type: DEPENDENT
              key: 'kube.cronjob.status_failed[{#NAMESPACE}/{#NAME}]'
              description: 'The number of pods which reached the Failed phase and the reason for failure.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_job_status_failed{namespace="{#NAMESPACE}", job_name=~"{#NAME}-*"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: cronjob
                - tag: cronjob
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: 9e5adc642c3a40ab80654542903cd314
              name: 'Namespace [{#NAMESPACE}] CronJob [{#NAME}]: Succeeded'
              type: DEPENDENT
              key: 'kube.cronjob.status_succeeded[{#NAMESPACE}/{#NAME}]'
              description: 'The number of pods which reached the Succeeded phase.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_job_status_succeeded{namespace="{#NAMESPACE}", job_name=~"{#NAME}-*"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: cronjob
                - tag: cronjob
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
          master_item:
            key: kube.state.metrics
          lld_macro_paths:
            - lld_macro: '{#NAMESPACE}'
              path: $.labels.namespace
            - lld_macro: '{#NAME}'
              path: $.labels.cronjob
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - kube_cronjob_created
        - uuid: 907dd8e2792e4e1591a99e4cdf65b0f0
          name: 'Daemonset discovery'
          type: DEPENDENT
          key: kube.daemonset.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.MATCHES}'
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          lifetime: '0'
          item_prototypes:
            - uuid: 61a295b5e2ec4e1f91984a74d0695c1b
              name: 'Namespace [{#NAMESPACE}] Daemonset [{#NAME}]: Desired'
              type: DEPENDENT
              key: 'kube.daemonset.desired[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of nodes that should be running the daemon pod.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_daemonset_status_desired_number_scheduled{namespace="{#NAMESPACE}", daemonset="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: daemonset
                - tag: daemonset
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: 5393cb9b29e442198967cdd2a040d673
              name: 'Namespace [{#NAMESPACE}] Daemonset [{#NAME}]: Misscheduled'
              type: DEPENDENT
              key: 'kube.daemonset.misscheduled[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of nodes that run a daemon pod but are not supposed to.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_daemonset_status_number_misscheduled{namespace="{#NAMESPACE}", daemonset="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: daemonset
                - tag: daemonset
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: 193ccc0290514c4594193a8bcfd60312
              name: 'Namespace [{#NAMESPACE}] Daemonset [{#NAME}]: Ready'
              type: DEPENDENT
              key: 'kube.daemonset.ready[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of nodes that should be running the daemon pod and have one or more running and ready.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_daemonset_status_number_ready{namespace="{#NAMESPACE}", daemonset="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: daemonset
                - tag: daemonset
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: 5727ade78d394d8da1ae46b5d35b5f54
              name: 'Namespace [{#NAMESPACE}] Daemonset [{#NAME}]: Scheduled'
              type: DEPENDENT
              key: 'kube.daemonset.scheduled[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of nodes that run at least one daemon pod and are supposed to.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_daemonset_status_current_number_scheduled{namespace="{#NAMESPACE}", daemonset="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: daemonset
                - tag: daemonset
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: d7c1ebe9e42942719dae731a2c440208
              name: 'Namespace [{#NAMESPACE}] Daemonset [{#NAME}]: Updated number scheduled'
              type: DEPENDENT
              key: 'kube.daemonset.updated[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The total number of nodes that are running updated daemon pod.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_daemonset_status_updated_number_scheduled{namespace="{#NAMESPACE}", daemonset="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: daemonset
                - tag: daemonset
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
          master_item:
            key: kube.state.metrics
          lld_macro_paths:
            - lld_macro: '{#NAMESPACE}'
              path: $.labels.namespace
            - lld_macro: '{#NAME}'
              path: $.labels.daemonset
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - kube_daemonset_status_number_ready
        - uuid: 461770e4762f498e86f3f1c931fe27a9
          name: 'Deployment discovery'
          type: DEPENDENT
          key: kube.deployment.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.MATCHES}'
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          lifetime: '0'
          item_prototypes:
            - uuid: 943c67dc814e4b06a57fbc4ef609686a
              name: 'Namespace [{#NAMESPACE}] Deployment [{#NAME}]: Replicas'
              type: DEPENDENT
              key: 'kube.deployment.replicas[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of replicas per deployment.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_deployment_status_replicas{namespace="{#NAMESPACE}", deployment="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: deployment
                - tag: deployment
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: 23d730bdea7f444eb5f2ee8bf5987379
              name: 'Namespace [{#NAMESPACE}] Deployment [{#NAME}]: Replicas available'
              type: DEPENDENT
              key: 'kube.deployment.replicas_available[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of available replicas per deployment.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_deployment_status_replicas_available{namespace="{#NAMESPACE}", deployment="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: deployment
                - tag: deployment
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: status
                  value: available
            - uuid: b79fe110f4d64a94bb78d7f1e9b175e7
              name: 'Namespace [{#NAMESPACE}] Deployment [{#NAME}]: Replicas desired'
              type: DEPENDENT
              key: 'kube.deployment.replicas_desired[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Number of desired pods for a deployment.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_deployment_spec_replicas{namespace="{#NAMESPACE}", deployment="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: deployment
                - tag: deployment
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: b6d4d557e6104f6b9e1084863cf4024d
              name: 'Namespace [{#NAMESPACE}] Deployment [{#NAME}]: Replicas mismatched'
              type: DEPENDENT
              key: 'kube.deployment.replicas_mismatched[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of available replicas not matching the desired number of replicas.'
              preprocessing:
                - type: PROMETHEUS_TO_JSON
                  parameters:
                    - '{__name__=~"^kube_deployment_(spec_replicas|status_replicas_available)$", namespace="{#NAMESPACE}", deployment="{#NAME}"}'
                - type: JAVASCRIPT
                  parameters:
                    - |
                      var data = JSON.parse(value),
                      	replicas_desired,
                      	replicas_available;
                      
                      if (data.length !== 2) {
                      	throw 'Incorrect length of JSON (must be 2). Actual length: ' + data.length;
                      }
                      
                      JSON.parse(value).forEach(function (item) {
                      	if (item.name === 'kube_deployment_spec_replicas') {
                      		replicas_desired = item.value;
                      	}
                      	if (item.name === 'kube_deployment_status_replicas_available') {
                      		replicas_available = item.value;
                      	}
                      });
                      
                      return Math.abs(replicas_desired - replicas_available);
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: deployment
                - tag: deployment
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: 891537523f98425c8bb1566f984b535a
              name: 'Namespace [{#NAMESPACE}] Deployment [{#NAME}]: Replicas unavailable'
              type: DEPENDENT
              key: 'kube.deployment.replicas_unavailable[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of unavailable replicas per deployment.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_deployment_status_replicas_unavailable{namespace="{#NAMESPACE}", deployment="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: deployment
                - tag: deployment
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: status
                  value: unavailable
            - uuid: 241480bc5e90426abbf5d2792cd846cd
              name: 'Namespace [{#NAMESPACE}] Deployment [{#NAME}]: Replicas updated'
              type: DEPENDENT
              key: 'kube.deployment.replicas_updated[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of updated replicas per deployment.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_deployment_status_replicas_updated{namespace="{#NAMESPACE}", deployment="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: deployment
                - tag: deployment
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: status
                  value: updated
            - uuid: 2651b21facca4bd88929079f4372da37
              name: 'Namespace [{#NAMESPACE}] Deployment [{#NAME}]: Rollingupdate max unavailable'
              type: DEPENDENT
              key: 'kube.deployment.rollingupdate.max_unavailable[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Maximum number of unavailable replicas during a rolling update of a deployment.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_deployment_spec_strategy_rollingupdate_max_unavailable{namespace="{#NAMESPACE}", deployment="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: deployment
                - tag: deployment
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: edc5635267b146d2b0a986e5820227ac
              name: 'Namespace [{#NAMESPACE}] Deployment [{#NAME}]: Paused'
              type: DEPENDENT
              key: 'kube.deployment.spec_paused[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Whether the deployment is paused and will not be processed by the deployment controller.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_deployment_spec_paused{namespace="{#NAMESPACE}", deployment="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: deployment
                - tag: deployment
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
          trigger_prototypes:
            - uuid: aa9f828467d84252aecc00dd342b5661
              expression: |
                min(/Kubernetes cluster state by HTTP/kube.deployment.replicas_mismatched[{#NAMESPACE}/{#NAME}],{$KUBE.REPLICA.MISMATCH.EVAL_PERIOD:"deployment:{#NAMESPACE}:{#NAME}"})>0
                and last(/Kubernetes cluster state by HTTP/kube.deployment.replicas_desired[{#NAMESPACE}/{#NAME}])>=0
                and last(/Kubernetes cluster state by HTTP/kube.deployment.replicas_available[{#NAMESPACE}/{#NAME}])>=0
              name: 'Kubernetes cluster state: Namespace [{#NAMESPACE}] Deployment [{#NAME}]: Deployment replicas mismatch'
              opdata: 'Desired: {ITEM.LASTVALUE2}, available: {ITEM.LASTVALUE3}'
              priority: WARNING
              description: 'Deployment has not matched the expected number of replicas during the specified trigger evaluation period.'
              tags:
                - tag: scope
                  value: availability
          master_item:
            key: kube.state.metrics
          lld_macro_paths:
            - lld_macro: '{#NAMESPACE}'
              path: $.labels.namespace
            - lld_macro: '{#NAME}'
              path: $.labels.deployment
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - kube_deployment_spec_paused
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: 671a0dd7f6e54c6893094fa4360d3dd4
          name: 'Endpoint discovery'
          type: DEPENDENT
          key: kube.endpoint.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.MATCHES}'
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          lifetime: '0'
          item_prototypes:
            - uuid: d587eb7186dd425ead2c9554825ba20a
              name: 'Namespace [{#NAMESPACE}] Endpoint [{#NAME}]: Address available'
              type: DEPENDENT
              key: 'kube.endpoint.address_available[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Number of addresses available in endpoint.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_endpoint_address_available{namespace="{#NAMESPACE}", endpoint="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: endpoint
                - tag: endpoint
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: status
                  value: available
            - uuid: 91fc21c37e144890858137f7f5c38135
              name: 'Namespace [{#NAMESPACE}] Endpoint [{#NAME}]: Address not ready'
              type: DEPENDENT
              key: 'kube.endpoint.address_not_ready[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Number of addresses not ready in endpoint.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_endpoint_address_not_ready{namespace="{#NAMESPACE}", endpoint="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: endpoint
                - tag: endpoint
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: status
                  value: not-ready
            - uuid: f6c2a426e0154c34b2bcb98eeeb88a0d
              name: 'Namespace [{#NAMESPACE}] Endpoint [{#NAME}]: Age'
              type: DEPENDENT
              key: 'kube.endpoint.age[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              units: s
              description: 'Endpoint age (number of seconds since creation).'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_endpoint_created{namespace="{#NAMESPACE}", endpoint="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: JAVASCRIPT
                  parameters:
                    - 'return (Math.floor(Date.now()/1000)-Number(value));'
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: endpoint
                - tag: endpoint
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
          master_item:
            key: kube.state.metrics
          lld_macro_paths:
            - lld_macro: '{#NAMESPACE}'
              path: $.labels.namespace
            - lld_macro: '{#NAME}'
              path: $.labels.endpoint
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - kube_endpoint_created
        - uuid: bc6897c5abe246fdb1ba72c1e71cdb81
          name: 'Job discovery'
          type: DEPENDENT
          key: kube.job.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.MATCHES}'
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          lifetime: '0'
          item_prototypes:
            - uuid: b1fad48e204e4bf9a03c79baa0f58963
              name: 'Namespace [{#NAMESPACE}] Job [{#NAME}]: Completion failed'
              type: DEPENDENT
              key: 'kube.job.completion.failed[{#NAMESPACE}/{#NAME}]'
              description: 'Number of jobs the execution of which has failed.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_job_failed{namespace="{#NAMESPACE}", job_name="{#NAME}", condition="true"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: job
                - tag: job
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: 51d3653b2c7543dba04339ded6ff65dd
              name: 'Namespace [{#NAMESPACE}] Job [{#NAME}]: Completion succeeded'
              type: DEPENDENT
              key: 'kube.job.completion.succeeded[{#NAMESPACE}/{#NAME}]'
              description: 'Number of jobs the execution of which has been completed.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_job_complete{namespace="{#NAMESPACE}", job_name="{#NAME}", condition="true"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: job
                - tag: job
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: f175e0bd1f6b41a2b62e69df40b3fc07
              name: 'Namespace [{#NAMESPACE}] Job [{#NAME}]: Failed'
              type: DEPENDENT
              key: 'kube.job.status_failed[{#NAMESPACE}/{#NAME}]'
              description: 'The number of pods which reached the Failed phase and the reason for failure.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_job_status_failed{namespace="{#NAMESPACE}", job_name="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: job
                - tag: job
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: b909868367d5481d982d33d5248167ab
              name: 'Namespace [{#NAMESPACE}] Job [{#NAME}]: Succeeded'
              type: DEPENDENT
              key: 'kube.job.status_succeeded[{#NAMESPACE}/{#NAME}]'
              description: 'The number of pods which reached the Succeeded phase.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_job_status_succeeded{namespace="{#NAMESPACE}", job_name="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: job
                - tag: job
                  value: '{#NAME}'
                - tag: namespace
                  value: '{#NAMESPACE}'
          master_item:
            key: kube.state.metrics
          lld_macro_paths:
            - lld_macro: '{#NAMESPACE}'
              path: $.labels.namespace
            - lld_macro: '{#NAME}'
              path: $.labels.job_name
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - 'kube_job_owner{owner_is_controller!="true"}'
        - uuid: 11ca82627209443a96693e443d6391c1
          name: 'Kubelet discovery'
          type: DEPENDENT
          key: kube.kubelet.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAME}'
                value: '{$KUBE.LLD.FILTER.KUBELET_NODE.MATCHES}'
              - macro: '{#NAME}'
                value: '{$KUBE.LLD.FILTER.KUBELET_NODE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          host_prototypes:
            - uuid: c1c4807f378a47dfa59e9bbc8e43f5e2
              host: 'Kubelet {#NAME}'
              name: 'Kubelet {#NAME}'
              group_links:
                - group:
                    name: Applications
              group_prototypes:
                - name: '{#CLUSTER_HOSTNAME}: Kubernetes/Components: {#COMPONENT}'
              templates:
                - name: 'Kubernetes Kubelet by HTTP'
              macros:
                - macro: '{$KUBE.KUBELET.URL}'
                  value: '{#KUBE.KUBELET.URL}'
              tags:
                - tag: addr
                  value: '{#IP}'
              custom_interfaces: 'YES'
              interfaces:
                - ip: '{#IP}'
          master_item:
            key: kube.node.lld
        - uuid: 438e963e02a749b5a2cc487b9fd5db05
          name: 'Livez discovery'
          type: DEPENDENT
          key: kube.livez.discovery
          item_prototypes:
            - uuid: 93548d985c1542a891bfc74f2d42d59a
              name: 'Livez [{#NAME}]: Healthcheck'
              type: DEPENDENT
              key: 'kube.livez.healthcheck[{#NAME}]'
              value_type: CHAR
              description: 'Result of livez healthcheck for component.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.[?(@.name == "{#NAME}")].value.first()'
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.livez
              tags:
                - tag: component
                  value: livez
                - tag: component
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: 9fcb23d29ac3481a8613515cc2cccfcf
                  expression: 'count(/Kubernetes cluster state by HTTP/kube.livez.healthcheck[{#NAME}],#2,"ne","ok")=2 and length(last(/Kubernetes cluster state by HTTP/kube.livez.healthcheck[{#NAME}]))>0'
                  recovery_mode: RECOVERY_EXPRESSION
                  recovery_expression: 'count(/Kubernetes cluster state by HTTP/kube.livez.healthcheck[{#NAME}],#3,"eq","ok")=3'
                  name: 'Kubernetes cluster state: Livez [{#NAME}] is unhealthy'
                  priority: WARNING
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: kube.livez
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.name
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: 9d161120d2be48d1abb6e56107057874
          name: 'Node discovery'
          type: DEPENDENT
          key: kube.node.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAME}'
                value: '{$KUBE.LLD.FILTER.NODE.MATCHES}'
              - macro: '{#NAME}'
                value: '{$KUBE.LLD.FILTER.NODE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          item_prototypes:
            - uuid: 4f994219cbe94dfe8d96af1ad5018212
              name: 'Node [{#NAME}]: CPU allocatable'
              type: DEPENDENT
              key: 'kube.node.cpu_allocatable[{#NAME}]'
              value_type: FLOAT
              units: cpu
              description: 'The CPU resources of a node that are available for scheduling.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_node_status_allocatable{node="{#NAME}", resource="cpu"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: cpu
                - tag: node
                  value: '{#NAME}'
                - tag: status
                  value: allocatable
            - uuid: 5d3ad3e1b2a547aea65b557ff2765ef7
              name: 'Node [{#NAME}]: CPU capacity'
              type: DEPENDENT
              key: 'kube.node.cpu_capacity[{#NAME}]'
              value_type: FLOAT
              units: cpu
              description: 'The capacity for CPU resources of a node.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_node_status_capacity{node="{#NAME}", resource="cpu"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: cpu
                - tag: node
                  value: '{#NAME}'
                - tag: status
                  value: capacity
            - uuid: 49440553854441f39ecbcf7052d83e51
              name: 'Node [{#NAME}]: Ephemeral storage allocatable'
              type: DEPENDENT
              key: 'kube.node.ephemeral_storage_allocatable[{#NAME}]'
              value_type: FLOAT
              units: B
              description: 'The allocatable ephemeral storage of a node that is available for scheduling.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_node_status_allocatable{node="{#NAME}", resource="ephemeral_storage"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: ephemeral-storage
                - tag: node
                  value: '{#NAME}'
                - tag: status
                  value: capacity
            - uuid: 2831a4b1bc1549198203f3e894f07a1f
              name: 'Node [{#NAME}]: Ephemeral storage capacity'
              type: DEPENDENT
              key: 'kube.node.ephemeral_storage_capacity[{#NAME}]'
              value_type: FLOAT
              units: B
              description: 'The ephemeral storage capacity of a node.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_node_status_capacity{node="{#NAME}", resource="ephemeral_storage"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: ephemeral-storage
                - tag: node
                  value: '{#NAME}'
                - tag: status
                  value: capacity
            - uuid: 0247f7ba014443a0b13a4fdd3e191062
              name: 'Node [{#NAME}]: Memory allocatable'
              type: DEPENDENT
              key: 'kube.node.memory_allocatable[{#NAME}]'
              value_type: FLOAT
              units: B
              description: 'The memory resources of a node that are available for scheduling.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_node_status_allocatable{node="{#NAME}", resource="memory"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: memory
                - tag: node
                  value: '{#NAME}'
                - tag: status
                  value: allocatable
            - uuid: 3336028952b14e2ab3dae55659156ea3
              name: 'Node [{#NAME}]: Memory capacity'
              type: DEPENDENT
              key: 'kube.node.memory_capacity[{#NAME}]'
              value_type: FLOAT
              units: B
              description: 'The capacity for memory resources of a node.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_node_status_capacity{node="{#NAME}", resource="memory"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: memory
                - tag: node
                  value: '{#NAME}'
                - tag: status
                  value: capacity
            - uuid: 049eb92c52a24c9887d7120f2a7e106c
              name: 'Node [{#NAME}]: Pods allocatable'
              type: DEPENDENT
              key: 'kube.node.pods_allocatable[{#NAME}]'
              value_type: FLOAT
              description: 'The pods resources of a node that are available for scheduling.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_node_status_allocatable{node="{#NAME}", resource="pods"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pods
                - tag: node
                  value: '{#NAME}'
                - tag: status
                  value: allocatable
            - uuid: 163edc95ec7d41f29099b94409916d82
              name: 'Node [{#NAME}]: Pods capacity'
              type: DEPENDENT
              key: 'kube.node.pods_capacity[{#NAME}]'
              value_type: FLOAT
              description: 'The capacity for pods resources of a node.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_node_status_capacity{node="{#NAME}", resource="pods"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pods
                - tag: node
                  value: '{#NAME}'
                - tag: status
                  value: capacity
          master_item:
            key: kube.state.metrics
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.labels.node
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - kube_node_info
        - uuid: a7bf79185bab4eb8891e5a154424a96d
          name: 'PodDisruptionBudget discovery'
          type: DEPENDENT
          key: kube.pdb.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.MATCHES}'
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          lifetime: '0'
          item_prototypes:
            - uuid: 3eef1fb3311e429fa3043c9e4d88335f
              name: 'Namespace [{#NAMESPACE}] PodDisruptionBudget [{#NAME}]: Disruptions allowed'
              type: DEPENDENT
              key: 'kube.pdb.disruptions_allowed[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Number of pod disruptions that are allowed.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_poddisruptionbudget_status_pod_disruptions_allowed{namespace="{#NAMESPACE}", poddisruptionbudget="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pdb
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pdb
                  value: '{#NAME}'
            - uuid: a303e07be68c40bdb7d996696af53c98
              name: 'Namespace [{#NAMESPACE}] PodDisruptionBudget [{#NAME}]: Pods desired'
              type: DEPENDENT
              key: 'kube.pdb.pods_desired[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Minimum desired number of healthy pods.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_poddisruptionbudget_status_desired_healthy{namespace="{#NAMESPACE}", poddisruptionbudget="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pdb
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pdb
                  value: '{#NAME}'
            - uuid: f2a82d6de52446f594a6554137508604
              name: 'Namespace [{#NAMESPACE}] PodDisruptionBudget [{#NAME}]: Pods healthy'
              type: DEPENDENT
              key: 'kube.pdb.pods_healthy[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Current number of healthy pods.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_poddisruptionbudget_status_current_healthy{namespace="{#NAMESPACE}", poddisruptionbudget="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pdb
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pdb
                  value: '{#NAME}'
            - uuid: 2c15033188ab4062a432f30c3320677f
              name: 'Namespace [{#NAMESPACE}] PodDisruptionBudget [{#NAME}]: Pods total'
              type: DEPENDENT
              key: 'kube.pdb.pods_total[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Total number of pods counted by this disruption budget.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_poddisruptionbudget_status_expected_pods{namespace="{#NAMESPACE}", poddisruptionbudget="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pdb
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pdb
                  value: '{#NAME}'
          master_item:
            key: kube.state.metrics
          lld_macro_paths:
            - lld_macro: '{#NAMESPACE}'
              path: $.labels.namespace
            - lld_macro: '{#NAME}'
              path: $.labels.poddisruptionbudget
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - kube_poddisruptionbudget_created
        - uuid: d88889ab64804c4389d3755ea49b80d6
          name: 'Pod discovery'
          type: DEPENDENT
          key: kube.pod.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.MATCHES}'
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          lifetime: '0'
          item_prototypes:
            - uuid: 3a145b38d57f4164a7a9ef0dd15c530a
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}]: Containers CPU limits'
              type: DEPENDENT
              key: 'kube.pod.containers.limits.cpu[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The limit on CPU cores to be used by a container.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_container_resource_limits{namespace="{#NAMESPACE}", pod="{#NAME}", resource="cpu"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#NAME}'
                - tag: resource
                  value: cpu
            - uuid: e1dd38e6fb484610891aef057a58daf0
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}]: Containers memory limits'
              type: DEPENDENT
              key: 'kube.pod.containers.limits.memory[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              units: B
              description: 'The limit on memory to be used by a container.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_container_resource_limits{namespace="{#NAMESPACE}", pod="{#NAME}", resource="memory"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#NAME}'
                - tag: resource
                  value: memory
            - uuid: 8465ea15f3974476924cb66df5a63e0c
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}]: Containers CPU requests'
              type: DEPENDENT
              key: 'kube.pod.containers.requests.cpu[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of requested CPU cores by a container.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_container_resource_requests{namespace="{#NAMESPACE}", pod="{#NAME}", resource="cpu"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#NAME}'
                - tag: resource
                  value: cpu
            - uuid: 27379c192d0841a5adb2c2e4ae937263
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}]: Containers memory requests'
              type: DEPENDENT
              key: 'kube.pod.containers.requests.memory[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              units: B
              description: 'The number of requested memory bytes by a container.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_container_resource_requests{namespace="{#NAMESPACE}", pod="{#NAME}", resource="memory"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#NAME}'
                - tag: resource
                  value: memory
            - uuid: 1719bf9d1a1c443dbddcefb91483a77c
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}]: Containers ready'
              type: DEPENDENT
              key: 'kube.pod.containers_ready[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Describes whether the containers readiness check succeeded.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_container_status_ready{namespace="{#NAMESPACE}", pod="{#NAME}"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#NAME}'
                - tag: status
                  value: ready
            - uuid: fbc8f3a91ec9429ca4c6d70c07480dcc
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}]: Containers restarts'
              type: DEPENDENT
              key: 'kube.pod.containers_restarts[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of container restarts.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_container_status_restarts_total{namespace="{#NAMESPACE}", pod="{#NAME}"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#NAME}'
                - tag: status
                  value: restarts
              trigger_prototypes:
                - uuid: 4656457043d04f4a9b829222ad071d22
                  expression: '(last(/Kubernetes cluster state by HTTP/kube.pod.containers_restarts[{#NAMESPACE}/{#NAME}])-min(/Kubernetes cluster state by HTTP/kube.pod.containers_restarts[{#NAMESPACE}/{#NAME}],15m))>1'
                  name: 'Kubernetes cluster state: Namespace [{#NAMESPACE}] Pod [{#NAME}]: Pod is crash looping'
                  priority: WARNING
                  description: 'Containers of the pod keep restarting. This most likely indicates that the pod is in the CrashLoopBackOff state.'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: b96149f7a44d4a49903421fbc38c0101
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}]: Containers running'
              type: DEPENDENT
              key: 'kube.pod.containers_running[{#NAMESPACE}/{#NAME}]'
              description: 'Describes whether the container is currently in running state.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_container_status_running{namespace="{#NAMESPACE}", pod="{#NAME}"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#NAME}'
                - tag: status
                  value: running
            - uuid: 50785c1c96894866973ebf8491e3c320
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}]: Containers terminated'
              type: DEPENDENT
              key: 'kube.pod.containers_terminated[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Describes whether the container is currently in terminated state.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_container_status_terminated{namespace="{#NAMESPACE}", pod="{#NAME}"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#NAME}'
                - tag: status
                  value: terminated
            - uuid: 01d80d5f171f4af2b3b1da70679e87ba
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}]: Containers waiting'
              type: DEPENDENT
              key: 'kube.pod.containers_waiting[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Describes whether the container is currently in waiting state.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_container_status_waiting{namespace="{#NAMESPACE}", pod="{#NAME}"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#NAME}'
                - tag: status
                  value: waiting
            - uuid: dedbaa4308624b6b982a7e6b62f92d3f
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}] Phase: Failed'
              type: DEPENDENT
              key: 'kube.pod.phase.failed[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Pod is in failed state.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_status_phase{namespace="{#NAMESPACE}", pod="{#NAME}", phase="Failed"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: phase
                  value: failed
                - tag: pod
                  value: '{#NAME}'
            - uuid: fa3759bb7873453b9842f3e459403163
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}] Phase: Pending'
              type: DEPENDENT
              key: 'kube.pod.phase.pending[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Pod is in pending state.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_status_phase{namespace="{#NAMESPACE}", pod="{#NAME}", phase="Pending"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: phase
                  value: pending
                - tag: pod
                  value: '{#NAME}'
            - uuid: 59168479f1e246bf8da46606f3ce2a5e
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}] Phase: Running'
              type: DEPENDENT
              key: 'kube.pod.phase.running[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Pod is in unknown state.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_status_phase{namespace="{#NAMESPACE}", pod="{#NAME}", phase="Running"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: phase
                  value: running
                - tag: pod
                  value: '{#NAME}'
            - uuid: 8a9451a6466f4c64b31377d850841578
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}] Phase: Succeeded'
              type: DEPENDENT
              key: 'kube.pod.phase.succeeded[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Pod is in succeeded state.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_status_phase{namespace="{#NAMESPACE}", pod="{#NAME}", phase="Succeeded"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: phase
                  value: succeeded
                - tag: pod
                  value: '{#NAME}'
            - uuid: 9303dab482754a7b991b3ba4afef96e7
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}] Phase: Unknown'
              type: DEPENDENT
              key: 'kube.pod.phase.unknown[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Pod is in unknown state.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_status_phase{namespace="{#NAMESPACE}", pod="{#NAME}", phase="Unknown"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: phase
                  value: unknown
                - tag: pod
                  value: '{#NAME}'
            - uuid: d946bc58d5a44aa9936b09c825a51f59
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}]: Ready'
              type: DEPENDENT
              key: 'kube.pod.ready[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Describes whether the pod is ready to serve requests.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_status_ready{namespace="{#NAMESPACE}", pod="{#NAME}", condition="true"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#NAME}'
                - tag: status
                  value: ready
            - uuid: 0f858209a4b344de80b1382710c6f153
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}]: Scheduled'
              type: DEPENDENT
              key: 'kube.pod.scheduled[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Describes the status of the scheduling process for the pod.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_status_scheduled{namespace="{#NAMESPACE}", pod="{#NAME}", condition="true"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#NAME}'
                - tag: status
                  value: scheduled
            - uuid: 93ba93d04ec34b5193252f19a33f5d59
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}]: Unschedulable'
              type: DEPENDENT
              key: 'kube.pod.unschedulable[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Describes the unschedulable status for the pod.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_pod_status_unschedulable{namespace="{#NAMESPACE}", pod="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pod
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#NAME}'
                - tag: status
                  value: unschedulable
          trigger_prototypes:
            - uuid: 5bf79dee7b974064b5848a7dcf6428c2
              expression: 'min(/Kubernetes cluster state by HTTP/kube.pod.phase.failed[{#NAMESPACE}/{#NAME}],10m)>0 or min(/Kubernetes cluster state by HTTP/kube.pod.phase.pending[{#NAMESPACE}/{#NAME}],10m)>0 or min(/Kubernetes cluster state by HTTP/kube.pod.phase.unknown[{#NAMESPACE}/{#NAME}],10m)>0'
              name: 'Kubernetes cluster state: Namespace [{#NAMESPACE}] Pod [{#NAME}]: Pod is not healthy'
              priority: HIGH
              tags:
                - tag: scope
                  value: availability
          master_item:
            key: kube.state.metrics
          lld_macro_paths:
            - lld_macro: '{#NAMESPACE}'
              path: $.labels.namespace
            - lld_macro: '{#NAME}'
              path: $.labels.pod
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - kube_pod_start_time
        - uuid: 657edb22832e43f5a084cf872c6bc6e4
          name: 'PV discovery'
          type: DEPENDENT
          key: kube.pv.discovery
          lifetime: '0'
          item_prototypes:
            - uuid: f93e620a32114a239bc622246ff57eb0
              name: 'PV [{#NAME}] Capacity bytes'
              type: DEPENDENT
              key: 'kube.pv.capacity.bytes[{#NAME}]'
              value_type: FLOAT
              units: B
              description: 'A capacity of the persistent volume in bytes.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_persistentvolume_capacity_bytes{persistentvolume="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pv
                - tag: pv
                  value: '{#NAME}'
            - uuid: f1f7c15a30e04203b63b3f828f1e49c6
              name: 'PV status phase: Available, sum'
              type: DEPENDENT
              key: 'kube.pv.status_phase.available.sum[{#SINGLETON}]'
              discover: NO_DISCOVER
              description: 'The total amount of persistent volumes in the Available phase.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_persistentvolume_status_phase{persistentvolume=~"{$KUBE.LLD.FILTER.PV.MATCHES}", persistentvolume!~"{$KUBE.LLD.FILTER.PV.NOT_MATCHES}", phase="Available"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: phase
                - tag: component
                  value: pv
                - tag: phase
                  value: available
            - uuid: 236db4d5cb4149f691003c0b50bf2b55
              name: 'PV status phase: Bound, sum'
              type: DEPENDENT
              key: 'kube.pv.status_phase.bound.sum[{#SINGLETON}]'
              discover: NO_DISCOVER
              description: 'The total amount of persistent volumes in the Bound phase.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_persistentvolume_status_phase{persistentvolume=~"{$KUBE.LLD.FILTER.PV.MATCHES}", persistentvolume!~"{$KUBE.LLD.FILTER.PV.NOT_MATCHES}", phase="Bound"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: phase
                - tag: component
                  value: pv
                - tag: phase
                  value: bound
            - uuid: bc5e42637e454baeb38eef946093f38a
              name: 'PV status phase: Failed, sum'
              type: DEPENDENT
              key: 'kube.pv.status_phase.failed.sum[{#SINGLETON}]'
              discover: NO_DISCOVER
              description: 'The total amount of persistent volumes in the Failed phase.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_persistentvolume_status_phase{persistentvolume=~"{$KUBE.LLD.FILTER.PV.MATCHES}", persistentvolume!~"{$KUBE.LLD.FILTER.PV.NOT_MATCHES}", phase="Failed"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: phase
                - tag: component
                  value: pv
                - tag: phase
                  value: failed
            - uuid: e69e327a90094195997a28e36fe47441
              name: 'PV status phase: Pending, sum'
              type: DEPENDENT
              key: 'kube.pv.status_phase.pending.sum[{#SINGLETON}]'
              discover: NO_DISCOVER
              description: 'The total amount of persistent volumes in the Pending phase.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_persistentvolume_status_phase{persistentvolume=~"{$KUBE.LLD.FILTER.PV.MATCHES}", persistentvolume!~"{$KUBE.LLD.FILTER.PV.NOT_MATCHES}", phase="Pending"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: phase
                - tag: component
                  value: pv
                - tag: phase
                  value: pending
            - uuid: 121d33d774534d38809b014f0af20d72
              name: 'PV status phase: Released, sum'
              type: DEPENDENT
              key: 'kube.pv.status_phase.released.sum[{#SINGLETON}]'
              discover: NO_DISCOVER
              description: 'The total amount of persistent volumes in the Released phase.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_persistentvolume_status_phase{persistentvolume=~"{$KUBE.LLD.FILTER.PV.MATCHES}", persistentvolume!~"{$KUBE.LLD.FILTER.PV.NOT_MATCHES}", phase="Released"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: phase
                - tag: component
                  value: pv
                - tag: phase
                  value: released
            - uuid: f2982e1a1c4a46f08b855d6f35e60c85
              name: 'PV [{#NAME}] Status phase'
              type: DEPENDENT
              key: 'kube.pv.status_phase[{#NAME}]'
              description: 'The current status phase of the persistent volume.'
              valuemap:
                name: 'PV and PVC status phases'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_persistentvolume_status_phase{persistentvolume="{#NAME}"} == 1'
                    - label
                    - phase
                  error_handler: DISCARD_VALUE
                - type: JAVASCRIPT
                  parameters:
                    - 'return [''Available'', ''Bound'', ''Failed'', ''Lost'', ''Pending'', ''Released''].indexOf(value) + 1 || ''Problem with status processing in JS, no such PV status: '' + value;'
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: phase
                - tag: component
                  value: pv
                - tag: pv
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: ccc486f937bd454e9e7193181a998bdb
                  expression: 'count(/Kubernetes cluster state by HTTP/kube.pv.status_phase[{#NAME}],2m,,3)>=2'
                  name: 'Kubernetes cluster state: PV [{#NAME}]: PV has failed'
                  priority: WARNING
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: kube.state.metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - 'kube_persistentvolume_info{persistentvolume=~"{$KUBE.LLD.FILTER.PV.MATCHES}", persistentvolume!~"{$KUBE.LLD.FILTER.PV.NOT_MATCHES}"}'
            - type: JAVASCRIPT
              parameters:
                - |
                  var input = JSON.parse(value),
                  	output = [];
                  
                  input.forEach(function (metric) {
                  	output.push({ '{#NAME}': metric.labels.persistentvolume });
                  });
                  
                  if (output.length > 0) {
                  	output.push({ '{#SINGLETON}': '' });
                  }
                  
                  return JSON.stringify(output);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          overrides:
            - name: 'sum items'
              step: '1'
              filter:
                conditions:
                  - macro: '{#SINGLETON}'
                    operator: EXISTS
              operations:
                - operator: REGEXP
                  value: 'status phase.*sum'
                  discover: DISCOVER
                - operator: NOT_REGEXP
                  value: 'status phase.*sum'
                  discover: NO_DISCOVER
                - operationobject: TRIGGER_PROTOTYPE
                  operator: REGEXP
                  value: '.*'
                  discover: NO_DISCOVER
        - uuid: 4143b2f294ac45a5ab570a94a626fca6
          name: 'PVC discovery'
          type: DEPENDENT
          key: kube.pvc.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.MATCHES}'
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          lifetime: '0'
          item_prototypes:
            - uuid: 9187144531f145398bfbe7281290533d
              name: 'Namespace [{#NAMESPACE}] PVC [{#NAME}] Requested storage'
              type: DEPENDENT
              key: 'kube.pvc.requested.storage[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              units: B
              description: 'The capacity of storage requested by the persistent volume claim.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_persistentvolumeclaim_resource_requests_storage_bytes{namespace="{#NAMESPACE}", persistentvolumeclaim="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: pvc
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pvc
                  value: '{#NAME}'
            - uuid: 41bc1f54992a492da414846b91d48b0e
              name: 'Namespace [{#NAMESPACE}] PVC status phase: Bound, sum'
              type: DEPENDENT
              key: 'kube.pvc.status_phase.bound.sum[{#NAMESPACE}]'
              discover: NO_DISCOVER
              description: 'The total amount of persistent volume claims in the Bound phase.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_persistentvolumeclaim_status_phase{namespace="{#NAMESPACE}", phase="Bound"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: phase
                - tag: component
                  value: pvc
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: phase
                  value: bound
            - uuid: f3b3979c04424b908b514589c2995ff8
              name: 'Namespace [{#NAMESPACE}] PVC status phase: Lost, sum'
              type: DEPENDENT
              key: 'kube.pvc.status_phase.lost.sum[{#NAMESPACE}]'
              discover: NO_DISCOVER
              description: 'The total amount of persistent volume claims in the Lost phase.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_persistentvolumeclaim_status_phase{namespace="{#NAMESPACE}", phase="Lost"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: phase
                - tag: component
                  value: pvc
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: phase
                  value: lost
            - uuid: 237d8ee073c04c21a14269f15ab679fd
              name: 'Namespace [{#NAMESPACE}] PVC status phase: Pending, sum'
              type: DEPENDENT
              key: 'kube.pvc.status_phase.pending.sum[{#NAMESPACE}]'
              discover: NO_DISCOVER
              description: 'The total amount of persistent volume claims in the Pending phase.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_persistentvolumeclaim_status_phase{namespace="{#NAMESPACE}", phase="Pending"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: phase
                - tag: component
                  value: pvc
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: phase
                  value: pending
            - uuid: f036e514626b4610b531f9be09289daa
              name: 'Namespace [{#NAMESPACE}] PVC [{#NAME}] Status phase'
              type: DEPENDENT
              key: 'kube.pvc.status_phase[{#NAMESPACE}/{#NAME}]'
              description: 'The current status phase of the persistent volume claim.'
              valuemap:
                name: 'PV and PVC status phases'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_persistentvolumeclaim_status_phase{namespace="{#NAMESPACE}", persistentvolumeclaim="{#NAME}"} == 1'
                    - label
                    - phase
                  error_handler: DISCARD_VALUE
                - type: JAVASCRIPT
                  parameters:
                    - 'return [''Available'', ''Bound'', ''Failed'', ''Lost'', ''Pending'', ''Released''].indexOf(value) + 1 || ''Problem with status processing in JS, no such PVC status: '' + value;'
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: phase
                - tag: component
                  value: pvc
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pvc
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: 6cdf93dad1c647239570cbb3789f1a2c
                  expression: 'count(/Kubernetes cluster state by HTTP/kube.pvc.status_phase[{#NAMESPACE}/{#NAME}],2m,,5)>=2'
                  name: 'Kubernetes cluster state: NS [{#NAMESPACE}] PVC [{#NAME}]: PVC is pending'
                  priority: WARNING
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: kube.state.metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - kube_persistentvolumeclaim_info
            - type: JAVASCRIPT
              parameters:
                - |
                  var input = JSON.parse(value),
                  	lookup = {},
                  	output = [];
                  
                  input.forEach(function (metric) {
                  	var namespace = metric.labels.namespace;
                  	if (!(lookup[namespace])) {
                  		lookup[namespace] = 1;
                  		output.push({
                  			'{#IS_SUM}': '',
                  			'{#NAMESPACE}': metric.labels.namespace
                  		});
                  	}
                  	output.push({
                  		'{#NAME}': metric.labels.persistentvolumeclaim,
                  		'{#NAMESPACE}': metric.labels.namespace
                  	});
                  });
                  
                  return JSON.stringify(output);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          overrides:
            - name: 'sum items'
              step: '1'
              filter:
                conditions:
                  - macro: '{#IS_SUM}'
                    operator: EXISTS
              operations:
                - operator: REGEXP
                  value: 'status phase.*sum'
                  discover: DISCOVER
                - operator: NOT_REGEXP
                  value: 'status phase.*sum'
                  discover: NO_DISCOVER
                - operationobject: TRIGGER_PROTOTYPE
                  operator: REGEXP
                  value: '.*'
                  discover: NO_DISCOVER
        - uuid: ee274767c42345e3a501f43e81a3364a
          name: 'Readyz discovery'
          type: DEPENDENT
          key: kube.readyz.discovery
          item_prototypes:
            - uuid: c0693fb2709e4b01a35ca433edb84db7
              name: 'Readyz [{#NAME}]: Healthcheck'
              type: DEPENDENT
              key: 'kube.readyz.healthcheck[{#NAME}]'
              value_type: CHAR
              description: 'Result of readyz healthcheck for component.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.[?(@.name == "{#NAME}")].value.first()'
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.readyz
              tags:
                - tag: component
                  value: readyz
                - tag: component
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: 1a88c2cf94d3444c9e5320776b323ce6
                  expression: 'count(/Kubernetes cluster state by HTTP/kube.readyz.healthcheck[{#NAME}],#2,"ne","ok")=2 and length(last(/Kubernetes cluster state by HTTP/kube.readyz.healthcheck[{#NAME}]))>0'
                  recovery_mode: RECOVERY_EXPRESSION
                  recovery_expression: 'count(/Kubernetes cluster state by HTTP/kube.readyz.healthcheck[{#NAME}],#3,"eq","ok")=3'
                  name: 'Kubernetes cluster state: Readyz [{#NAME}] is unhealthy'
                  priority: WARNING
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: kube.readyz
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.name
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: 6244f250f6cd411080221843ad1c59f2
          name: 'ReplicaSet discovery'
          type: DEPENDENT
          key: kube.replicaset.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.MATCHES}'
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          lifetime: '0'
          item_prototypes:
            - uuid: 928536dae27c4e3497627b9f5642a7a8
              name: 'Namespace [{#NAMESPACE}] ReplicaSet [{#NAME}]: Fully labeled replicas'
              type: DEPENDENT
              key: 'kube.replicaset.fully_labeled_replicas[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of fully labeled replicas per ReplicaSet.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_replicaset_status_fully_labeled_replicas{namespace="{#NAMESPACE}", replicaset="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: replicaset
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: replicaset
                  value: '{#NAME}'
                - tag: status
                  value: fully-labeled
            - uuid: 4e911e4b71c342dba2227ed7ef360190
              name: 'Namespace [{#NAMESPACE}] ReplicaSet [{#NAME}]: Ready'
              type: DEPENDENT
              key: 'kube.replicaset.ready[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of ready replicas per ReplicaSet.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_replicaset_status_ready_replicas{namespace="{#NAMESPACE}", replicaset="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: replicaset
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: replicaset
                  value: '{#NAME}'
                - tag: status
                  value: ready
            - uuid: 545c8486dcc9409c93c6efee0f4b2ad6
              name: 'Namespace [{#NAMESPACE}] ReplicaSet [{#NAME}]: Replicas'
              type: DEPENDENT
              key: 'kube.replicaset.replicas[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of replicas per ReplicaSet.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_replicaset_status_replicas{namespace="{#NAMESPACE}", replicaset="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: replicaset
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: replicaset
                  value: '{#NAME}'
            - uuid: 30aea656c8a5470ea4566333077628b3
              name: 'Namespace [{#NAMESPACE}] ReplicaSet [{#NAME}]: Desired replicas'
              type: DEPENDENT
              key: 'kube.replicaset.replicas_desired[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Number of desired pods for a ReplicaSet.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_replicaset_spec_replicas{namespace="{#NAMESPACE}", replicaset="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: replicaset
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: replicaset
                  value: '{#NAME}'
                - tag: status
                  value: desired
            - uuid: a249a4762874499eb83eb8864df5c357
              name: 'Namespace [{#NAMESPACE}] ReplicaSet [{#NAME}]: Replicas mismatched'
              type: DEPENDENT
              key: 'kube.replicaset.replicas_mismatched[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of ready replicas not matching the desired number of replicas.'
              preprocessing:
                - type: PROMETHEUS_TO_JSON
                  parameters:
                    - '{__name__=~"^kube_replicaset_(spec_replicas|status_ready_replicas)$", namespace="{#NAMESPACE}", replicaset="{#NAME}"}'
                - type: JAVASCRIPT
                  parameters:
                    - |
                      var data = JSON.parse(value),
                      	replicas_desired,
                      	replicas_ready;
                      
                      if (data.length !== 2) {
                      	throw 'Incorrect length of JSON (must be 2). Actual length: ' + data.length;
                      }
                      
                      JSON.parse(value).forEach(function (item) {
                      	if (item.name === 'kube_replicaset_spec_replicas') {
                      		replicas_desired = item.value;
                      	}
                      	if (item.name === 'kube_replicaset_status_ready_replicas') {
                      		replicas_ready = item.value;
                      	}
                      });
                      
                      return Math.abs(replicas_desired - replicas_ready);
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: replicaset
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: replicaset
                  value: '{#NAME}'
          trigger_prototypes:
            - uuid: 8046757dbd3b459c9cd9f7bd369dd416
              expression: |
                min(/Kubernetes cluster state by HTTP/kube.replicaset.replicas_mismatched[{#NAMESPACE}/{#NAME}],{$KUBE.REPLICA.MISMATCH.EVAL_PERIOD:"replicaset:{#NAMESPACE}:{#NAME}"})>0
                and last(/Kubernetes cluster state by HTTP/kube.replicaset.replicas_desired[{#NAMESPACE}/{#NAME}])>=0
                and last(/Kubernetes cluster state by HTTP/kube.replicaset.ready[{#NAMESPACE}/{#NAME}])>=0
              name: 'Kubernetes cluster state: Namespace [{#NAMESPACE}] RS [{#NAME}]: ReplicaSet mismatch'
              opdata: 'Desired: {ITEM.LASTVALUE2}, ready: {ITEM.LASTVALUE3}'
              priority: WARNING
              description: 'ReplicaSet has not matched the expected number of replicas during the specified trigger evaluation period.'
              tags:
                - tag: scope
                  value: availability
          master_item:
            key: kube.state.metrics
          lld_macro_paths:
            - lld_macro: '{#NAMESPACE}'
              path: $.labels.namespace
            - lld_macro: '{#NAME}'
              path: $.labels.replicaset
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - kube_replicaset_status_replicas
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: f732cbb0e71e4ab896c973e355d7a6a4
          name: 'Scheduler servers nodes discovery'
          type: DEPENDENT
          key: kube.scheduler.discovery
          host_prototypes:
            - uuid: 46da4b85c58f4c59825e61778a64a58e
              host: 'Scheduler {#NAME}'
              name: 'Scheduler {#NAME}'
              group_links:
                - group:
                    name: Applications
              group_prototypes:
                - name: '{#CLUSTER_HOSTNAME}: Kubernetes/Components: {#COMPONENT.SCHEDULER}'
              templates:
                - name: 'Kubernetes Scheduler by HTTP'
              macros:
                - macro: '{$KUBE.SCHEDULER.SERVER.URL}'
                  value: '{#KUBE.SCHEDULER.SERVER.URL}'
              tags:
                - tag: addr
                  value: '{#IP}'
              custom_interfaces: 'YES'
              interfaces:
                - ip: '{#IP}'
          master_item:
            key: kube.control_plane.lld
        - uuid: 37812660877243e9bdbc0ffc7815578c
          name: 'StatefulSet discovery'
          type: DEPENDENT
          key: kube.statefulset.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.MATCHES}'
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          lifetime: '0'
          item_prototypes:
            - uuid: 9cc34425228f44868f3cd46450d557ca
              name: 'Namespace [{#NAMESPACE}] StatefulSet [{#NAME}]: Replicas'
              type: DEPENDENT
              key: 'kube.statefulset.replicas[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of replicas per StatefulSet.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_statefulset_status_replicas{namespace="{#NAMESPACE}", statefulset="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: statefulset
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: statefulset
                  value: '{#NAME}'
            - uuid: 33e5a534b35f40c6ad7fef53212ef970
              name: 'Namespace [{#NAMESPACE}] StatefulSet [{#NAME}]: Current replicas'
              type: DEPENDENT
              key: 'kube.statefulset.replicas_current[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of current replicas per StatefulSet.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_statefulset_status_replicas_current{namespace="{#NAMESPACE}", statefulset="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: statefulset
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: statefulset
                  value: '{#NAME}'
            - uuid: 3fee3afc8b924b13ae24ab4b5e793acf
              name: 'Namespace [{#NAMESPACE}] StatefulSet [{#NAME}]: Desired replicas'
              type: DEPENDENT
              key: 'kube.statefulset.replicas_desired[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Number of desired pods for a StatefulSet.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_statefulset_replicas{namespace="{#NAMESPACE}", statefulset="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: statefulset
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: statefulset
                  value: '{#NAME}'
                - tag: status
                  value: ready
            - uuid: e2c3e03fe9bd42beab8a5d09c0a766bd
              name: 'Namespace [{#NAMESPACE}] StatefulSet [{#NAME}]: Replicas mismatched'
              type: DEPENDENT
              key: 'kube.statefulset.replicas_mismatched[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of ready replicas not matching the number of replicas.'
              preprocessing:
                - type: PROMETHEUS_TO_JSON
                  parameters:
                    - '{__name__=~"^kube_statefulset_(status_replicas|status_replicas_ready)$", namespace="{#NAMESPACE}", statefulset="{#NAME}"}'
                - type: JAVASCRIPT
                  parameters:
                    - |
                      var data = JSON.parse(value),
                      	replicas,
                      	replicas_ready;
                      
                      if (data.length !== 2) {
                      	throw 'Incorrect length of JSON (must be 2). Actual length: ' + data.length;
                      }
                      
                      JSON.parse(value).forEach(function (item) {
                      	if (item.name === 'kube_statefulset_status_replicas') {
                      		replicas = item.value;
                      	}
                      	if (item.name === 'kube_statefulset_status_replicas_ready') {
                      		replicas_ready = item.value;
                      	}
                      });
                      
                      return Math.abs(replicas - replicas_ready);
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: statefulset
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: statefulset
                  value: '{#NAME}'
            - uuid: b35c1cebd902484998f383585ce29b76
              name: 'Namespace [{#NAMESPACE}] StatefulSet [{#NAME}]: Ready replicas'
              type: DEPENDENT
              key: 'kube.statefulset.replicas_ready[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of ready replicas per StatefulSet.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_statefulset_status_replicas_ready{namespace="{#NAMESPACE}", statefulset="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: statefulset
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: statefulset
                  value: '{#NAME}'
                - tag: status
                  value: ready
            - uuid: b00b1cfed30e4b90b9754d543e72d7aa
              name: 'Namespace [{#NAMESPACE}] StatefulSet [{#NAME}]: Updated replicas'
              type: DEPENDENT
              key: 'kube.statefulset.replicas_updated[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'The number of updated replicas per StatefulSet.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kube_statefulset_status_replicas_updated{namespace="{#NAMESPACE}", statefulset="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: statefulset
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: statefulset
                  value: '{#NAME}'
                - tag: status
                  value: updated
          trigger_prototypes:
            - uuid: c29a27fe5a0345c8af9e0d4e99b22dcb
              expression: '(last(/Kubernetes cluster state by HTTP/kube.statefulset.replicas_ready[{#NAMESPACE}/{#NAME}]) / last(/Kubernetes cluster state by HTTP/kube.statefulset.replicas_current[{#NAMESPACE}/{#NAME}]))<>1'
              name: 'Kubernetes cluster state: Namespace [{#NAMESPACE}] StatefulSet [{#NAME}]: StatefulSet is down'
              priority: HIGH
              tags:
                - tag: scope
                  value: availability
            - uuid: 469d6933f5494ca48a212cdc364058e0
              expression: |
                min(/Kubernetes cluster state by HTTP/kube.statefulset.replicas_mismatched[{#NAMESPACE}/{#NAME}],{$KUBE.REPLICA.MISMATCH.EVAL_PERIOD:"statefulset:{#NAMESPACE}:{#NAME}"})>0
                and last(/Kubernetes cluster state by HTTP/kube.statefulset.replicas[{#NAMESPACE}/{#NAME}])>=0
                and last(/Kubernetes cluster state by HTTP/kube.statefulset.replicas_ready[{#NAMESPACE}/{#NAME}])>=0
              name: 'Kubernetes cluster state: Namespace [{#NAMESPACE}] StatefulSet [{#NAME}]: StatefulSet replicas mismatch'
              opdata: 'Replicas: {ITEM.LASTVALUE2}, ready: {ITEM.LASTVALUE3}'
              priority: WARNING
              description: 'StatefulSet has not matched the number of replicas during the specified trigger evaluation period.'
              tags:
                - tag: scope
                  value: availability
          master_item:
            key: kube.state.metrics
          lld_macro_paths:
            - lld_macro: '{#NAMESPACE}'
              path: $.labels.namespace
            - lld_macro: '{#NAME}'
              path: $.labels.statefulset
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - kube_statefulset_status_replicas
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: 428c4419ac8b4c91995a2aa7332b1943
          name: 'OpenShift Build discovery'
          type: DEPENDENT
          key: openshift.build.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.MATCHES}'
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          lifetime: '0'
          item_prototypes:
            - uuid: 4d1013542dcb45b3ae59fd276b0df3e0
              name: 'Namespace [{#NAMESPACE}] Build [{#NAME}]: Created'
              type: DEPENDENT
              key: 'openshift.build.created.time[{#NAMESPACE}/{#NAME}]'
              units: unixtime
              description: 'OpenShift Build Unix creation timestamp.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'openshift_build_created{namespace="{#NAMESPACE}", build="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: MULTIPLIER
                  parameters:
                    - '1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: kube.state.metrics
              tags:
                - tag: build
                  value: '{#NAME}'
                - tag: component
                  value: build
                - tag: component
                  value: openshift
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: 97ebce9edb774e25943ed22416caaa0b
              name: 'Namespace [{#NAMESPACE}] Build [{#NAME}]: Generation'
              type: DEPENDENT
              key: 'openshift.build.sequence.number[{#NAMESPACE}/{#NAME}]'
              description: 'Sequence number representing a specific generation of the desired state.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'openshift_build_metadata_generation{namespace="{#NAMESPACE}", build="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: build
                  value: '{#NAME}'
                - tag: component
                  value: build
                - tag: component
                  value: openshift
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: 9a8bdd353a5a499c8c66468c1325ae16
              name: 'Namespace [{#NAMESPACE}] Build [{#NAME}]: Status phase'
              type: DEPENDENT
              key: 'openshift.build.status_phase[{#NAMESPACE}/{#NAME}]'
              description: 'The Build phase.'
              valuemap:
                name: 'Build status phases'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'openshift_build_status_phase{build="{#NAME}"} == 1'
                    - label
                    - build_phase
                  error_handler: DISCARD_VALUE
                - type: JAVASCRIPT
                  parameters:
                    - 'return [''complete'', ''cancelled'', ''new'', ''pending'', ''running'', ''failed'', ''error''].indexOf(value) + 1 || ''Problem with status processing in JS, no such build status: '' + value;'
              master_item:
                key: kube.state.metrics
              tags:
                - tag: build
                  value: '{#NAME}'
                - tag: component
                  value: build
                - tag: component
                  value: openshift
                - tag: namespace
                  value: '{#NAMESPACE}'
              trigger_prototypes:
                - uuid: b3364370ae954d69b7fad1ac3afd238b
                  expression: 'count(/Kubernetes cluster state by HTTP/openshift.build.status_phase[{#NAMESPACE}/{#NAME}],2m,"ge",6)>=2'
                  name: 'Kubernetes cluster state: Build [{#NAME}]: Build has failed'
                  priority: WARNING
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: kube.state.metrics
          lld_macro_paths:
            - lld_macro: '{#NAMESPACE}'
              path: $.labels.namespace
            - lld_macro: '{#NAME}'
              path: $.labels.build
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - openshift_build_created
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: 974679d1b2bc4d7294baeca07bd19e07
          name: 'OpenShift BuildConfig discovery'
          type: DEPENDENT
          key: openshift.buildconfig.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.MATCHES}'
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          lifetime: '0'
          item_prototypes:
            - uuid: 09d0c8ed4d604d898f212419ccdf8324
              name: 'Namespace [{#NAMESPACE}] BuildConfig [{#NAME}]: Created'
              type: DEPENDENT
              key: 'openshift.buildconfig.created.time[{#NAMESPACE}/{#NAME}]'
              units: unixtime
              description: 'OpenShift BuildConfig Unix creation timestamp.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'openshift_buildconfig_created{namespace="{#NAMESPACE}", buildconfig="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: MULTIPLIER
                  parameters:
                    - '1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: kube.state.metrics
              tags:
                - tag: buildconfig
                  value: '{#NAME}'
                - tag: component
                  value: buildconfig
                - tag: component
                  value: openshift
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: 2e90ec2497eb4eb3bf41b68282f07e6d
              name: 'Namespace [{#NAMESPACE}] BuildConfig [{#NAME}]: Generation'
              type: DEPENDENT
              key: 'openshift.buildconfig.generation[{#NAMESPACE}/{#NAME}]'
              description: 'Sequence number representing a specific generation of the desired state.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'openshift_buildconfig_metadata_generation{namespace="{#NAMESPACE}", buildconfig="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: buildconfig
                  value: '{#NAME}'
                - tag: component
                  value: buildconfig
                - tag: component
                  value: openshift
                - tag: namespace
                  value: '{#NAMESPACE}'
            - uuid: e97bf96c39d1407cbc42013bcd3a5095
              name: 'Namespace [{#NAMESPACE}] BuildConfig [{#NAME}]: Latest version'
              type: DEPENDENT
              key: 'openshift.buildconfig.status[{#NAMESPACE}/{#NAME}]'
              description: 'The latest version of BuildConfig.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'openshift_buildconfig_status_latest_version{namespace="{#NAMESPACE}", buildconfig="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: kube.state.metrics
              tags:
                - tag: buildconfig
                  value: '{#NAME}'
                - tag: component
                  value: buildconfig
                - tag: component
                  value: openshift
                - tag: namespace
                  value: '{#NAMESPACE}'
          master_item:
            key: kube.state.metrics
          lld_macro_paths:
            - lld_macro: '{#NAMESPACE}'
              path: $.labels.namespace
            - lld_macro: '{#NAME}'
              path: $.labels.buildconfig
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - openshift_buildconfig_created
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: d7e21c75073548078e06159ff94680c9
          name: 'OpenShift ClusterResourceQuota discovery'
          type: DEPENDENT
          key: openshift.cluster.resource.quota.discovery
          lifetime: '0'
          item_prototypes:
            - uuid: 0b3826bad61c407ab4b9e103f0a3ae18
              name: 'Quota [{#NAME}] Resource [{#RESOURCE}]: Type [{#TYPE}]]'
              type: DEPENDENT
              key: 'openshift.cluster.resource.quota[{#RESOURCE}/{#NAME}/{#TYPE}]'
              description: 'Usage about resource quota.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'openshift_clusterresourcequota_usage{name="{#NAME}", resource="{#RESOURCE}", type="{#TYPE}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: openshift
                - tag: quota
                  value: '{#NAME}'
                - tag: resource
                  value: '{#RESOURCE}'
                - tag: type
                  value: '{#TYPE}'
          master_item:
            key: kube.state.metrics
          lld_macro_paths:
            - lld_macro: '{#NAME}'
              path: $.labels.name
            - lld_macro: '{#RESOURCE}'
              path: $.labels.resource
            - lld_macro: '{#TYPE}'
              path: $.labels.type
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - openshift_clusterresourcequota_usage
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: 140a80726c60443ca5bb87b758924f7f
          name: 'OpenShift Route discovery'
          type: DEPENDENT
          key: openshift.route.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.MATCHES}'
              - macro: '{#NAMESPACE}'
                value: '{$KUBE.LLD.FILTER.NAMESPACE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          lifetime: '0'
          item_prototypes:
            - uuid: a59550207a484b918193d4a57b08d97e
              name: 'Namespace [{#NAMESPACE}] Route [{#NAME}]: Created'
              type: DEPENDENT
              key: 'openshift.route.created.time[{#NAMESPACE}/{#NAME}]'
              units: unixtime
              description: 'OpenShift Route Unix creation timestamp.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'openshift_route_created{namespace="{#NAMESPACE}", route="{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: MULTIPLIER
                  parameters:
                    - '1'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: openshift
                - tag: component
                  value: route
                - tag: host
                  value: '{#HOST}'
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: route
                  value: '{#NAME}'
            - uuid: d55f9134b0fa4f3ea0eea93a682ab4f9
              name: 'Namespace [{#NAMESPACE}] Route [{#NAME}]: Status'
              type: DEPENDENT
              key: 'openshift.route.status[{#NAMESPACE}/{#NAME}]'
              description: 'Information about route status.'
              valuemap:
                name: 'Boolean format'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'openshift_route_status{route="{#NAME}"} == 1'
                    - label
                    - status
                  error_handler: DISCARD_VALUE
                - type: BOOL_TO_DECIMAL
              master_item:
                key: kube.state.metrics
              tags:
                - tag: component
                  value: openshift
                - tag: component
                  value: route
                - tag: host
                  value: '{#HOST}'
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: route
                  value: '{#NAME}'
              trigger_prototypes:
                - uuid: 98a6d7ba3a4049d693f5471819ee4b2e
                  expression: 'count(/Kubernetes cluster state by HTTP/openshift.route.status[{#NAMESPACE}/{#NAME}],2m,,0)>=2'
                  name: 'Kubernetes cluster state: Route [{#NAME}] with issue: Status is false'
                  priority: WARNING
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: kube.state.metrics
          lld_macro_paths:
            - lld_macro: '{#HOST}'
              path: $.labels.host
            - lld_macro: '{#NAMESPACE}'
              path: $.labels.namespace
            - lld_macro: '{#NAME}'
              path: $.labels.route
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - openshift_route_info
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
      tags:
        - tag: class
          value: software
        - tag: subclass
          value: automation
        - tag: subclass
          value: containers
        - tag: subclass
          value: deploy
        - tag: subclass
          value: development
        - tag: subclass
          value: virtualization
        - tag: target
          value: cluster-state
        - tag: target
          value: kubernetes
      macros:
        - macro: '{$KUBE.API.COMPONENTSTATUSES.ENDPOINT}'
          value: /api/v1/componentstatuses
          description: 'Kubernetes API componentstatuses endpoint /api/v1/componentstatuses'
          config:
            type: TEXT
            priority: '4'
            label: 'Componentstatuses Endpoint'
            description: 'The Kubernetes API componentstatuses endpoint.'
        - macro: '{$KUBE.API.LIVEZ.ENDPOINT}'
          value: /livez
          description: 'Kubernetes API livez endpoint /livez'
          config:
            type: TEXT
            priority: '3'
            label: 'Livez Endpoint'
            description: 'The Kubernetes API livez endpoint.'
        - macro: '{$KUBE.API.READYZ.ENDPOINT}'
          value: /readyz
          description: 'Kubernetes API readyz endpoint /readyz'
          config:
            type: TEXT
            priority: '5'
            label: 'Readyz Endpoint'
            description: 'The Kubernetes API readyz endpoint.'
        - macro: '{$KUBE.API.TOKEN}'
          type: SECRET_TEXT
          description: 'Service account bearer token.'
          config:
            type: TEXT
            priority: '1'
            label: 'API Token'
            description: 'Service account bearer token for authentication.'
            required: 'YES'
        - macro: '{$KUBE.API.URL}'
          value: 'https://kubernetes.default.svc.cluster.local:443'
          description: 'Kubernetes API endpoint URL in the format <scheme>://<host>:<port>'
          config:
            type: TEXT
            priority: '2'
            label: 'Kubernetes API URL'
            description: 'The Kubernetes API endpoint URL.'
            required: 'YES'
        - macro: '{$KUBE.API_SERVER.PORT}'
          value: '6443'
          description: 'Kubernetes API servers metrics endpoint port. Used in ControlPlane LLD.'
          config:
            type: TEXT
            priority: '10'
            label: 'API Server Port'
            description: 'The port for the Kubernetes API server metrics endpoint. In the range from 1 to 65535 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$KUBE.API_SERVER.SCHEME}'
          value: https
          description: 'Kubernetes API servers metrics endpoint scheme. Used in ControlPlane LLD.'
          config:
            type: LIST
            priority: '9'
            label: 'API Server Scheme'
            description: 'The scheme for the Kubernetes API server metrics endpoint.'
            options:
              - value: https
                text: HTTPS
              - value: http
                text: HTTP
        - macro: '{$KUBE.CONTROLLER_MANAGER.PORT}'
          value: '10257'
          description: 'Kubernetes Controller manager metrics endpoint port. Used in ControlPlane LLD.'
          config:
            type: TEXT
            priority: '13'
            label: 'Controller Manager Port'
            description: 'The port for the Kubernetes Controller Manager metrics endpoint. In the range from 1 to 65535 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$KUBE.CONTROLLER_MANAGER.SCHEME}'
          value: https
          description: 'Kubernetes Controller manager metrics endpoint scheme. Used in ControlPlane LLD.'
          config:
            type: LIST
            priority: '12'
            label: 'Controller Manager Scheme'
            description: 'The scheme for the Kubernetes Controller Manager metrics endpoint.'
            options:
              - value: https
                text: HTTPS
              - value: http
                text: HTTP
        - macro: '{$KUBE.CONTROL_PLANE.TAINT}'
          value: node-role.kubernetes.io/control-plane
          description: 'Taint that applies to control plane nodes. Change if needed. Used in ControlPlane LLD.'
          config:
            type: TEXT
            priority: '11'
            label: 'Control Plane Taint'
            description: 'The taint for control plane nodes.'
        - macro: '{$KUBE.HTTP.PROXY}'
          description: 'Sets the HTTP proxy to `http_proxy` value. If this parameter is empty, then no proxy is used.'
          config:
            type: TEXT
            priority: '6'
            section_name: Other
            label: 'HTTP Proxy'
            description: 'HTTP proxy to use for requests.'
        - macro: '{$KUBE.KUBELET.FILTER.ANNOTATIONS}'
          description: 'Node annotations to filter Kubelets (regex in values are supported). See the template''s README.md for details.'
          config:
            type: TEXT
            priority: '24'
            section_name: Filters
            label: 'Kubelet Annotations Filter'
            description: 'Node annotations to filter Kubelets.'
        - macro: '{$KUBE.KUBELET.FILTER.LABELS}'
          description: 'Node labels to filter Kubelets (regex in values are supported). See the template''s README.md for details.'
          config:
            type: TEXT
            priority: '25'
            section_name: Filters
            label: 'Kubelet Labels Filter'
            description: 'Node labels to filter Kubelets.'
        - macro: '{$KUBE.KUBELET.PORT}'
          value: '10250'
          description: 'Kubernetes Kubelet metrics endpoint port. Used in Kubelet LLD.'
          config:
            type: TEXT
            priority: '17'
            label: 'Kubelet Port'
            description: 'The port for the Kubernetes Kubelet metrics endpoint. In the range from 1 to 65535 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$KUBE.KUBELET.SCHEME}'
          value: https
          description: 'Kubernetes Kubelet metrics endpoint scheme. Used in Kubelet LLD.'
          config:
            type: LIST
            priority: '16'
            label: 'Kubelet Scheme'
            description: 'The scheme for the Kubernetes Kubelet metrics endpoint.'
            options:
              - value: https
                text: HTTPS
              - value: http
                text: HTTP
        - macro: '{$KUBE.LLD.FILTER.KUBELET_NODE.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable Kubelets by nodename.'
          config:
            type: TEXT
            priority: '22'
            section_name: Filters
            label: 'Kubelet Node Matches Filter'
            description: 'A regex to filter discoverable Kubelets by nodename.'
        - macro: '{$KUBE.LLD.FILTER.KUBELET_NODE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter to exclude discovered Kubelets by nodename.'
          config:
            type: TEXT
            priority: '23'
            section_name: Filters
            label: 'Kubelet Node Exclude Filter'
            description: 'A regex to exclude discovered Kubelets by nodename.'
        - macro: '{$KUBE.LLD.FILTER.NAMESPACE.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable metrics by namespace.'
          config:
            type: TEXT
            priority: '18'
            section_name: Filters
            label: 'Namespace Matches Filter'
            description: 'A regex to filter discoverable metrics by namespace.'
        - macro: '{$KUBE.LLD.FILTER.NAMESPACE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter to exclude discovered metrics by namespace.'
          config:
            type: TEXT
            priority: '19'
            section_name: Filters
            label: 'Namespace Exclude Filter'
            description: 'A regex to exclude discovered metrics by namespace.'
        - macro: '{$KUBE.LLD.FILTER.NODE.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable nodes by nodename.'
          config:
            type: TEXT
            priority: '20'
            section_name: Filters
            label: 'Node Matches Filter'
            description: 'A regex to filter discoverable nodes by nodename.'
        - macro: '{$KUBE.LLD.FILTER.NODE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter to exclude discovered nodes by nodename.'
          config:
            type: TEXT
            priority: '21'
            section_name: Filters
            label: 'Node Exclude Filter'
            description: 'A regex to exclude discovered nodes by nodename.'
        - macro: '{$KUBE.LLD.FILTER.PV.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable persistent volumes by name.'
          config:
            type: TEXT
            priority: '26'
            section_name: Filters
            label: 'Persistent Volume Matches Filter'
            description: 'A regex to filter discoverable persistent volumes by name.'
        - macro: '{$KUBE.LLD.FILTER.PV.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter to exclude discovered persistent volumes by name.'
          config:
            type: TEXT
            priority: '27'
            section_name: Filters
            label: 'Persistent Volume Exclude Filter'
            description: 'A regex to exclude discovered persistent volumes by name.'
        - macro: '{$KUBE.REPLICA.MISMATCH.EVAL_PERIOD}'
          value: '#5'
          description: 'The evaluation period range which is used for calculation of expressions in trigger prototypes (time period or value range). Can be used with context.'
          config:
            type: TEXT
            priority: '28'
            section_name: Other
            label: 'Replica Mismatch Evaluation Period'
            description: 'The evaluation period range for trigger prototype calculations.'
        - macro: '{$KUBE.SCHEDULER.PORT}'
          value: '10259'
          description: 'Kubernetes Scheduler metrics endpoint port. Used in ControlPlane LLD.'
          config:
            type: TEXT
            priority: '15'
            label: 'Scheduler Port'
            description: 'The port for the Kubernetes Scheduler metrics endpoint. In the range from 1 to 65535 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$KUBE.SCHEDULER.SCHEME}'
          value: https
          description: 'Kubernetes Scheduler metrics endpoint scheme. Used in ControlPlane LLD.'
          config:
            type: LIST
            priority: '14'
            label: 'Scheduler Scheme'
            description: 'The scheme for the Kubernetes Scheduler metrics endpoint.'
            options:
              - value: https
                text: HTTPS
              - value: http
                text: HTTP
        - macro: '{$KUBE.STATE.ENDPOINT.NAME}'
          value: zabbix-kube-state-metrics
          description: 'Endpoint name for kube-state-metrics service (check with `kubectl get ep -n monitoring -owide`).'
          config:
            type: TEXT
            priority: '7'
            label: 'State Endpoint Name'
            description: 'The name of the Kubernetes state endpoint.'
        - macro: '{$OPENSHIFT.STATE.ENDPOINT.NAME}'
          value: openshift-state-metrics
          description: 'OpenShift state endpoint name.'
          config:
            type: TEXT
            priority: '8'
            label: 'OpenShift State Endpoint Name'
            description: 'The name of the OpenShift state endpoint.'
      valuemaps:
        - uuid: a435f7e23050406ca40cf6f5f872b5a7
          name: 'Boolean format'
          mappings:
            - value: '0'
              newvalue: 'False'
            - value: '1'
              newvalue: 'True'
        - uuid: a315a447059e49f9bc0c3e2e9964696f
          name: 'Build status phases'
          mappings:
            - value: '1'
              newvalue: complete
            - value: '2'
              newvalue: cancelled
            - value: '3'
              newvalue: new
            - value: '4'
              newvalue: pending
            - value: '5'
              newvalue: running
            - value: '6'
              newvalue: failed
            - value: '7'
              newvalue: error
        - uuid: f5aa4a786972420b859029116aac8a2f
          name: 'PV and PVC status phases'
          mappings:
            - value: '1'
              newvalue: Available
            - value: '2'
              newvalue: Bound
            - value: '3'
              newvalue: Failed
            - value: '4'
              newvalue: Lost
            - value: '5'
              newvalue: Pending
            - value: '6'
              newvalue: Released
    - uuid: 2420a8a4fda74fbc81743aed69fafa3b
      template: 'Kubernetes Controller manager by HTTP'
      name: 'Kubernetes Controller manager by HTTP'
      description: |
        Get Kubernetes Controller manager metrics by HTTP agent from Prometheus metrics endpoint.
        
        Don't forget change macros {$KUBE.API.SERVER.URL}.
        Some metrics may not be collected depending on your Kubernetes Controller manager instance version and configuration.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        The template to monitor Kubernetes Controller manager by Zabbix that works without any external scripts.
        Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.
        
        Template `Kubernetes Controller manager by HTTP` - collects metrics by HTTP agent from Controller manager /metrics endpoint.
        
        ## Setup
        
        Internal service metrics are collected from /metrics endpoint.
        Template needs to use Authorization via API token.
        
        Set the following fields: `Metrics endpoint URL`, `API Authorization Token`.
        
        **Note:** You might need to set the `--binding-address` option for Controller Manager to the address where Zabbix proxy can reach it.
        For example, for clusters created with `kubeadm` it can be set in the following manifest file (changes will be applied immediately):
        
        - /etc/kubernetes/manifests/kube-controller-manager.yaml
        
        **Note:** Some metrics may not be collected depending on your Kubernetes Controller manager instance version and configuration.
      vendor:
        name: Zabbix
        version: 8.0-1
      groups:
        - name: Templates/Applications
      items:
        - uuid: 774693b22f844424a93f6a56001c8cba
          name: 'REST Client requests: 2xx, rate'
          type: DEPENDENT
          key: kubernetes.controller.client_http_requests_200.rate
          value_type: FLOAT
          description: 'Number of HTTP requests with 2xx status code per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'rest_client_requests_total{code =~ "2.."}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.controller.get_metrics
          tags:
            - tag: component
              value: rest
            - tag: http-code
              value: 2xx
        - uuid: ace0d156101b481d9f53c3f48e84bd38
          name: 'REST Client requests: 3xx, rate'
          type: DEPENDENT
          key: kubernetes.controller.client_http_requests_300.rate
          value_type: FLOAT
          description: 'Number of HTTP requests with 3xx status code per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'rest_client_requests_total{code =~ "3.."}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.controller.get_metrics
          tags:
            - tag: component
              value: rest
            - tag: http-code
              value: 3xx
        - uuid: c6b67e4330184ca98281773c69925d98
          name: 'REST Client requests: 4xx, rate'
          type: DEPENDENT
          key: kubernetes.controller.client_http_requests_400.rate
          value_type: FLOAT
          description: 'Number of HTTP requests with 4xx status code per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'rest_client_requests_total{code =~ "4.."}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.controller.get_metrics
          tags:
            - tag: component
              value: rest
            - tag: http-code
              value: 4xx
        - uuid: ac6397e9f62749199f857e6c859daa59
          name: 'REST Client requests: 5xx, rate'
          type: DEPENDENT
          key: kubernetes.controller.client_http_requests_500.rate
          value_type: FLOAT
          description: 'Number of HTTP requests with 5xx status code per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'rest_client_requests_total{code =~ "5.."}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.controller.get_metrics
          tags:
            - tag: component
              value: rest
            - tag: http-code
              value: 5xx
          triggers:
            - uuid: 13c32daebddd454bb5908a9a27c3a76f
              expression: 'min(/Kubernetes Controller manager by HTTP/kubernetes.controller.client_http_requests_500.rate,5m)>{$KUBE.CONTROLLER.HTTP.CLIENT.ERROR}'
              name: 'Kubernetes Controller manager: Too many HTTP client errors'
              event_name: 'Kubernetes Controller manager: Too many HTTP client errors (over {$KUBE.CONTROLLER.HTTP.CLIENT.ERROR} for 5m)'
              priority: WARNING
              description: '"Kubernetes Controller manager is experiencing high error rate (with 5xx HTTP code).'
              tags:
                - tag: scope
                  value: availability
        - uuid: 6bde8365469f47359fcc5716207b8870
          name: CPU
          type: DEPENDENT
          key: kubernetes.controller.cpu.util
          value_type: FLOAT
          units: '%'
          description: 'Total user and system CPU usage ratio.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_cpu_seconds_total
                - value
                - ''
            - type: CHANGE_PER_SECOND
            - type: MULTIPLIER
              parameters:
                - '100'
          master_item:
            key: kubernetes.controller.get_metrics
          tags:
            - tag: component
              value: cpu
        - uuid: c684929ea8444a6aa24f1fb80812a6eb
          name: 'Kubernetes Controller: Get Controller metrics'
          type: HTTP_AGENT
          key: kubernetes.controller.get_metrics
          history: '0'
          value_type: TEXT
          description: 'Get raw metrics from Controller instance /metrics endpoint.'
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
          timeout: 15s
          url: '{$KUBE.CONTROLLER.SERVER.URL}'
          headers:
            - name: Authorization
              value: 'Bearer {$KUBE.API.TOKEN}'
          tags:
            - tag: component
              value: raw
        - uuid: 8e4f98354c89410ebad42af485e3f710
          name: Goroutines
          type: DEPENDENT
          key: kubernetes.controller.go_goroutines
          value_type: FLOAT
          description: 'Number of goroutines that currently exist.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - go_goroutines
                - function
                - sum
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.controller.get_metrics
          tags:
            - tag: component
              value: goroutines
        - uuid: f30ba3d8679b4ffd86a20427892da228
          name: 'Go threads'
          type: DEPENDENT
          key: kubernetes.controller.go_threads
          value_type: FLOAT
          description: 'Number of OS threads created.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - go_threads
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.controller.get_metrics
          tags:
            - tag: component
              value: go-threads
        - uuid: b9ef0724331f4f9da830c470b8e2fea1
          name: 'Leader election status'
          type: DEPENDENT
          key: kubernetes.controller.leader_election_master_status
          value_type: FLOAT
          description: 'Gauge of if the reporting system is master of the relevant lease, 0 indicates backup, 1 indicates master.'
          valuemap:
            name: 'Leader status'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - leader_election_master_status
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.controller.get_metrics
          tags:
            - tag: component
              value: leader
        - uuid: 5bb0657b329c44e6a7a6dd169551205b
          name: 'Fds max'
          type: DEPENDENT
          key: kubernetes.controller.max_fds
          value_type: FLOAT
          description: 'Maximum allowed open file descriptors.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_max_fds
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.controller.get_metrics
          tags:
            - tag: component
              value: fds
        - uuid: 43698df9a76c410792f0fdb9d41ee42c
          name: 'Fds open'
          type: DEPENDENT
          key: kubernetes.controller.open_fds
          value_type: FLOAT
          description: 'Number of open file descriptors.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_open_fds
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.controller.get_metrics
          tags:
            - tag: component
              value: fds
        - uuid: 7497f4f8d1d8422dad301d9d25b42150
          name: 'Resident memory, bytes'
          type: DEPENDENT
          key: kubernetes.controller.process_resident_memory_bytes
          value_type: FLOAT
          units: B
          description: 'Resident memory size in bytes.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_resident_memory_bytes
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.controller.get_metrics
          tags:
            - tag: component
              value: memory
        - uuid: 884a7a4de05548ffbdf14629bbe5d181
          name: 'Virtual memory, bytes'
          type: DEPENDENT
          key: kubernetes.controller.process_virtual_memory_bytes
          value_type: FLOAT
          units: B
          description: 'Virtual memory size in bytes.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_virtual_memory_bytes
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.controller.get_metrics
          tags:
            - tag: component
              value: memory
      discovery_rules:
        - uuid: 3117060c51564c2e897e3194821b137f
          name: 'Workqueue metrics discovery'
          type: DEPENDENT
          key: kubernetes.controller.workqueue.discovery
          item_prototypes:
            - uuid: 70277a128a254462ad0bf7a023738ba0
              name: '["{#NAME}"]: Workqueue duration seconds bucket, {#LE}'
              type: DEPENDENT
              key: 'kubernetes.controller.duration_seconds_bucket[{#LE},"{#NAME}"]'
              history: 1h
              value_type: FLOAT
              trends: '0'
              discover: NO_DISCOVER
              description: 'How long in seconds processing an item from workqueue takes.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'workqueue_work_duration_seconds_bucket{name = "{#NAME}",le = "{#LE}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kubernetes.controller.get_metrics
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
            - uuid: 8357905c82ea42b98d686eee2d9c35f6
              name: '["{#NAME}"]: Queue duration seconds bucket, {#LE}'
              type: DEPENDENT
              key: 'kubernetes.controller.queue_duration_seconds_bucket[{#LE},"{#NAME}"]'
              history: 1h
              value_type: FLOAT
              trends: '0'
              discover: NO_DISCOVER
              description: 'How long in seconds an item stays in workqueue before being requested.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'workqueue_queue_duration_seconds_bucket{name = "{#NAME}",le = "{#LE}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kubernetes.controller.get_metrics
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
            - uuid: 940dc936417849c7aed7ae824883fdaf
              name: '["{#NAME}"]: Workqueue adds total, rate'
              type: DEPENDENT
              key: 'kubernetes.controller.workqueue_adds_total["{#NAME}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              description: 'Total number of adds handled by workqueue per second.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'workqueue_adds_total{name = "{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: CHANGE_PER_SECOND
              master_item:
                key: kubernetes.controller.get_metrics
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
            - uuid: 7edfab667cdf41908bd551c0a25e4adc
              name: '["{#NAME}"]: Workqueue depth'
              type: DEPENDENT
              key: 'kubernetes.controller.workqueue_depth["{#NAME}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              description: 'Current depth of workqueue.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'workqueue_depth{name = "{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kubernetes.controller.get_metrics
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
            - uuid: 9a510f3b3d3547c1817b72e38340ccd2
              name: '["{#NAME}"]: Workqueue longest running processor, sec'
              type: DEPENDENT
              key: 'kubernetes.controller.workqueue_longest_running_processor_seconds["{#NAME}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              description: 'How many seconds has the longest running processor for workqueue been running.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'workqueue_longest_running_processor_seconds{name = "{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kubernetes.controller.get_metrics
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
            - uuid: 0657d0741d5649a2b0ad87c2f39dc243
              name: '["{#NAME}"]: Workqueue queue duration, 50p'
              type: CALCULATED
              key: 'kubernetes.controller.workqueue_queue_duration_seconds_p50["{#NAME}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.controller.queue_duration_seconds_bucket[*,"{#NAME}"],5m,50)'
              description: '50 percentile of how long in seconds an item stays in workqueue before being requested. If there are no requests for 5 minute, item value will be discarded.'
              preprocessing:
                - type: CHECK_NOT_SUPPORTED
                  parameters:
                    - '-1'
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
            - uuid: 9f976d181b7f4776a271e683d9efd396
              name: '["{#NAME}"]: Workqueue queue duration, p90'
              type: CALCULATED
              key: 'kubernetes.controller.workqueue_queue_duration_seconds_p90["{#NAME}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.controller.queue_duration_seconds_bucket[*,"{#NAME}"],5m,90)'
              description: '90 percentile of how long in seconds an item stays in workqueue before being requested, by queue.'
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
            - uuid: ce4b9daa161742ffb6fec0790c1dc689
              name: '["{#NAME}"]: Workqueue queue duration, p95'
              type: CALCULATED
              key: 'kubernetes.controller.workqueue_queue_duration_seconds_p95["{#NAME}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.controller.queue_duration_seconds_bucket[*,"{#NAME}"],5m,95)'
              description: '95 percentile of how long in seconds an item stays in workqueue before being requested, by queue.'
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
            - uuid: 61d5f616cc474ae3adfcbd1a15fdd607
              name: '["{#NAME}"]: Workqueue queue duration, p99'
              type: CALCULATED
              key: 'kubernetes.controller.workqueue_queue_duration_seconds_p99["{#NAME}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.controller.queue_duration_seconds_bucket[*,"{#NAME}"],5m,99)'
              description: '99 percentile of how long in seconds an item stays in workqueue before being requested, by queue.'
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
            - uuid: a4e25b0e8cd340d48e098b89ffcdd49a
              name: '["{#NAME}"]: Workqueue retries, rate'
              type: DEPENDENT
              key: 'kubernetes.controller.workqueue_retries_total["{#NAME}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              description: 'Total number of retries handled by workqueue per second.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'workqueue_retries_total{name = "{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: CHANGE_PER_SECOND
              master_item:
                key: kubernetes.controller.get_metrics
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
            - uuid: e230e1573f4042b088a8a4b2e3998d43
              name: '["{#NAME}"]: Workqueue unfinished work, sec'
              type: DEPENDENT
              key: 'kubernetes.controller.workqueue_unfinished_work_seconds["{#NAME}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              description: 'How many seconds of work has done that is in progress and hasn''t been observed by work_duration. Large values indicate stuck threads. One can deduce the number of stuck threads by observing the rate at which this increases.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'workqueue_unfinished_work_seconds{name = "{#NAME}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kubernetes.controller.get_metrics
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
            - uuid: 68efc8bc4fec458384e21b7b19db696c
              name: '["{#NAME}"]: Workqueue work duration, 50p'
              type: CALCULATED
              key: 'kubernetes.controller.workqueue_work_duration_seconds_p50["{#NAME}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.controller.duration_seconds_bucket[*,"{#NAME}"],5m,50)'
              description: '50 percentiles of how long in seconds processing an item from workqueue takes, by queue.'
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
            - uuid: ff4f4b222dfd47f69b96513fed4393f5
              name: '["{#NAME}"]: Workqueue work duration, p90'
              type: CALCULATED
              key: 'kubernetes.controller.workqueue_work_duration_seconds_p90["{#NAME}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.controller.duration_seconds_bucket[*,"{#NAME}"],5m,90)'
              description: '90 percentile of how long in seconds processing an item from workqueue takes, by queue.'
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
            - uuid: 34a688601a404d63aea3a774a9f5970a
              name: '["{#NAME}"]: Workqueue work duration, p95'
              type: CALCULATED
              key: 'kubernetes.controller.workqueue_work_duration_seconds_p95["{#NAME}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.controller.duration_seconds_bucket[*,"{#NAME}"],5m,95)'
              description: '95 percentile of how long in seconds processing an item from workqueue takes, by queue.'
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
            - uuid: e5b4ea49906e4a12b01757854a5766a4
              name: '["{#NAME}"]: Workqueue work duration, p99'
              type: CALCULATED
              key: 'kubernetes.controller.workqueue_work_duration_seconds_p99["{#NAME}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.controller.duration_seconds_bucket[*,"{#NAME}"],5m,99)'
              description: '99 percentile of how long in seconds processing an item from workqueue takes, by queue.'
              tags:
                - tag: component
                  value: workqueue
                - tag: workqueue
                  value: '{#NAME}'
          graph_prototypes:
            - uuid: 40113b2f3fe04e9dbfd4d6dc204be7ce
              name: 'Kubernetes Controller Manager: ["{#NAME}"] Workqueue add rate'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'Kubernetes Controller manager by HTTP'
                    key: 'kubernetes.controller.workqueue_adds_total["{#NAME}"]'
            - uuid: 99bd6b4904964738a2ba7f165cc78d9c
              name: 'Kubernetes Controller Manager: ["{#NAME}"] Workqueue depth'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'Kubernetes Controller manager by HTTP'
                    key: 'kubernetes.controller.workqueue_depth["{#NAME}"]'
            - uuid: 4f823f87056b42d29a284f8e2614b76f
              name: 'Kubernetes Controller Manager: ["{#NAME}"] Workqueue latency'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'Kubernetes Controller manager by HTTP'
                    key: 'kubernetes.controller.workqueue_queue_duration_seconds_p95["{#NAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'Kubernetes Controller manager by HTTP'
                    key: 'kubernetes.controller.workqueue_queue_duration_seconds_p99["{#NAME}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'Kubernetes Controller manager by HTTP'
                    key: 'kubernetes.controller.workqueue_queue_duration_seconds_p90["{#NAME}"]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'Kubernetes Controller manager by HTTP'
                    key: 'kubernetes.controller.workqueue_queue_duration_seconds_p50["{#NAME}"]'
                - sortorder: '4'
                  color: FC6EA3
                  item:
                    host: 'Kubernetes Controller manager by HTTP'
                    key: 'kubernetes.controller.workqueue_work_duration_seconds_p95["{#NAME}"]'
                - sortorder: '5'
                  color: 6C59DC
                  item:
                    host: 'Kubernetes Controller manager by HTTP'
                    key: 'kubernetes.controller.workqueue_work_duration_seconds_p99["{#NAME}"]'
                - sortorder: '6'
                  color: C7A72D
                  item:
                    host: 'Kubernetes Controller manager by HTTP'
                    key: 'kubernetes.controller.workqueue_work_duration_seconds_p90["{#NAME}"]'
                - sortorder: '7'
                  color: BA2A5D
                  item:
                    host: 'Kubernetes Controller manager by HTTP'
                    key: 'kubernetes.controller.workqueue_work_duration_seconds_p50["{#NAME}"]'
          master_item:
            key: kubernetes.controller.get_metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - '{__name__=~ "workqueue_*", name =~ ".*"}'
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                  	if (item.name === 'workqueue_adds_total') {
                  		var label_name = item.labels.name;
                  
                  		if (lookup[label_name]) {
                  			return;
                  		}
                  		lookup[label_name] = 1;
                  		result.push({
                  			'{#TYPE}': 'totals',
                  			'{#NAME}': label_name
                  		});
                  	}
                  	else if  (item.name === 'workqueue_work_duration_seconds_bucket') {
                  		result.push({
                  			'{#TYPE}': 'buckets',
                  			'{#NAME}': item.labels.name,
                  			'{#LE}': item.labels.le
                  		});
                  	}
                  });
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          overrides:
            - name: 'bucket item'
              step: '1'
              filter:
                conditions:
                  - macro: '{#TYPE}'
                    value: buckets
              operations:
                - operator: LIKE
                  value: bucket
                  discover: DISCOVER
            - name: 'total item'
              step: '2'
              filter:
                conditions:
                  - macro: '{#TYPE}'
                    value: totals
              operations:
                - operator: NOT_LIKE
                  value: bucket
                  discover: DISCOVER
      tags:
        - tag: class
          value: software
        - tag: subclass
          value: automation
        - tag: subclass
          value: containers
        - tag: subclass
          value: deploy
        - tag: subclass
          value: development
        - tag: subclass
          value: virtualization
        - tag: target
          value: controller-manager
        - tag: target
          value: kubernetes
      macros:
        - macro: '{$KUBE.API.TOKEN}'
          type: SECRET_TEXT
          description: 'API Authorization Token'
          config:
            type: TEXT
            priority: '1'
            label: 'API Token'
            description: 'Token used for API authorization.'
            required: 'YES'
        - macro: '{$KUBE.CONTROLLER.HTTP.CLIENT.ERROR}'
          value: '2'
          description: 'Maximum number of HTTP client requests failures used for trigger.'
          config:
            type: TEXT
            priority: '3'
            section_name: Thresholds
            label: 'HTTP Client Error Threshold'
            description: 'Maximum number of HTTP client errors allowed before triggering an alert. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$KUBE.CONTROLLER.SERVER.URL}'
          value: 'https://localhost:10257/metrics'
          description: 'Kubernetes Controller manager metrics endpoint URL.'
          config:
            type: TEXT
            priority: '2'
            label: 'Metrics endpoint URL'
            description: 'URL to access Kubernetes Controller manager metrics.'
      dashboards:
        - uuid: 9e088e468b7048698e737f5b4719ce33
          name: 'Controller Manager overview'
          pages:
            - name: General
              widgets:
                - type: graph
                  width: '72'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Kubernetes Controller manager by HTTP'
                        name: 'Kubernetes Controller Manager: Memory usage'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: graph
                  'y': '5'
                  width: '72'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Kubernetes Controller manager by HTTP'
                        name: 'Kubernetes Controller Manager: REST Client query rate'
                    - type: STRING
                      name: reference
                      value: AAAAB
            - name: 'Workqueue metrics'
              widgets:
                - type: graphprototype
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Kubernetes Controller manager by HTTP'
                        name: 'Kubernetes Controller Manager: ["{#NAME}"] Workqueue add rate'
                    - type: STRING
                      name: reference
                      value: AAAAC
                - type: graphprototype
                  'y': '5'
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Kubernetes Controller manager by HTTP'
                        name: 'Kubernetes Controller Manager: ["{#NAME}"] Workqueue depth'
                    - type: STRING
                      name: reference
                      value: AAAAD
                - type: graphprototype
                  'y': '10'
                  width: '72'
                  height: '10'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Kubernetes Controller manager by HTTP'
                        name: 'Kubernetes Controller Manager: ["{#NAME}"] Workqueue latency'
                    - type: STRING
                      name: reference
                      value: AAAAE
      valuemaps:
        - uuid: fa1732213d27418a88a61c964d93e9d7
          name: 'Leader status'
          mappings:
            - value: '0'
              newvalue: backup
            - value: '1'
              newvalue: master
    - uuid: e785916967c14544b59c3644c3edda3a
      template: 'Kubernetes Kubelet by HTTP'
      name: 'Kubernetes Kubelet by HTTP'
      description: |
        Get Kubernetes kubelet metrics by HTTP agent from Prometheus metrics endpoint.
        
        Don't forget change macros {$KUBE.KUBELET.URL}, {$KUBE.API.TOKEN}.
        Some metrics may not be collected depending on your Kubernetes API server instance version and configuration.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        The template to monitor Kubernetes Kubelet by Zabbix that works without any external scripts.
        Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.
        
        Template `Kubernetes Kubelet by HTTP` - collects metrics by HTTP agent from Kubelet /metrics endpoint.
        
        ## Setup
        
        Internal service metrics are collected from /metrics endpoint.
        Template needs to use Authorization via API token.
        
        Set the following fields: `Kubelet URL`, `API Authorization Token`.
        
        **Note:** Some metrics may not be collected depending on your Kubernetes instance version and configuration.
      vendor:
        name: Zabbix
        version: 8.0-1
      groups:
        - name: Templates/Applications
      items:
        - uuid: 1f94bbb521cb41dfa093e1408efbb15a
          name: 'Get cadvisor metrics'
          type: HTTP_AGENT
          key: kube.cadvisor.metrics
          history: '0'
          value_type: TEXT
          description: 'Collecting raw Kubelet metrics from /metrics/cadvisor endpoint.'
          timeout: 10s
          url: '{$KUBE.KUBELET.URL}{$KUBE.KUBELET.CADVISOR.ENDPOINT}'
          status_codes: '200, 403'
          headers:
            - name: Authorization
              value: 'Bearer {$KUBE.API.TOKEN}'
          tags:
            - tag: component
              value: raw
        - uuid: 35783053a41646ffb6420f8d41880b39
          name: 'Containers ready'
          type: DEPENDENT
          key: kube.kubelet.containers.ready
          value_type: FLOAT
          description: 'The number of ready containers.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.items[*].status.containerStatuses[?(@.ready == ''true'')].length()'
          master_item:
            key: kube.pods
          tags:
            - tag: component
              value: containers
        - uuid: bc395860d45b45cb89401fc7e50bc015
          name: 'Containers restarts'
          type: DEPENDENT
          key: kube.kubelet.containers.restarts
          value_type: FLOAT
          description: 'The number of times the container has been restarted.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.items[*].status.containerStatuses[*].restartCount.sum()'
          master_item:
            key: kube.pods
          tags:
            - tag: component
              value: containers
        - uuid: e524234eea87438d9ee2a1db9f24cfbb
          name: 'Containers started'
          type: DEPENDENT
          key: kube.kubelet.containers.started
          value_type: FLOAT
          description: 'The number of started containers.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.items[*].status.containerStatuses[?(@.started == ''true'')].length()'
          master_item:
            key: kube.pods
          tags:
            - tag: component
              value: containers
        - uuid: cff44957e9a54d5d887d4f92b3e4da72
          name: 'CPU cores, total'
          type: DEPENDENT
          key: kube.kubelet.cpu.cores
          value_type: FLOAT
          description: 'The number of cores in this machine (available until kubernetes v1.18).'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - machine_cpu_cores
                - value
                - ''
          master_item:
            key: kube.cadvisor.metrics
          tags:
            - tag: component
              value: containers
        - uuid: 6735723da30d41dcb7bd46c954b2998f
          name: 'Machine memory, bytes'
          type: DEPENDENT
          key: kube.kubelet.machine.memory
          value_type: FLOAT
          units: B
          description: 'Resident memory size in bytes.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_resident_memory_bytes
                - value
                - ''
          master_item:
            key: kube.kubelet.metrics
          tags:
            - tag: component
              value: memory
        - uuid: c71fc79a77104ef4a0d6b89d5f7b7bad
          name: 'Get kubelet metrics'
          type: HTTP_AGENT
          key: kube.kubelet.metrics
          history: '0'
          value_type: TEXT
          description: 'Collecting raw Kubelet metrics from /metrics endpoint.'
          timeout: 10s
          url: '{$KUBE.KUBELET.URL}{$KUBE.KUBELET.METRIC.ENDPOINT}'
          status_codes: '200, 403'
          headers:
            - name: Authorization
              value: 'Bearer {$KUBE.API.TOKEN}'
          tags:
            - tag: component
              value: raw
        - uuid: 46635d3fee04488caa4b07de7709f71e
          name: 'Pods running'
          type: DEPENDENT
          key: kube.kubelet.pods.running
          value_type: FLOAT
          description: 'The number of running pods.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.items[?(@.status.phase == "Running")].length()'
          master_item:
            key: kube.pods
          tags:
            - tag: component
              value: pods
        - uuid: d1388216cb384ff08c984919572b0ffb
          name: 'File descriptors, max'
          type: DEPENDENT
          key: kube.kubelet.process_max_fds
          value_type: FLOAT
          description: 'Maximum number of open file descriptors.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_max_fds
                - value
                - ''
          master_item:
            key: kube.kubelet.metrics
          tags:
            - tag: component
              value: descriptors
        - uuid: dc3a6371dcb34ae5b65cbf5224d4712c
          name: 'File descriptors, open'
          type: DEPENDENT
          key: kube.kubelet.process_open_fds
          value_type: FLOAT
          description: 'Number of open file descriptors.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_open_fds
                - value
                - ''
          master_item:
            key: kube.kubelet.metrics
          tags:
            - tag: component
              value: descriptors
        - uuid: c382b67cf7e947fbb9c29e86446ffac5
          name: 'Virtual memory, bytes'
          type: DEPENDENT
          key: kube.kubelet.virtual.memory
          value_type: FLOAT
          units: B
          description: 'Virtual memory size in bytes.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_virtual_memory_bytes
                - value
                - ''
          master_item:
            key: kube.kubelet.metrics
          tags:
            - tag: component
              value: memory
        - uuid: 11da04549bd840b0a8d5c70ff0d2b46f
          name: 'Containers last state terminated'
          type: DEPENDENT
          key: kube.kublet.containers.terminated
          value_type: FLOAT
          description: 'The number of containers that were previously terminated.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - '$.items[*].status.containerStatuses[?(@.lastState.terminated.exitCode > 0)].length()'
          master_item:
            key: kube.pods
          tags:
            - tag: component
              value: containers
        - uuid: 7c8cc6c3ed8e412eb69e7ab8e2fe7e12
          name: 'Get pods'
          type: HTTP_AGENT
          key: kube.pods
          history: '0'
          value_type: TEXT
          description: 'Collecting raw Kubelet metrics from /pods endpoint.'
          timeout: 10s
          url: '{$KUBE.KUBELET.URL}{$KUBE.KUBELET.PODS.ENDPOINT}'
          status_codes: '200, 403'
          headers:
            - name: Authorization
              value: 'Bearer {$KUBE.API.TOKEN}'
          tags:
            - tag: component
              value: raw
      discovery_rules:
        - uuid: 5f70768ebe62429a96e17576dd767382
          name: 'Container memory discovery'
          type: DEPENDENT
          key: kube.kubelet.container.memory.cache.discovery
          lifetime: '0'
          item_prototypes:
            - uuid: 8f8b1df2a801475a92604544b2019b2e
              name: 'Namespace [{#NAMESPACE}] Pod [{#POD}] Container [{#CONTAINER}]: Memory page cache'
              type: DEPENDENT
              key: 'kube.kubelet.container.memory.cache["{#CONTAINER}", "{#NAMESPACE}", "{#POD}"]'
              value_type: FLOAT
              units: B
              description: 'Number of bytes of page cache memory.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'container_memory_cache{container="{#CONTAINER}", namespace="{#NAMESPACE}", pod="{#POD}"}'
                    - value
                    - ''
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: kube.cadvisor.metrics
              tags:
                - tag: component
                  value: memory
                - tag: container
                  value: '{#CONTAINER}'
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#POD}'
            - uuid: 6dcf948e79b94f3f96677a7948d2dfd4
              name: 'Namespace [{#NAMESPACE}] Pod [{#POD}] Container [{#CONTAINER}]: Memory max usage'
              type: DEPENDENT
              key: 'kube.kubelet.container.memory.max_usage["{#CONTAINER}", "{#NAMESPACE}", "{#POD}"]'
              value_type: FLOAT
              units: B
              description: 'Maximum memory usage recorded in bytes.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'container_memory_max_usage_bytes{container="{#CONTAINER}", namespace="{#NAMESPACE}", pod="{#POD}"}'
                    - value
                    - ''
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: kube.cadvisor.metrics
              tags:
                - tag: component
                  value: memory
                - tag: container
                  value: '{#CONTAINER}'
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#POD}'
            - uuid: 47d35c31a52643c1b587efcec57f9dff
              name: 'Namespace [{#NAMESPACE}] Pod [{#POD}] Container [{#CONTAINER}]: RSS'
              type: DEPENDENT
              key: 'kube.kubelet.container.memory.rss["{#CONTAINER}", "{#NAMESPACE}", "{#POD}"]'
              value_type: FLOAT
              units: B
              description: 'Size of RSS in bytes.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'container_memory_rss{container="{#CONTAINER}", namespace="{#NAMESPACE}", pod="{#POD}"}'
                    - value
                    - ''
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: kube.cadvisor.metrics
              tags:
                - tag: component
                  value: memory
                - tag: container
                  value: '{#CONTAINER}'
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#POD}'
            - uuid: 2cf31296f67947ec85f576773352a25b
              name: 'Namespace [{#NAMESPACE}] Pod [{#POD}] Container [{#CONTAINER}]: Swap'
              type: DEPENDENT
              key: 'kube.kubelet.container.memory.swap["{#CONTAINER}", "{#NAMESPACE}", "{#POD}"]'
              value_type: FLOAT
              units: B
              description: 'Container swap usage in bytes.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'container_memory_swap{container="{#CONTAINER}", namespace="{#NAMESPACE}", pod="{#POD}"}'
                    - value
                    - ''
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: kube.cadvisor.metrics
              tags:
                - tag: component
                  value: memory
                - tag: container
                  value: '{#CONTAINER}'
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#POD}'
            - uuid: 146d17ecec7149efb20878d7e0466eeb
              name: 'Namespace [{#NAMESPACE}] Pod [{#POD}] Container [{#CONTAINER}]: Usage'
              type: DEPENDENT
              key: 'kube.kubelet.container.memory.usage["{#CONTAINER}", "{#NAMESPACE}", "{#POD}"]'
              value_type: FLOAT
              units: B
              description: 'Current memory usage in bytes, including all memory regardless of when it was accessed.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'container_memory_usage_bytes{container="{#CONTAINER}", namespace="{#NAMESPACE}", pod="{#POD}"}'
                    - value
                    - ''
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: kube.cadvisor.metrics
              tags:
                - tag: component
                  value: memory
                - tag: container
                  value: '{#CONTAINER}'
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#POD}'
            - uuid: d3a24d207c6d4201a5e7235f246e0c59
              name: 'Namespace [{#NAMESPACE}] Pod [{#POD}] Container [{#CONTAINER}]: Working set'
              type: DEPENDENT
              key: 'kube.kubelet.container.memory.working_set["{#CONTAINER}", "{#NAMESPACE}", "{#POD}"]'
              value_type: FLOAT
              units: B
              description: 'Current working set in bytes.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'container_memory_working_set_bytes{container="{#CONTAINER}", namespace="{#NAMESPACE}", pod="{#POD}"}'
                    - value
                    - ''
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: kube.cadvisor.metrics
              tags:
                - tag: component
                  value: memory
                - tag: container
                  value: '{#CONTAINER}'
                - tag: namespace
                  value: '{#NAMESPACE}'
                - tag: pod
                  value: '{#POD}'
          master_item:
            key: kube.cadvisor.metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - 'container_memory_cache{container !~ "POD", namespace =~ ".*", pod =~ ".*"}'
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                  	var container_labels = item.labels.container + item.labels.namespace + item.labels.pod;
                  	if (item.labels.container !== '' && !lookup[container_labels]) {
                  		lookup[container_labels] = 1;
                  		result.push({
                  			'{#CONTAINER}': item.labels.container,
                  			'{#NAMESPACE}': item.labels.namespace,
                  			'{#POD}': item.labels.pod
                  		});
                  	}
                  })
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: b98223fcf0ee4a558035ed23de0d2616
          name: 'Pods discovery'
          type: DEPENDENT
          key: kube.kubelet.pods.discovery
          lifetime: '0'
          item_prototypes:
            - uuid: 41e8f027979a462983789f1f45a9e332
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}] CPU: Load average, 10s'
              type: DEPENDENT
              key: 'kube.pod.container_cpu_load_average_10s[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              description: 'Pods cpu load average over the last 10 seconds.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'container_cpu_load_average_10s{container!="", container!="POD", pod="{#NAME}", namespace="{#NAMESPACE}"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
              master_item:
                key: kube.cadvisor.metrics
              tags:
                - tag: component
                  value: pod
                - tag: pod
                  value: '{#NAME}'
            - uuid: 434c913e7547435bb74c922f81f3ff7a
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}] CPU: System seconds, total'
              type: DEPENDENT
              key: 'kube.pod.container_cpu_system_seconds_total[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              units: s
              description: 'System cpu time consumed. It is calculated from the cumulative value using the `Change per second` preprocessing step.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'container_cpu_system_seconds_total{container!="", container!="POD", pod="{#NAME}", namespace="{#NAMESPACE}"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
                - type: CHANGE_PER_SECOND
              master_item:
                key: kube.cadvisor.metrics
              tags:
                - tag: component
                  value: pod
                - tag: pod
                  value: '{#NAME}'
            - uuid: 08ae25c1a6a34fae9f3131b14c061e4d
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}] CPU: Usage seconds, total'
              type: DEPENDENT
              key: 'kube.pod.container_cpu_usage_seconds_total[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              units: s
              description: 'Consumed cpu time. It is calculated from the cumulative value using the `Change per second` preprocessing step.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'container_cpu_usage_seconds_total{container!="", container!="POD", pod="{#NAME}", namespace="{#NAMESPACE}"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
                - type: CHANGE_PER_SECOND
              master_item:
                key: kube.cadvisor.metrics
              tags:
                - tag: component
                  value: pod
                - tag: pod
                  value: '{#NAME}'
            - uuid: e0b1c1edcc3c4738a71b46712a085ed0
              name: 'Namespace [{#NAMESPACE}] Pod [{#NAME}] CPU: User seconds, total'
              type: DEPENDENT
              key: 'kube.pod.container_cpu_user_seconds_total[{#NAMESPACE}/{#NAME}]'
              value_type: FLOAT
              units: s
              description: 'User cpu time consumed. It is calculated from the cumulative value using the `Change per second` preprocessing step.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'container_cpu_user_seconds_total{container!="", container!="POD", pod="{#NAME}", namespace="{#NAMESPACE}"}'
                    - function
                    - sum
                  error_handler: DISCARD_VALUE
                - type: CHANGE_PER_SECOND
              master_item:
                key: kube.cadvisor.metrics
              tags:
                - tag: component
                  value: pod
                - tag: pod
                  value: '{#NAME}'
          master_item:
            key: kube.pods
          lld_macro_paths:
            - lld_macro: '{#NAMESPACE}'
              path: $.metadata.namespace
            - lld_macro: '{#NAME}'
              path: $.metadata.name
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.items
              error_handler: DISCARD_VALUE
        - uuid: cb42f71e6bfb4661861e3601e31eeaa6
          name: 'REST client requests discovery'
          type: DEPENDENT
          key: kube.kubelet.rest.requests.discovery
          item_prototypes:
            - uuid: c569ce73bfb44098be3ceb8d016e3d24
              name: 'Host [{#HOST}] Request method [{#METHOD}] Code:[{#CODE}]'
              type: DEPENDENT
              key: 'kube.kubelet.rest.requests["{#CODE}", "{#HOST}", "{#METHOD}"]'
              value_type: FLOAT
              description: 'Number of HTTP requests, partitioned by status code, method, and host.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'rest_client_requests_total{code="{#CODE}", host="{#HOST}", method="{#METHOD}"}'
                    - value
                    - ''
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 3h
              master_item:
                key: kube.kubelet.metrics
              tags:
                - tag: code
                  value: '{#CODE}'
                - tag: component
                  value: requests
                - tag: host
                  value: '{#HOST}'
                - tag: method
                  value: '{#METHOD}'
          master_item:
            key: kube.kubelet.metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - 'rest_client_requests_total{code =~ ".*", host =~ ".*", method =~ ".*"}'
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                  	var request_labels = item.labels.code + item.labels.host + item.labels.method;
                  	if (!(lookup[request_labels])) {
                  		lookup[request_labels] = 1;
                  		result.push({
                  			'{#CODE}': item.labels.code,
                  			'{#HOST}': item.labels.host,
                  			'{#METHOD}': item.labels.method
                  		});
                  	}
                  })
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: 6feb0006bb364a8f9295495c92741c16
          name: 'Runtime operations discovery'
          type: DEPENDENT
          key: kube.kubelet.runtime_operations_bucket.discovery
          item_prototypes:
            - uuid: 13de106611a347e0907dda9ff52f3a20
              name: '[{#OP_TYPE}] Runtime operations bucket: {#LE}'
              type: DEPENDENT
              key: 'kube.kublet.runtime_ops_duration_seconds_bucket[{#LE},"{#OP_TYPE}"]'
              history: 1h
              value_type: FLOAT
              trends: '0'
              discover: NO_DISCOVER
              description: 'Duration in seconds of runtime operations. Broken down by operation type.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kubelet_runtime_operations_duration_seconds_bucket{le="{#LE}",operation_type="{#OP_TYPE}"}'
                    - function
                    - sum
              master_item:
                key: kube.kubelet.metrics
              tags:
                - tag: component
                  value: operations
            - uuid: 3d9545d396b24ef6b87eb730ad93cda7
              name: '[{#OP_TYPE}] Operations, p50'
              type: CALCULATED
              key: 'kube.kublet.runtime_ops_duration_seconds_p50["{#OP_TYPE}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kube.kublet.runtime_ops_duration_seconds_bucket[*,"{#OP_TYPE}"],5m,50)'
              description: '50 percentile of operation latency distribution in seconds for each verb.'
              tags:
                - tag: component
                  value: operations
            - uuid: 039a47a0b20741e79701fecb924e6a08
              name: '[{#OP_TYPE}] Operations, p90'
              type: CALCULATED
              key: 'kube.kublet.runtime_ops_duration_seconds_p90["{#OP_TYPE}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kube.kublet.runtime_ops_duration_seconds_bucket[*,"{#OP_TYPE}"],5m,90)'
              description: '90 percentile of operation latency distribution in seconds for each verb.'
              tags:
                - tag: component
                  value: operations
            - uuid: e846265636ac433ba2bce034aca1e394
              name: '[{#OP_TYPE}] Operations, p95'
              type: CALCULATED
              key: 'kube.kublet.runtime_ops_duration_seconds_p95["{#OP_TYPE}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kube.kublet.runtime_ops_duration_seconds_bucket[*,"{#OP_TYPE}"],5m,95)'
              description: '95 percentile of operation latency distribution in seconds for each verb.'
              tags:
                - tag: component
                  value: operations
            - uuid: 68f17a6132dd48deb3825efd2b83b6ce
              name: '[{#OP_TYPE}] Operations, p99'
              type: CALCULATED
              key: 'kube.kublet.runtime_ops_duration_seconds_p99["{#OP_TYPE}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kube.kublet.runtime_ops_duration_seconds_bucket[*,"{#OP_TYPE}"],5m,99)'
              description: '99 percentile of operation latency distribution in seconds for each verb.'
              tags:
                - tag: component
                  value: operations
            - uuid: 736abc78366e44b69234caf56abe8a4a
              name: '[{#OP_TYPE}] Runtime operations total, rate'
              type: DEPENDENT
              key: 'kube.kublet.runtime_ops_total.rate["{#OP_TYPE}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              description: 'Cumulative number of runtime operations by operation type.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'kubelet_runtime_operations_total{operation_type="{#OP_TYPE}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
                - type: CHANGE_PER_SECOND
              master_item:
                key: kube.kubelet.metrics
              tags:
                - tag: component
                  value: operations
          graph_prototypes:
            - uuid: 3a32d1b4253b48078279b24fdf8f3476
              name: 'Kubernetes: [{#OP_TYPE}] Operations latency'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'Kubernetes Kubelet by HTTP'
                    key: 'kube.kublet.runtime_ops_duration_seconds_p90["{#OP_TYPE}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'Kubernetes Kubelet by HTTP'
                    key: 'kube.kublet.runtime_ops_duration_seconds_p95["{#OP_TYPE}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'Kubernetes Kubelet by HTTP'
                    key: 'kube.kublet.runtime_ops_duration_seconds_p99["{#OP_TYPE}"]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'Kubernetes Kubelet by HTTP'
                    key: 'kube.kublet.runtime_ops_duration_seconds_p50["{#OP_TYPE}"]'
          master_item:
            key: kube.kubelet.metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - '{__name__=~ "kubelet_runtime_operations_*", operation_type =~ ".*"}'
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	lookup_histogram = {},
                  	result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                  	if (item.name === 'kubelet_runtime_operations_total'){
                  		var op_type = item.labels.operation_type;
                  
                  		if (lookup[op_type]) {
                  			return;
                  		}
                  		lookup[op_type] = 1;
                  		result.push({
                  			'{#TYPE}': 'totals',
                  			'{#OP_TYPE}': op_type
                  		});
                  	}
                  
                  	else if (item.name === 'kubelet_runtime_operations_duration_seconds_bucket'){
                  		var labels = item.labels.operation_type + item.labels.le;
                  
                  		if (lookup_histogram[labels]) {
                  			return;
                  		}
                  		lookup_histogram[labels] = 1;
                  		result.push({
                  			'{#TYPE}': 'buckets',
                  			'{#OP_TYPE}': item.labels.operation_type,
                  			'{#LE}': item.labels.le
                  		});
                  	}
                  });
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          overrides:
            - name: 'bucket item'
              step: '1'
              filter:
                conditions:
                  - macro: '{#TYPE}'
                    value: buckets
              operations:
                - operator: LIKE
                  value: bucket
                  discover: DISCOVER
            - name: 'total item'
              step: '2'
              filter:
                conditions:
                  - macro: '{#TYPE}'
                    value: totals
              operations:
                - operator: NOT_LIKE
                  value: bucket
                  discover: DISCOVER
      tags:
        - tag: class
          value: software
        - tag: subclass
          value: automation
        - tag: subclass
          value: containers
        - tag: subclass
          value: deploy
        - tag: subclass
          value: development
        - tag: subclass
          value: virtualization
        - tag: target
          value: kubelet
        - tag: target
          value: kubernetes
      macros:
        - macro: '{$KUBE.API.TOKEN}'
          type: SECRET_TEXT
          description: 'Service account bearer token.'
          config:
            type: TEXT
            priority: '1'
            label: 'API Token'
            description: 'Service account bearer Token used for authentication.'
            required: 'YES'
        - macro: '{$KUBE.KUBELET.CADVISOR.ENDPOINT}'
          value: /metrics/cadvisor
          description: 'cAdvisor metrics from Kubelet /metrics/cadvisor endpoint.'
          config:
            type: TEXT
            priority: '4'
            label: 'cAdvisor Endpoint'
            description: 'Endpoint for retrieving cAdvisor metrics from Kubelet.'
        - macro: '{$KUBE.KUBELET.METRIC.ENDPOINT}'
          value: /metrics
          description: 'Kubelet /metrics endpoint.'
          config:
            type: TEXT
            priority: '3'
            label: 'Metrics Endpoint'
            description: 'Endpoint for retrieving Kubelet metrics.'
        - macro: '{$KUBE.KUBELET.PODS.ENDPOINT}'
          value: /pods
          description: 'Kubelet /pods endpoint.'
          config:
            type: TEXT
            priority: '5'
            label: 'Pods Endpoint'
            description: 'Endpoint for retrieving pod information from Kubelet.'
        - macro: '{$KUBE.KUBELET.URL}'
          value: 'https://localhost:10250'
          description: 'Kubernetes Kubelet instance URL.'
          config:
            type: TEXT
            priority: '2'
            label: 'Kubelet URL'
            description: 'URL for the Kubernetes Kubelet instance.'
      dashboards:
        - uuid: ecaddf40146948668ec7c75505fd8af8
          name: 'Kubelet overview'
          pages:
            - name: Operations
              widgets:
                - type: graphprototype
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Kubernetes Kubelet by HTTP'
                        name: 'Kubernetes: [{#OP_TYPE}] Operations latency'
                    - type: STRING
                      name: reference
                      value: AAAAA
    - uuid: ece96efdf0a045b99ede7978fa9366d6
      template: 'Kubernetes Scheduler by HTTP'
      name: 'Kubernetes Scheduler by HTTP'
      description: |
        Get Kubernetes Scheduler metrics by HTTP agent from Prometheus metrics endpoint.
        
        Don't forget change macros {$KUBE.API.SERVER.URL}.
        Some metrics may not be collected depending on your Kubernetes Scheduler instance version and configuration.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        The template to monitor Kubernetes Scheduler by Zabbix that works without any external scripts.
        Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.
        
        Template `Kubernetes Scheduler by HTTP` - collects metrics by HTTP agent from Scheduler /metrics endpoint.
        
        ## Setup
        
        Internal service metrics are collected from /metrics endpoint.
        Template needs to use Authorization via API token.
        
        Set the following fields: `Scheduler metrics endpoint URL`, `API Authorization Token`.
        
        **Note:** You might need to set the `--binding-address` option for Scheduler to the address where Zabbix proxy can reach it.
        For example, for clusters created with `kubeadm` it can be set in the following manifest file (changes will be applied immediately):
        
        - /etc/kubernetes/manifests/kube-scheduler.yaml
        
        **Note:** Some metrics may not be collected depending on your Kubernetes Scheduler instance version and configuration.
      vendor:
        name: Zabbix
        version: 8.0-1
      groups:
        - name: Templates/Applications
      items:
        - uuid: 87e91f23320043549457a5b2ab8ddf74
          name: 'REST Client requests: 2xx, rate'
          type: DEPENDENT
          key: kubernetes.scheduler.client_http_requests_200.rate
          value_type: FLOAT
          description: 'Number of HTTP requests with 2xx status code per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'rest_client_requests_total{code =~ "2.."}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.scheduler.get_metrics
          tags:
            - tag: component
              value: rest
            - tag: http-code
              value: 2xx
        - uuid: b790f8c9a6b44f54837a6b3cb1dcec41
          name: 'REST Client requests: 3xx, rate'
          type: DEPENDENT
          key: kubernetes.scheduler.client_http_requests_300.rate
          value_type: FLOAT
          description: 'Number of HTTP requests with 3xx status code per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'rest_client_requests_total{code =~ "3.."}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.scheduler.get_metrics
          tags:
            - tag: component
              value: rest
            - tag: http-code
              value: 3xx
        - uuid: 84e09cb3134b492b983649bc29da11ee
          name: 'REST Client requests: 4xx, rate'
          type: DEPENDENT
          key: kubernetes.scheduler.client_http_requests_400.rate
          value_type: FLOAT
          description: 'Number of HTTP requests with 4xx status code per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'rest_client_requests_total{code =~ "4.."}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.scheduler.get_metrics
          tags:
            - tag: component
              value: rest
            - tag: http-code
              value: 4xx
        - uuid: d94fce6ae59b4735b93e1ccfb9084dc2
          name: 'REST Client requests: 5xx, rate'
          type: DEPENDENT
          key: kubernetes.scheduler.client_http_requests_500.rate
          value_type: FLOAT
          description: 'Number of HTTP requests with 5xx status code per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'rest_client_requests_total{code =~ "5.."}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.scheduler.get_metrics
          tags:
            - tag: component
              value: rest
            - tag: http-code
              value: 5xx
          triggers:
            - uuid: ea92474a61214053b2cd20775817010e
              expression: 'min(/Kubernetes Scheduler by HTTP/kubernetes.scheduler.client_http_requests_500.rate,5m)>{$KUBE.SCHEDULER.HTTP.CLIENT.ERROR}'
              name: 'Kubernetes Scheduler: Too many REST Client errors'
              event_name: 'Kubernetes Scheduler: Too many REST Client errors (over {$KUBE.SCHEDULER.HTTP.CLIENT.ERROR} for 5m)'
              priority: WARNING
              description: '"Kubernetes Scheduler REST Client requests is experiencing high error rate (with 5xx HTTP code).'
              tags:
                - tag: scope
                  value: availability
        - uuid: b1d79dbb773d47668476a12ca8ee3d08
          name: CPU
          type: DEPENDENT
          key: kubernetes.scheduler.cpu.util
          value_type: FLOAT
          units: '%'
          description: 'Total user and system CPU usage ratio.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_cpu_seconds_total
                - value
                - ''
            - type: CHANGE_PER_SECOND
            - type: MULTIPLIER
              parameters:
                - '100'
          master_item:
            key: kubernetes.scheduler.get_metrics
          tags:
            - tag: component
              value: cpu
        - uuid: 2534eacdaf9b44d68388b366da40af59
          name: 'Get Scheduler metrics'
          type: HTTP_AGENT
          key: kubernetes.scheduler.get_metrics
          history: '0'
          value_type: TEXT
          description: 'Get raw metrics from Scheduler instance /metrics endpoint.'
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
          timeout: 15s
          url: '{$KUBE.SCHEDULER.SERVER.URL}'
          headers:
            - name: Authorization
              value: 'Bearer {$KUBE.API.TOKEN}'
          tags:
            - tag: component
              value: raw
        - uuid: a21ec7ee8a76449f99199777d35cdd03
          name: Goroutines
          type: DEPENDENT
          key: kubernetes.scheduler.go_goroutines
          value_type: FLOAT
          description: 'Number of goroutines that currently exist.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - go_goroutines
                - function
                - sum
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.scheduler.get_metrics
          tags:
            - tag: component
              value: goroutines
        - uuid: d7493f23748f440b8cae127e6ff70bb7
          name: 'Go threads'
          type: DEPENDENT
          key: kubernetes.scheduler.go_threads
          value_type: FLOAT
          description: 'Number of OS threads created.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - go_threads
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.scheduler.get_metrics
          tags:
            - tag: component
              value: go-threads
        - uuid: 11471cff0d664bdb906cf54821af9710
          name: 'Fds max'
          type: DEPENDENT
          key: kubernetes.scheduler.max_fds
          value_type: FLOAT
          description: 'Maximum allowed open file descriptors.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_max_fds
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.scheduler.get_metrics
          tags:
            - tag: component
              value: fds
        - uuid: 2aa6fb05cb3e4f33a05ebf331be1ed54
          name: 'Fds open'
          type: DEPENDENT
          key: kubernetes.scheduler.open_fds
          value_type: FLOAT
          description: 'Number of open file descriptors.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_open_fds
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.scheduler.get_metrics
          tags:
            - tag: component
              value: fds
        - uuid: f8272f957dc447f19876395994050edd
          name: 'Resident memory, bytes'
          type: DEPENDENT
          key: kubernetes.scheduler.process_resident_memory_bytes
          value_type: FLOAT
          units: B
          description: 'Resident memory size in bytes.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_resident_memory_bytes
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.scheduler.get_metrics
          tags:
            - tag: component
              value: memory
        - uuid: 0319ccb3efb94aeba6181c1f34cc999a
          name: 'Virtual memory, bytes'
          type: DEPENDENT
          key: kubernetes.scheduler.process_virtual_memory_bytes
          value_type: FLOAT
          units: B
          description: 'Virtual memory size in bytes.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - process_virtual_memory_bytes
                - value
                - ''
              error_handler: DISCARD_VALUE
          master_item:
            key: kubernetes.scheduler.get_metrics
          tags:
            - tag: component
              value: memory
        - uuid: f198d7705dd34d52b57a31aa8b5a423a
          name: 'Schedule attempts: error'
          type: DEPENDENT
          key: kubernetes.scheduler.scheduler_schedule_attempts.error.rate
          value_type: FLOAT
          description: 'Number of attempts to schedule pods with result "error" per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'scheduler_schedule_attempts_total{result = "error"}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.scheduler.get_metrics
          tags:
            - tag: component
              value: scheduler
          triggers:
            - uuid: 9116327bc14f4f189ca867b43187f6bd
              expression: 'min(/Kubernetes Scheduler by HTTP/kubernetes.scheduler.scheduler_schedule_attempts.error.rate,5m)>{$KUBE.SCHEDULER.ERROR}'
              name: 'Kubernetes Scheduler: Too many schedule attempts with errors'
              event_name: 'Kubernetes Scheduler: Too many schedule attempts with errors (over {$KUBE.SCHEDULER.ERROR} for 5m)'
              priority: WARNING
              description: 'Number of attempts to schedule pods with ''error'' result is too high. ''error'' means an internal scheduler problem.'
              tags:
                - tag: scope
                  value: performance
        - uuid: d5c901849f134b40b077c50e02415fff
          name: 'Schedule attempts: scheduled'
          type: DEPENDENT
          key: kubernetes.scheduler.scheduler_schedule_attempts.scheduled.rate
          value_type: FLOAT
          description: 'Number of attempts to schedule pods with result "scheduled" per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'scheduler_schedule_attempts_total{result = "scheduled"}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.scheduler.get_metrics
          tags:
            - tag: component
              value: scheduler
        - uuid: 5736a89200684c709c22f9fb3711bb83
          name: 'Schedule attempts: unschedulable'
          type: DEPENDENT
          key: kubernetes.scheduler.scheduler_schedule_attempts.unschedulable.rate
          value_type: FLOAT
          description: 'Number of attempts to schedule pods with result "unschedulable" per second.'
          preprocessing:
            - type: PROMETHEUS_PATTERN
              parameters:
                - 'scheduler_schedule_attempts_total{result = "unschedulable"}'
                - function
                - sum
              error_handler: DISCARD_VALUE
            - type: CHANGE_PER_SECOND
          master_item:
            key: kubernetes.scheduler.get_metrics
          tags:
            - tag: component
              value: scheduler
          triggers:
            - uuid: 16efba4ba322416fa2b8986273b83904
              expression: 'min(/Kubernetes Scheduler by HTTP/kubernetes.scheduler.scheduler_schedule_attempts.unschedulable.rate,5m)>{$KUBE.SCHEDULER.UNSCHEDULABLE}'
              name: 'Kubernetes Scheduler: Too many unschedulable pods'
              event_name: 'Kubernetes Scheduler: Too many unschedulable pods (over {$KUBE.SCHEDULER.UNSCHEDULABLE} for 5m)'
              priority: WARNING
              description: 'Number of attempts to schedule pods with ''unschedulable'' result is too high. ''unschedulable'' means a pod could not be scheduled.'
              tags:
                - tag: scope
                  value: performance
      discovery_rules:
        - uuid: 0dacff4b5ab841569642350388f4e534
          name: 'e2e scheduling histogram'
          type: DEPENDENT
          key: kubernetes.controller.e2e_scheduling.discovery
          description: 'Discovery raw data and percentile items of e2e scheduling latency.'
          item_prototypes:
            - uuid: eaeb8c321626466bbf7c08008a82b9c8
              name: '["{#RESULT}"]: e2e scheduling seconds bucket, {#LE}'
              type: DEPENDENT
              key: 'kubernetes.scheduler.e2e_scheduling_bucket[{#LE},"{#RESULT}"]'
              history: 1h
              value_type: FLOAT
              trends: '0'
              discover: NO_DISCOVER
              description: 'E2e scheduling latency in seconds (scheduling algorithm + binding)'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'scheduler_e2e_scheduling_duration_seconds_bucket{result = "{#RESULT}",le = "{#LE}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kubernetes.scheduler.get_metrics
              tags:
                - tag: component
                  value: e2e-scheduling
                - tag: result
                  value: '{#RESULT}'
            - uuid: b8fd5b4454484f4298e2c2b1e5c832c5
              name: '["{#RESULT}"]: e2e scheduling, p50'
              type: CALCULATED
              key: 'kubernetes.scheduler.e2e_scheduling_p50["{#RESULT}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.scheduler.e2e_scheduling_bucket[*,"{#RESULT}"],5m,50)'
              description: '50 percentile of e2e scheduling latency.'
              tags:
                - tag: component
                  value: e2e-scheduling
                - tag: result
                  value: '{#RESULT}'
            - uuid: 01edd56cd1c94d4b80589d91349e4be5
              name: '["{#RESULT}"]: e2e scheduling, p90'
              type: CALCULATED
              key: 'kubernetes.scheduler.e2e_scheduling_p90["{#RESULT}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.scheduler.e2e_scheduling_bucket[*,"{#RESULT}"],5m,90)'
              description: '90 percentile of e2e scheduling latency.'
              tags:
                - tag: component
                  value: e2e-scheduling
                - tag: result
                  value: '{#RESULT}'
            - uuid: 706fc27da4d34a4e9189c566c7aa96ff
              name: '["{#RESULT}"]: e2e scheduling, p95'
              type: CALCULATED
              key: 'kubernetes.scheduler.e2e_scheduling_p95["{#RESULT}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.scheduler.e2e_scheduling_bucket[*,"{#RESULT}"],5m,95)'
              description: '95 percentile of e2e scheduling latency.'
              tags:
                - tag: component
                  value: e2e-scheduling
                - tag: result
                  value: '{#RESULT}'
            - uuid: 829627aeab764590b3a17e6b10c56709
              name: '["{#RESULT}"]: e2e scheduling, p99'
              type: CALCULATED
              key: 'kubernetes.scheduler.e2e_scheduling_p99["{#RESULT}"]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.scheduler.e2e_scheduling_bucket[*,"{#RESULT}"],5m,99)'
              description: '95 percentile of e2e scheduling latency.'
              tags:
                - tag: component
                  value: e2e-scheduling
                - tag: result
                  value: '{#RESULT}'
          graph_prototypes:
            - uuid: be0cb738e2a346f8a24cabf0f76a6e6a
              name: 'Kubernetes Scheduler: ["{#RESULT}"] E2e latency'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'Kubernetes Scheduler by HTTP'
                    key: 'kubernetes.scheduler.e2e_scheduling_p50["{#RESULT}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'Kubernetes Scheduler by HTTP'
                    key: 'kubernetes.scheduler.e2e_scheduling_p90["{#RESULT}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'Kubernetes Scheduler by HTTP'
                    key: 'kubernetes.scheduler.e2e_scheduling_p95["{#RESULT}"]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'Kubernetes Scheduler by HTTP'
                    key: 'kubernetes.scheduler.e2e_scheduling_p99["{#RESULT}"]'
          master_item:
            key: kubernetes.scheduler.get_metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - '{__name__=~ "scheduler_e2e_scheduling_duration_*", result =~ ".*"}'
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                  	if (item.name === "scheduler_e2e_scheduling_duration_seconds_count"){
                  		var label_result = item.labels.result;
                  
                  		if (lookup[label_result]) {
                  			return;
                  		}
                  		lookup[label_result] = 1;
                  		result.push({
                  			'{#TYPE}': 'totals',
                  			'{#RESULT}': label_result
                  		});
                  
                  	  }
                  	else if  (item.name === "scheduler_e2e_scheduling_duration_seconds_bucket"){
                  		result.push({
                  			'{#TYPE}': 'buckets',
                  			'{#RESULT}': item.labels.result,
                  			'{#LE}': item.labels.le
                  		});
                  	}
                  });
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          overrides:
            - name: 'bucket item'
              step: '1'
              filter:
                conditions:
                  - macro: '{#TYPE}'
                    value: buckets
              operations:
                - operator: LIKE
                  value: bucket
                  discover: DISCOVER
            - name: 'total item'
              step: '2'
              filter:
                conditions:
                  - macro: '{#TYPE}'
                    value: totals
              operations:
                - operator: NOT_LIKE
                  value: bucket
                  discover: DISCOVER
        - uuid: 8cfc88eb0f6b4ae09d93bd9fc275659d
          name: 'Binding histogram'
          type: DEPENDENT
          key: kubernetes.scheduler.binding.discovery
          description: 'Discovery raw data of binding latency.'
          item_prototypes:
            - uuid: 17a3d7122cd844ea905059020532907b
              name: 'Binding duration bucket, {#LE}'
              type: DEPENDENT
              key: 'kubernetes.scheduler.binding_duration[{#LE}]'
              history: 1h
              value_type: FLOAT
              trends: '0'
              discover: NO_DISCOVER
              description: 'Binding latency in seconds.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'scheduler_binding_duration_seconds_bucket{le = "{#LE}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kubernetes.scheduler.get_metrics
              tags:
                - tag: component
                  value: binding
            - uuid: 5f40c030c1964ff7ab7786cee97bee81
              name: 'Binding duration, p50'
              type: CALCULATED
              key: 'kubernetes.scheduler.binding_duration_p50[{#SINGLETON}]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.scheduler.binding_duration[*],5m,50)'
              description: '50 percentile of binding latency in seconds.'
              tags:
                - tag: component
                  value: binding
            - uuid: 19ba0e215a9f4e13b3079fcdaf124cc5
              name: 'Binding duration, p90'
              type: CALCULATED
              key: 'kubernetes.scheduler.binding_duration_p90[{#SINGLETON}]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.scheduler.binding_duration[*],5m,90)'
              description: '90 percentile of binding latency in seconds.'
              tags:
                - tag: component
                  value: binding
            - uuid: b24d657a1568437fac77535a80d63bc3
              name: 'Binding duration, p95'
              type: CALCULATED
              key: 'kubernetes.scheduler.binding_duration_p95[{#SINGLETON}]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.scheduler.binding_duration[*],5m,95)'
              description: '99 percentile of binding latency in seconds.'
              tags:
                - tag: component
                  value: binding
            - uuid: 258d5d4b6534488a92ba29185e3ca56f
              name: 'Binding duration, p99'
              type: CALCULATED
              key: 'kubernetes.scheduler.binding_duration_p99[{#SINGLETON}]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.scheduler.binding_duration[*],5m,99)'
              description: '95 percentile of binding latency in seconds.'
              tags:
                - tag: component
                  value: binding
          graph_prototypes:
            - uuid: 1c8da2cb32ae4dfaa0d16cff0cecfc43
              name: 'Kubernetes Scheduler: [{#SINGLETON}]Binding latency'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'Kubernetes Scheduler by HTTP'
                    key: 'kubernetes.scheduler.binding_duration_p50[{#SINGLETON}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'Kubernetes Scheduler by HTTP'
                    key: 'kubernetes.scheduler.binding_duration_p90[{#SINGLETON}]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'Kubernetes Scheduler by HTTP'
                    key: 'kubernetes.scheduler.binding_duration_p95[{#SINGLETON}]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'Kubernetes Scheduler by HTTP'
                    key: 'kubernetes.scheduler.binding_duration_p99[{#SINGLETON}]'
          master_item:
            key: kubernetes.scheduler.get_metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - '{__name__=~ "scheduler_binding_duration_seconds_*"}'
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	result = [];
                  JSON.parse(value).forEach(function (item) {
                  	if (item.name === "scheduler_binding_duration_seconds_count"){
                  		result.push({
                  			'{#TYPE}': 'totals',
                  			'{#SINGLETON}': ''
                  		});
                  
                  	  }
                  	else if  (item.name === "scheduler_binding_duration_seconds_bucket"){
                  		result.push({
                  			'{#TYPE}': 'buckets',
                  			'{#LE}': item.labels.le
                  		});
                  	}
                  });
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          overrides:
            - name: 'bucket item'
              step: '1'
              filter:
                conditions:
                  - macro: '{#TYPE}'
                    value: buckets
              operations:
                - operator: LIKE
                  value: bucket
                  discover: DISCOVER
            - name: 'total item'
              step: '2'
              filter:
                conditions:
                  - macro: '{#TYPE}'
                    value: totals
              operations:
                - operator: NOT_LIKE
                  value: bucket
                  discover: DISCOVER
        - uuid: 5d4a17f09a7e4ad3b4ac72c30bac5e7d
          name: 'Scheduling algorithm histogram'
          type: DEPENDENT
          key: kubernetes.scheduler.scheduling_algorithm.discovery
          description: 'Discovery raw data of scheduling algorithm latency.'
          item_prototypes:
            - uuid: c794f7fbd7494bb69d9c51140c443236
              name: 'Scheduling algorithm duration bucket, {#LE}'
              type: DEPENDENT
              key: 'kubernetes.scheduler.scheduling_algorithm_duration[{#LE}]'
              history: 1h
              value_type: FLOAT
              trends: '0'
              discover: NO_DISCOVER
              description: 'Scheduling algorithm latency in seconds.'
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'scheduler_scheduling_algorithm_duration_seconds_bucket{le = "{#LE}"}'
                    - value
                    - ''
                  error_handler: DISCARD_VALUE
              master_item:
                key: kubernetes.scheduler.get_metrics
              tags:
                - tag: component
                  value: scheduling-algorithm
            - uuid: 3df35ee6e86a424f89f51bb74cb40b9d
              name: 'Scheduling algorithm duration, p50'
              type: CALCULATED
              key: 'kubernetes.scheduler.scheduling_algorithm_duration_p50[{#SINGLETON}]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.scheduler.scheduling_algorithm_duration[*],5m,50)'
              description: '50 percentile of scheduling algorithm latency in seconds.'
              tags:
                - tag: component
                  value: scheduling-algorithm
            - uuid: 2368f2c98f3641bdbd030d94ca53a4dd
              name: 'Scheduling algorithm duration, p90'
              type: CALCULATED
              key: 'kubernetes.scheduler.scheduling_algorithm_duration_p90[{#SINGLETON}]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.scheduler.scheduling_algorithm_duration[*],5m,90)'
              description: '90 percentile of scheduling algorithm latency in seconds.'
              tags:
                - tag: component
                  value: scheduling-algorithm
            - uuid: 6ca6a2480c4343a8b9a4e6598ec86501
              name: 'Scheduling algorithm duration, p95'
              type: CALCULATED
              key: 'kubernetes.scheduler.scheduling_algorithm_duration_p95[{#SINGLETON}]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.scheduler.scheduling_algorithm_duration[*],5m,95)'
              description: '95 percentile of scheduling algorithm latency in seconds.'
              tags:
                - tag: component
                  value: scheduling-algorithm
            - uuid: 955f0989372c4f9d82ad364b09f5efea
              name: 'Scheduling algorithm duration, p99'
              type: CALCULATED
              key: 'kubernetes.scheduler.scheduling_algorithm_duration_p99[{#SINGLETON}]'
              value_type: FLOAT
              discover: NO_DISCOVER
              units: s
              params: 'bucket_percentile(//kubernetes.scheduler.scheduling_algorithm_duration[*],5m,99)'
              description: '99 percentile of scheduling algorithm latency in seconds.'
              tags:
                - tag: component
                  value: scheduling-algorithm
          graph_prototypes:
            - uuid: 94607df22a1c49e5aa290fd50e9c2238
              name: 'Kubernetes Scheduler: [{#SINGLETON}]Scheduling algorithm duration'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'Kubernetes Scheduler by HTTP'
                    key: 'kubernetes.scheduler.scheduling_algorithm_duration_p50[{#SINGLETON}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'Kubernetes Scheduler by HTTP'
                    key: 'kubernetes.scheduler.scheduling_algorithm_duration_p90[{#SINGLETON}]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'Kubernetes Scheduler by HTTP'
                    key: 'kubernetes.scheduler.scheduling_algorithm_duration_p95[{#SINGLETON}]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'Kubernetes Scheduler by HTTP'
                    key: 'kubernetes.scheduler.scheduling_algorithm_duration_p99[{#SINGLETON}]'
          master_item:
            key: kubernetes.scheduler.get_metrics
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - '{__name__=~ "scheduler_scheduling_algorithm_duration_seconds_*"}'
            - type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                  	result = [];
                  JSON.parse(value).forEach(function (item) {
                  	if (item.name === "scheduler_scheduling_algorithm_duration_seconds_count"){
                  		result.push({
                  			'{#TYPE}': 'totals',
                  			'{#SINGLETON}': ''
                  		});
                  
                  	  }
                  	else if  (item.name === "scheduler_scheduling_algorithm_duration_seconds_bucket"){
                  		result.push({
                  			'{#TYPE}': 'buckets',
                  			'{#LE}': item.labels.le
                  		});
                  	}
                  });
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          overrides:
            - name: 'bucket item'
              step: '1'
              filter:
                conditions:
                  - macro: '{#TYPE}'
                    value: buckets
              operations:
                - operator: LIKE
                  value: bucket
                  discover: DISCOVER
            - name: 'total item'
              step: '2'
              filter:
                conditions:
                  - macro: '{#TYPE}'
                    value: totals
              operations:
                - operator: NOT_LIKE
                  value: bucket
                  discover: DISCOVER
      tags:
        - tag: class
          value: software
        - tag: subclass
          value: automation
        - tag: subclass
          value: containers
        - tag: subclass
          value: deploy
        - tag: subclass
          value: development
        - tag: subclass
          value: virtualization
        - tag: target
          value: kubernetes
        - tag: target
          value: scheduler
      macros:
        - macro: '{$KUBE.API.TOKEN}'
          type: SECRET_TEXT
          description: 'API Authorization Token.'
          config:
            type: TEXT
            priority: '1'
            label: 'API Authorization Token'
            description: 'Token used for API authorization.'
            required: 'YES'
        - macro: '{$KUBE.SCHEDULER.ERROR}'
          value: '2'
          description: 'Maximum number of scheduling failures with ''error'' used for trigger.'
          config:
            type: TEXT
            priority: '5'
            section_name: Thresholds
            label: 'Scheduling error threshold'
            description: 'Maximum number of scheduling failures with errors allowed before triggering an alert. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$KUBE.SCHEDULER.HTTP.CLIENT.ERROR}'
          value: '2'
          description: 'Maximum number of HTTP client requests failures used for trigger.'
          config:
            type: TEXT
            priority: '3'
            label: 'HTTP client error threshold'
            description: 'Maximum number of HTTP client request failures allowed before triggering an alert. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$KUBE.SCHEDULER.SERVER.URL}'
          value: 'https://localhost:10259/metrics'
          description: 'Kubernetes Scheduler metrics endpoint URL.'
          config:
            type: TEXT
            priority: '2'
            label: 'Scheduler metrics endpoint URL'
            description: 'URL to access Kubernetes Scheduler metrics.'
        - macro: '{$KUBE.SCHEDULER.UNSCHEDULABLE}'
          value: '2'
          description: 'Maximum number of scheduling failures with ''unschedulable'' used for trigger.'
          config:
            type: TEXT
            priority: '4'
            section_name: Thresholds
            label: 'Unschedulable scheduling failures threshold'
            description: 'Maximum number of unschedulable scheduling failures allowed before triggering an alert. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
      dashboards:
        - uuid: 2292bfff871944bda9471a2ea714d04e
          name: 'Scheduler overview'
          pages:
            - name: General
              widgets:
                - type: graph
                  width: '72'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Kubernetes Scheduler by HTTP'
                        name: 'Kubernetes Scheduler: Memory usage'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: graph
                  'y': '5'
                  width: '72'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Kubernetes Scheduler by HTTP'
                        name: 'Kubernetes Scheduler: REST Client query rate'
                    - type: STRING
                      name: reference
                      value: AAAAB
                - type: graph
                  'y': '10'
                  width: '72'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Kubernetes Scheduler by HTTP'
                        name: 'Kubernetes Scheduler: Scheduling attempts rate'
                    - type: STRING
                      name: reference
                      value: AAAAC
            - name: Latencies
              widgets:
                - type: graphprototype
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Kubernetes Scheduler by HTTP'
                        name: 'Kubernetes Scheduler: [{#SINGLETON}]Binding latency'
                    - type: STRING
                      name: reference
                      value: AAAAD
                - type: graphprototype
                  'y': '5'
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Kubernetes Scheduler by HTTP'
                        name: 'Kubernetes Scheduler: ["{#RESULT}"] E2e latency'
                    - type: STRING
                      name: reference
                      value: AAAAE
                - type: graphprototype
                  'y': '10'
                  width: '72'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Kubernetes Scheduler by HTTP'
                        name: 'Kubernetes Scheduler: [{#SINGLETON}]Scheduling algorithm duration'
                    - type: STRING
                      name: reference
                      value: AAAAF
    - uuid: e0a7c3e725c445228b03116dc6114fe9
      template: 'PostgreSQL by ODBC'
      name: 'PostgreSQL by ODBC'
      description: |
        This template is designed for the effortless deployment of PostgreSQL monitoring by Zabbix via ODBC and doesn't require any external scripts.
        
        Setup:
        
        1. Create the PostgreSQL user for monitoring (`<password>` at your discretion) and inherit permissions from the default role `pg_monitor`:
        CREATE USER zbx_monitor WITH PASSWORD '<PASSWORD>' INHERIT;
        GRANT pg_monitor TO zbx_monitor;
        
        2. Edit the `pg_hba.conf` configuration file to allow TCP connections for the user `zbx_monitor`. You can check the PostgreSQL documentation for examples (https://www.postgresql.org/docs/current/auth-pg-hba-conf.html).
        
        3. Install the PostgreSQL ODBC driver.
        
        4. Set up the connection string with the `{$PG.CONNSTRING.ODBC}` macro. The minimum required parameters are:
        - `Driver=` - set the name of the driver which will be used for monitoring (from the `odbcinst.ini` file) or specify the path to the driver file (for example `/usr/lib64/psqlodbcw.so`);
        - `Servername=` - set the host name or IP address of the PostgreSQL instance;
        - `Port=` - adjust the port number if needed.
        
        If you want to use SSL/TLS encryption to protect communications with the remote PostgreSQL instance, you can also specify encryption parameters here.
        
        It is assumed that you set up the PostgreSQL instance to work in the desired encryption mode. Check the PostgreSQL documentation (https://www.postgresql.org/docs/current/ssl-tcp.html) for details.
        
        For example, to enable required encryption in transport mode without identity checks, the connection string could look like this (replace `<instanceip>` with the address of the PostgreSQL instance):
        Servername=<instanceip>;Port=5432;Driver=/usr/lib64/psqlodbcw.so;SSLmode=require
        
        5. Set the password that you specified in step 1 in the macro `{$PG.PASSWORD}`.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/384190-%C2%A0discussion-thread-for-official-zabbix-template-db-postgresql
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Setup
        
        1. Create the PostgreSQL user for monitoring (`<password>` at your discretion) and inherit permissions from the default role `pg_monitor`:
        
        ```sql
        CREATE USER zbx_monitor WITH PASSWORD '<PASSWORD>' INHERIT;
        GRANT pg_monitor TO zbx_monitor;
        ```
        
        2. Edit the `pg_hba.conf` configuration file to allow TCP connections for the user `zbx_monitor`. For example, you could add one of the following rows to allow local connections from the same host:
        
        ```bash
        # TYPE  DATABASE        USER            ADDRESS                 METHOD
          host       all        zbx_monitor     localhost               trust
          host       all        zbx_monitor     127.0.0.1/32            md5
          host       all        zbx_monitor     ::1/128                 scram-sha-256
        ```
        
        For more information please read the PostgreSQL documentation `https://www.postgresql.org/docs/current/auth-pg-hba-conf.html`.
        
        3. Install the PostgreSQL ODBC driver. Check the [`Zabbix documentation`](https://www.zabbix.com/documentation/8.0/manual/config/items/itemtypes/odbc_checks/) for details about ODBC checks and [`recommended parameters page`](https://www.zabbix.com/documentation/8.0/manual/config/items/itemtypes/odbc_checks/unixodbc_postgresql).
        
        4. Set up the connection string in the `PostgreSQL connection string` host wizard configuration field. The minimum required parameters are:
        
        - `Driver=` - set the name of the driver which will be used for monitoring (from the `odbcinst.ini` file) or specify the path to the driver file (for example `/usr/lib64/psqlodbcw.so`);
        - `Servername=` - set the host name or IP address of the PostgreSQL instance;
        - `Port=` - adjust the port number if needed.
        
        **Note:** if you want to use SSL/TLS encryption to protect communications with the remote PostgreSQL instance, you can also specify encryption parameters here.
        
        It is assumed that you set up the PostgreSQL instance to work in the desired encryption mode. Check the [`PostgreSQL documentation`](https://www.postgresql.org/docs/current/ssl-tcp.html) for details.
        
        For example, to enable required encryption in transport mode without identity checks, the connection string could look like this (replace `<instanceip>` with the address of the PostgreSQL instance):
        
        ```
        Servername=<instanceip>;Port=5432;Driver=/usr/lib64/psqlodbcw.so;SSLmode=require
        ```
        
        5. Set the password that you specified in step 1 in the `PostgreSQL user password` field.
      vendor:
        name: Zabbix
        version: 8.0-1
      groups:
        - name: Templates/Databases
      items:
        - uuid: 9440208c49134347809eff39109c644f
          name: 'Get archive'
          type: ODBC
          key: 'db.odbc.select[pgsql.archive,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          history: '0'
          value_type: TEXT
          params: |
            WITH values AS (
              SELECT
                4096/(ceil(pg_settings.setting::numeric/1024/1024))::int AS segment_parts_count,
                setting::bigint AS segment_size,
                ('x' || substring(pg_stat_archiver.last_archived_wal from 9 for 8))::bit(32)::int AS last_wal_div,
                ('x' || substring(pg_stat_archiver.last_archived_wal from 17 for 8))::bit(32)::int AS last_wal_mod,
                CASE WHEN pg_is_in_recovery() THEN NULL 
                  ELSE ('x' || substring(pg_walfile_name(pg_current_wal_lsn()) from 9 for 8))::bit(32)::int END AS current_wal_div,
                CASE WHEN pg_is_in_recovery() THEN NULL 
                  ELSE ('x' || substring(pg_walfile_name(pg_current_wal_lsn()) from 17 for 8))::bit(32)::int END AS current_wal_mod
              FROM pg_settings, pg_stat_archiver
              WHERE pg_settings.name = 'wal_segment_size')
            SELECT json_build_object(
              'archived_count', (SELECT archived_count FROM pg_stat_archiver),
              'failed_count', (SELECT failed_count FROM pg_stat_archiver),
              'count_files', (SELECT greatest(coalesce((segment_parts_count - last_wal_mod) + ((current_wal_div - last_wal_div - 1) * segment_parts_count) + current_wal_mod - 1, 0), 0) FROM values),
              'size_files', (SELECT greatest(coalesce(((segment_parts_count - last_wal_mod) + ((current_wal_div - last_wal_div - 1) * segment_parts_count) + current_wal_mod - 1) * segment_size, 0), 0) FROM values)
            ) AS result
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: 'Collect archive status metrics.'
          tags:
            - tag: component
              value: raw
        - uuid: dd79edeb2d65420fb58d587e411c440f
          name: 'Count of autovacuum workers'
          type: ODBC
          key: 'db.odbc.select[pgsql.autovacuum.count,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          value_type: FLOAT
          params: |
            SELECT count(*)
              FROM pg_catalog.pg_stat_activity
                WHERE backend_type = 'autovacuum worker'
                  AND state <> 'idle'
                  AND pid <> pg_catalog.pg_backend_pid()
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: 'Number of autovacuum workers.'
          tags:
            - tag: component
              value: system
        - uuid: 1d267b6aed064d03b4f464b27c1e897e
          name: 'Get connections sum'
          type: ODBC
          key: 'db.odbc.select[pgsql.connections.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          history: '0'
          value_type: TEXT
          params: |
            SELECT row_to_json(T)
              FROM (
                SELECT
                  sum(CASE WHEN state = 'active' THEN 1 ELSE 0 END) AS active,
                  sum(CASE WHEN state = 'idle' THEN 1 ELSE 0 END) AS idle,
                  sum(CASE WHEN state = 'idle in transaction' THEN 1 ELSE 0 END) AS idle_in_transaction,
                  sum(CASE WHEN state = 'idle in transaction (aborted)' THEN 1 ELSE 0 END) AS idle_in_transaction_aborted,
                  sum(CASE WHEN state = 'fastpath function call' THEN 1 ELSE 0 END) AS fastpath_function_call,
                  sum(CASE WHEN state = 'disabled' THEN 1 ELSE 0 END) AS disabled,
                  count(*) AS total,
                  count(*)*100/(SELECT current_setting('max_connections')::int) AS total_pct,
                  sum(CASE WHEN wait_event IS NOT NULL THEN 1 ELSE 0 END) AS waiting,
                  (SELECT count(*) FROM pg_prepared_xacts) AS prepared
                FROM pg_stat_activity WHERE datid IS NOT NULL AND state IS NOT NULL) T
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: |
            Collect all metrics from pg_stat_activity:
            https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW
          tags:
            - tag: component
              value: raw
        - uuid: 0f93764d56574a288467ad16dce11a17
          name: 'Get dbstat'
          type: ODBC
          key: 'db.odbc.select[pgsql.dbstat,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          history: '0'
          value_type: TEXT
          params: |
            SELECT json_object_agg(coalesce (datname,'null'), row_to_json(T)) FROM (
              SELECT datname,
                numbackends AS numbackends,
                xact_commit AS xact_commit,
                xact_rollback AS xact_rollback,
                blks_read AS blks_read,
                blks_hit AS blks_hit,
                tup_returned AS tup_returned,
                tup_fetched AS tup_fetched,
                tup_inserted AS tup_inserted,
                tup_updated AS tup_updated,
                tup_deleted AS tup_deleted,
                conflicts AS conflicts,
                temp_files AS temp_files,
                temp_bytes AS temp_bytes,
                deadlocks AS deadlocks,
                blk_read_time AS blk_read_time,
                blk_write_time AS blk_write_time
              FROM pg_catalog.pg_stat_database WHERE datname IS NOT NULL) T;
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: |
            Collect all metrics from pg_stat_database per database:
            https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-DATABASE-VIEW
          tags:
            - tag: component
              value: raw
        - uuid: 6ea1a17fad8b4ef3aba8b49a0922a77d
          name: 'Get dbstat sum'
          type: ODBC
          key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          history: '0'
          value_type: TEXT
          params: |
            SELECT row_to_json(T) FROM (
              SELECT sum(numbackends) AS numbackends,
                sum(xact_commit) AS xact_commit,
                sum(xact_rollback) AS xact_rollback,
                sum(blks_read) AS blks_read,
                sum(blks_hit) AS blks_hit,
                sum(tup_returned) AS tup_returned,
                sum(tup_fetched) AS tup_fetched,
                sum(tup_inserted) AS tup_inserted,
                sum(tup_updated) AS tup_updated,
                sum(tup_deleted) AS tup_deleted,
                sum(conflicts) AS conflicts,
                sum(temp_files) AS temp_files,
                sum(temp_bytes) AS temp_bytes,
                sum(deadlocks) AS deadlocks,
                sum(blk_read_time) AS blk_read_time,
                sum(blk_write_time) AS blk_write_time
              FROM pg_stat_database) T
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: |
            Collect all metrics from pg_stat_database as sums for all databases:
            https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-DATABASE-VIEW
          tags:
            - tag: component
              value: raw
        - uuid: efa015e294684fdeb711a0fde1256cf9
          name: 'Get locks'
          type: ODBC
          key: 'db.odbc.select[pgsql.locks,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          history: '0'
          value_type: TEXT
          params: |
            WITH T AS
              (SELECT db.datname dbname,
                  lower(replace(Q.mode, 'Lock', '')) AS MODE,
                  coalesce(T.qty, 0) val
              FROM pg_database db
              JOIN (
                  VALUES ('AccessShareLock') ,('RowShareLock') ,('RowExclusiveLock') ,('ShareUpdateExclusiveLock') ,('ShareLock') ,('ShareRowExclusiveLock') ,('ExclusiveLock') ,('AccessExclusiveLock')) Q(MODE) ON TRUE NATURAL
              LEFT JOIN
                (SELECT datname,
                  MODE,
                  count(MODE) qty
                FROM pg_locks lc
                RIGHT JOIN pg_database db ON db.oid = lc.database
                GROUP BY 1, 2) T
              WHERE NOT db.datistemplate
              ORDER BY 1, 2)
            SELECT json_object_agg(dbname, row_to_json(T2))
            FROM
              (SELECT dbname,
                  sum(val) AS total,
                  sum(CASE
                      WHEN MODE = 'accessexclusive' THEN val
                    END) AS accessexclusive,
                  sum(CASE
                      WHEN MODE = 'accessshare' THEN val
                    END) AS accessshare,
                  sum(CASE
                      WHEN MODE = 'exclusive' THEN val
                    END) AS EXCLUSIVE,
                  sum(CASE
                      WHEN MODE = 'rowexclusive' THEN val
                    END) AS rowexclusive,
                  sum(CASE
                      WHEN MODE = 'rowshare' THEN val
                    END) AS rowshare,
                  sum(CASE
                      WHEN MODE = 'share' THEN val
                    END) AS SHARE,
                  sum(CASE
                      WHEN MODE = 'sharerowexclusive' THEN val
                    END) AS sharerowexclusive,
                  sum(CASE
                      WHEN MODE = 'shareupdateexclusive' THEN val
                    END) AS shareupdateexclusive
              FROM T
              GROUP BY dbname) T2
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: |
            Collect all metrics from pg_locks per database:
            https://www.postgresql.org/docs/current/explicit-locking.html#LOCKING-TABLES
          tags:
            - tag: component
              value: raw
        - uuid: 266a9b5c1e604d97ac5a74ccdb598c97
          name: 'Age of oldest xid'
          type: ODBC
          key: 'db.odbc.select[pgsql.oldest.xid,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          value_type: FLOAT
          params: |
            SELECT greatest(max(age(backend_xmin)), max(age(backend_xid)))
              FROM pg_catalog.pg_stat_activity
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: 'Age of oldest xid.'
          tags:
            - tag: component
              value: transactions
          triggers:
            - uuid: 4d32971898d441fb94d5f029649dddfa
              expression: 'last(/PostgreSQL by ODBC/db.odbc.select[pgsql.oldest.xid,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]) > 18000000'
              name: 'PostgreSQL: Oldest xid is too big'
              priority: AVERAGE
              tags:
                - tag: scope
                  value: availability
        - uuid: 3c16a3c2db7641c2b6958649d7b4809e
          name: Ping
          type: ODBC
          key: 'db.odbc.select[pgsql.ping,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          params: 'SELECT 1'
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: 'Used to test a connection to see if it is alive. It is set to 0 if the query is unsuccessful.'
          valuemap:
            name: 'Service state'
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          tags:
            - tag: component
              value: application
            - tag: component
              value: health
          triggers:
            - uuid: 758e569b51954fcf82c7cb3fa391c882
              expression: 'last(/PostgreSQL by ODBC/db.odbc.select[pgsql.ping,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"])=0'
              name: 'PostgreSQL: Service is down'
              priority: HIGH
              description: 'Last test of a connection was unsuccessful.'
              tags:
                - tag: scope
                  value: availability
        - uuid: ee6b3f64e07d4acd875dbd83dccd51d0
          name: 'Get queries'
          type: ODBC
          key: 'db.odbc.select[pgsql.queries,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          history: '0'
          value_type: TEXT
          params: |
            WITH T AS
              (SELECT db.datname,
                coalesce(T.query_time_max, 0) query_time_max,
                coalesce(T.tx_time_max, 0) tx_time_max,
                coalesce(T.mro_time_max, 0) mro_time_max,
                coalesce(T.query_time_sum, 0) query_time_sum,
                coalesce(T.tx_time_sum, 0) tx_time_sum,
                coalesce(T.mro_time_sum, 0) mro_time_sum,
                coalesce(T.query_slow_count, 0) query_slow_count,
                coalesce(T.tx_slow_count, 0) tx_slow_count,
                coalesce(T.mro_slow_count, 0) mro_slow_count
              FROM pg_database db NATURAL
              LEFT JOIN (
                SELECT datname,
                  extract(epoch FROM now())::integer ts,
                  coalesce(max(extract('epoch' FROM (clock_timestamp() - query_start))::integer * (state NOT IN ('idle', 'idle in transaction', 'idle in transaction (aborted)') AND query !~* E'^(\\s*(--[^\\n]*\\n|/\\*.*\\*/|\\n))*(autovacuum|VACUUM|ANALYZE|REINDEX|CLUSTER|CREATE|ALTER|TRUNCATE|DROP)')::integer), 0) query_time_max,
                  coalesce(max(extract('epoch' FROM (clock_timestamp() - query_start))::integer * (state NOT IN ('idle') AND query !~* E'^(\\s*(--[^\\n]*\\n|/\\*.*\\*/|\\n))*(autovacuum|VACUUM|ANALYZE|REINDEX|CLUSTER|CREATE|ALTER|TRUNCATE|DROP)')::integer), 0) tx_time_max,
                  coalesce(max(extract('epoch' FROM (clock_timestamp() - query_start))::integer * (state NOT IN ('idle') AND query ~* E'^(\\s*(--[^\\n]*\\n|/\\*.*\\*/|\\n))*(autovacuum|VACUUM|ANALYZE|REINDEX|CLUSTER|CREATE|ALTER|TRUNCATE|DROP)')::integer), 0) mro_time_max,
                  coalesce(sum(extract('epoch' FROM (clock_timestamp() - query_start))::integer * (state NOT IN ('idle', 'idle in transaction', 'idle in transaction (aborted)') AND query !~* E'^(\\s*(--[^\\n]*\\n|/\\*.*\\*/|\\n))*(autovacuum|VACUUM|ANALYZE|REINDEX|CLUSTER|CREATE|ALTER|TRUNCATE|DROP)')::integer), 0) query_time_sum,
                  coalesce(sum(extract('epoch' FROM (clock_timestamp() - query_start))::integer * (state NOT IN ('idle') AND query !~* E'^(\\s*(--[^\\n]*\\n|/\\*.*\\*/|\\n))*(autovacuum|VACUUM|ANALYZE|REINDEX|CLUSTER|CREATE|ALTER|TRUNCATE|DROP)')::integer), 0) tx_time_sum,
                  coalesce(sum(extract('epoch' FROM (clock_timestamp() - query_start))::integer * (state NOT IN ('idle') AND query ~* E'^(\\s*(--[^\\n]*\\n|/\\*.*\\*/|\\n))*(autovacuum|VACUUM|ANALYZE|REINDEX|CLUSTER|CREATE|ALTER|TRUNCATE|DROP)')::integer), 0) mro_time_sum,
            
                  coalesce(sum((extract('epoch' FROM (clock_timestamp() - query_start)) > {$PG.QUERY_ETIME.MAX.WARN})::integer * (state NOT IN ('idle', 'idle in transaction', 'idle in transaction (aborted)') AND query !~* E'^(\\s*(--[^\\n]*\\n|/\\*.*\\*/|\\n))*(autovacuum|VACUUM|ANALYZE|REINDEX|CLUSTER|CREATE|ALTER|TRUNCATE|DROP)')::integer), 0) query_slow_count,
                  coalesce(sum((extract('epoch' FROM (clock_timestamp() - query_start)) > {$PG.QUERY_ETIME.MAX.WARN})::integer * (state NOT IN ('idle') AND query !~* E'^(\\s*(--[^\\n]*\\n|/\\*.*\\*/|\\n))*(autovacuum|VACUUM|ANALYZE|REINDEX|CLUSTER|CREATE|ALTER|TRUNCATE|DROP)')::integer), 0) tx_slow_count,
                  coalesce(sum((extract('epoch' FROM (clock_timestamp() - query_start)) > {$PG.QUERY_ETIME.MAX.WARN})::integer * (state NOT IN ('idle') AND query ~* E'^(\\s*(--[^\\n]*\\n|/\\*.*\\*/|\\n))*(autovacuum|VACUUM|ANALYZE|REINDEX|CLUSTER|CREATE|ALTER|TRUNCATE|DROP)')::integer), 0) mro_slow_count
                FROM pg_stat_activity
                WHERE pid <> pg_backend_pid()
                GROUP BY 1) T
              WHERE NOT db.datistemplate )
            SELECT json_object_agg(datname, row_to_json(T))
            FROM T
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: 'Collect all metrics by query execution time.'
          tags:
            - tag: component
              value: raw
        - uuid: d156db3cb35049a88179060583961156
          name: 'Replication: Standby count'
          type: ODBC
          key: 'db.odbc.select[pgsql.replication.count,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          params: 'SELECT count(*) FROM pg_stat_replication'
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: 'Number of standby servers.'
          tags:
            - tag: component
              value: replication
        - uuid: 669d87ebf9324d6eaa26c3cb44efc850
          name: 'Replication: Lag in bytes'
          type: ODBC
          key: 'db.odbc.select[pgsql.replication.lag.b,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          units: B
          params: |
            SELECT
              CASE
                WHEN NOT pg_is_in_recovery() OR pg_last_wal_receive_lsn() = pg_last_wal_replay_lsn() THEN 0
                  ELSE COALESCE(EXTRACT(EPOCH FROM now() - pg_last_xact_replay_timestamp())::integer, 0)
                END AS lag
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: 'Replication lag with master, in bytes.'
          tags:
            - tag: component
              value: replication
        - uuid: bb87b83d35784d3ea5be2263fa3722b0
          name: 'Replication: Lag in seconds'
          type: ODBC
          key: 'db.odbc.select[pgsql.replication.lag.sec,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          units: s
          params: |
            SELECT
              CASE
                WHEN NOT pg_is_in_recovery() OR pg_last_wal_receive_lsn() = pg_last_wal_replay_lsn() THEN 0
                  ELSE COALESCE(EXTRACT(EPOCH FROM now() - pg_last_xact_replay_timestamp())::integer, 0)
                END AS lag
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: 'Replication lag with master, in seconds.'
          tags:
            - tag: component
              value: replication
        - uuid: 3f2b5c02a6be40d4837205f68aaacabb
          name: 'Get replication'
          type: ODBC
          key: 'db.odbc.select[pgsql.replication.process,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          history: '0'
          value_type: TEXT
          params: |
            SELECT json_object_agg(application_name, row_to_json(T))
              FROM (
                SELECT
                  application_name,
                  EXTRACT(epoch FROM COALESCE(flush_lag,'0'::interval)) AS flush_lag,
                  EXTRACT(epoch FROM COALESCE(replay_lag,'0'::interval)) AS replay_lag,
                  EXTRACT(epoch FROM COALESCE(write_lag, '0'::interval)) AS write_lag
                FROM pg_stat_replication
              ) T
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: 'Collect metrics from the pg_stat_replication, which contains information about the WAL sender process, showing statistics about replication to that sender''s connected standby server.'
          preprocessing:
            - type: CHECK_NOT_SUPPORTED
              parameters:
                - '-1'
          tags:
            - tag: component
              value: raw
        - uuid: f8205cdd902a4a688b5bcb7f65d8e41d
          name: 'Replication: Recovery role'
          type: ODBC
          key: 'db.odbc.select[pgsql.replication.recovery_role,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          params: 'SELECT pg_is_in_recovery()::int'
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: 'Replication role: 1 — recovery is still in progress (standby mode), 0 — master mode.'
          valuemap:
            name: 'PostgreSQL recovery role'
          tags:
            - tag: component
              value: replication
        - uuid: 6cc8c748f6174d3dba9aa9b39570b006
          name: 'Replication: Status'
          type: ODBC
          key: 'db.odbc.select[pgsql.replication.status,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          params: |
            SELECT
              CASE
                WHEN NOT pg_is_in_recovery() THEN 2
                ELSE (SELECT count(*) FROM pg_stat_wal_receiver)
              END AS repl_status
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: 'Replication status: 0 — streaming is down, 1 — streaming is up, 2 — master mode.'
          valuemap:
            name: 'PostgreSQL replication status'
          tags:
            - tag: component
              value: replication
        - uuid: 817c494132044fff88ea4c9fcaacb60a
          name: Uptime
          type: ODBC
          key: 'db.odbc.select[pgsql.uptime,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          value_type: FLOAT
          units: uptime
          params: 'SELECT date_part(''epoch'', now() - pg_postmaster_start_time())'
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: 'Time since the server started.'
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: 22077f0b0ee54becb43ef9ab808c3e43
              expression: 'last(/PostgreSQL by ODBC/db.odbc.select[pgsql.uptime,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]) < 10m'
              name: 'PostgreSQL: Service has been restarted'
              event_name: 'PostgreSQL: Service has been restarted (uptime < 10m)'
              priority: AVERAGE
              description: 'PostgreSQL uptime is less than 10 minutes.'
              tags:
                - tag: scope
                  value: notice
        - uuid: 4bfb0c1697f043d9acf640b84cc8d945
          name: Version
          type: ODBC
          key: 'db.odbc.select[pgsql.version,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          delay: 15m
          value_type: CHAR
          params: 'SELECT version()'
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: 'PostgreSQL version.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: fd409b64f83943edaf43845a12bf8ace
              expression: 'last(/PostgreSQL by ODBC/db.odbc.select[pgsql.version,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"],#1)<>last(/PostgreSQL by ODBC/db.odbc.select[pgsql.version,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"],#2) and length(last(/PostgreSQL by ODBC/db.odbc.select[pgsql.version,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]))>0'
              name: 'PostgreSQL: Version has changed'
              event_name: 'PostgreSQL: Version has changed (new version value received: {ITEM.VALUE})'
              priority: INFO
              tags:
                - tag: scope
                  value: notice
        - uuid: 0b76450dd17d47a1829f51960dcb1374
          name: 'Version (numeric)'
          type: ODBC
          key: 'db.odbc.select[pgsql.version.num,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          delay: 15m
          trends: '0'
          params: 'SELECT current_setting(''server_version_num'')'
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: 'Reports the version number of the server as an integer.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          tags:
            - tag: component
              value: application
        - uuid: 8af13c6154744e9596a0f96dfbf09d8b
          name: 'Get WAL'
          type: ODBC
          key: 'db.odbc.select[pgsql.wal.stat,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          delay: 5m
          history: '0'
          value_type: TEXT
          params: |
            SELECT row_to_json(T)
              FROM (
                SELECT
                  CASE
                    WHEN pg_is_in_recovery() THEN 0
                    ELSE pg_wal_lsn_diff(pg_current_wal_lsn(),'0/00000000')
                  END AS WRITE,
                  CASE 
                    WHEN NOT pg_is_in_recovery() THEN 0
                    ELSE pg_wal_lsn_diff(pg_last_wal_receive_lsn(),'0/00000000')
                  END AS RECEIVE,
                  count(*)
                  FROM pg_ls_waldir() AS COUNT
              ) T
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          description: 'Collect write-ahead log (WAL) metrics.'
          tags:
            - tag: component
              value: raw
        - uuid: d69d40f3e7064f668b0bf150ff73aafc
          name: 'Archive: Count of archived files'
          type: DEPENDENT
          key: pgsql.archive.count_archived_files
          value_type: FLOAT
          description: 'Count of archived files.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.archived_count
          master_item:
            key: 'db.odbc.select[pgsql.archive,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: archive
        - uuid: c1cc1236cf0c412a84e7d1ff3fec14e5
          name: 'Archive: Count of files in archive_status need to archive'
          type: DEPENDENT
          key: pgsql.archive.count_files_to_archive
          value_type: FLOAT
          description: 'Count of files to archive.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.count_files
          master_item:
            key: 'db.odbc.select[pgsql.archive,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: archive
        - uuid: 1ea44a48aaf042debc078ad920dd4f02
          name: 'Archive: Count of failed attempts to archive files'
          type: DEPENDENT
          key: pgsql.archive.failed_trying_to_archive
          value_type: FLOAT
          description: 'Count of failed attempts to archive files.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.failed_count
          master_item:
            key: 'db.odbc.select[pgsql.archive,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: archive
        - uuid: 13f563e6152a482fb48415d81f916af2
          name: 'Archive: Size of files need to archive'
          type: DEPENDENT
          key: pgsql.archive.size_files_to_archive
          value_type: FLOAT
          description: 'Size of files to archive.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.size_files
          master_item:
            key: 'db.odbc.select[pgsql.archive,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: archive
        - uuid: 9b8faf03797f4dccb9573b664805478a
          name: 'Bgwriter LLD'
          type: DEPENDENT
          key: pgsql.bgwriter.lld
          history: '0'
          value_type: CHAR
          description: 'LLD data for "bgwriter" metrics discovery.'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var version_num = parseInt(value, 10),
                  	result = [{
                  		'{#BELOW_V17}': 'false',
                  		'{#SINGLETON}': ''
                  	}];
                  
                  if (version_num < 170000) {
                  	result[0]['{#BELOW_V17}'] = 'true';
                  }
                  
                  return JSON.stringify(result);
          master_item:
            key: 'db.odbc.select[pgsql.version.num,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: raw
        - uuid: 6444043a810b4b2f89740c1c794a47c0
          name: 'Cache hit ratio, %'
          type: CALCULATED
          key: pgsql.cache.hit
          value_type: FLOAT
          units: '%'
          params: 'last(//pgsql.dbstat.sum.blks_hit.rate) * 100 / (last(//pgsql.dbstat.sum.blks_hit.rate) + last(//pgsql.dbstat.sum.blks_read.rate))'
          description: 'Cache hit ratio.'
          tags:
            - tag: component
              value: cache
        - uuid: 5e3e5b6a244c4dfdacc7167196e28d7d
          name: 'Connections sum: Active'
          type: DEPENDENT
          key: pgsql.connections.sum.active
          description: 'Total number of connections executing a query.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.active
          master_item:
            key: 'db.odbc.select[pgsql.connections.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 2dd753d41b5e4c4098fef4fe5ac51060
          name: 'Connections sum: Disabled'
          type: DEPENDENT
          key: pgsql.connections.sum.disabled
          description: 'Total number of disabled connections.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.disabled
          master_item:
            key: 'db.odbc.select[pgsql.connections.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 6d379fe1fe424ed68dea03a90da81da0
          name: 'Connections sum: Fastpath function call'
          type: DEPENDENT
          key: pgsql.connections.sum.fastpath_function_call
          description: 'Total number of connections executing a fast-path function.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.fastpath_function_call
          master_item:
            key: 'db.odbc.select[pgsql.connections.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 8b777c5628c4462580f1ae70790fb584
          name: 'Connections sum: Idle'
          type: DEPENDENT
          key: pgsql.connections.sum.idle
          description: 'Total number of connections waiting for a new client command.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.idle
          master_item:
            key: 'db.odbc.select[pgsql.connections.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 7851bc86735e46a48fd5c82d83ef066a
          name: 'Connections sum: Idle in transaction'
          type: DEPENDENT
          key: pgsql.connections.sum.idle_in_transaction
          description: 'Total number of connections in a transaction state but not executing a query.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.idle_in_transaction
          master_item:
            key: 'db.odbc.select[pgsql.connections.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 9267653f21b445beaacd3de3e55ad4ae
          name: 'Connections sum: Idle in transaction (aborted)'
          type: DEPENDENT
          key: pgsql.connections.sum.idle_in_transaction_aborted
          description: 'Total number of connections in a transaction state but not executing a query, and where one of the statements in the transaction caused an error.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.idle_in_transaction_aborted
          master_item:
            key: 'db.odbc.select[pgsql.connections.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 512e90360d4d4b95aa23014181697afe
          name: 'Connections sum: Prepared'
          type: DEPENDENT
          key: pgsql.connections.sum.prepared
          description: |
            Total number of prepared transactions:
            https://www.postgresql.org/docs/current/sql-prepare-transaction.html
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.prepared
          master_item:
            key: 'db.odbc.select[pgsql.connections.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 4d092ed405e2410f9e1a4cdb31249fe0
          name: 'Connections sum: Total'
          type: DEPENDENT
          key: pgsql.connections.sum.total
          description: 'Total number of connections.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.total
          master_item:
            key: 'db.odbc.select[pgsql.connections.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 2b2ca7abb85b4ae1992cbfc6902206a1
          name: 'Connections sum: Total, %'
          type: DEPENDENT
          key: pgsql.connections.sum.total_pct
          units: '%'
          description: 'Total number of connections, in percentage.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.total_pct
          master_item:
            key: 'db.odbc.select[pgsql.connections.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: connections
          triggers:
            - uuid: 3b6662191c3b46ac930af02797a7162b
              expression: 'min(/PostgreSQL by ODBC/pgsql.connections.sum.total_pct,5m) > {$PG.CONN_TOTAL_PCT.MAX.WARN}'
              name: 'PostgreSQL: Total number of connections is too high'
              event_name: 'PostgreSQL: Total number of connections is too high (over {$PG.CONN_TOTAL_PCT.MAX.WARN}% in 5m)'
              priority: AVERAGE
              description: 'Total number of current connections exceeds the limit of {$PG.CONN_TOTAL_PCT.MAX.WARN}% out of the maximum number of concurrent connections to the database server (the "max_connections" setting).'
              tags:
                - tag: scope
                  value: performance
        - uuid: 7f525a9b9b6a494db660649388b8cb21
          name: 'Connections sum: Waiting'
          type: DEPENDENT
          key: pgsql.connections.sum.waiting
          description: |
            Total number of waiting connections:
            https://www.postgresql.org/docs/current/monitoring-stats.html#WAIT-EVENT-TABLE
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.waiting
          master_item:
            key: 'db.odbc.select[pgsql.connections.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: connections
        - uuid: 6cb6aaa39f494f13b792ea0d1570f0af
          name: 'Dbstat: Hit blocks read per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.blks_hit.rate
          value_type: FLOAT
          description: 'Number of times per second disk blocks were found already in the buffer cache.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.blks_hit
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: cache
        - uuid: 8861dbcc607b481e9f7ca6b3081530a8
          name: 'Dbstat: Disk blocks read per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.blks_read.rate
          value_type: FLOAT
          description: 'Number of disk blocks read per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.blks_read
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: storage
        - uuid: a8a7afddbe7546068e3d629747d73848
          name: 'Dbstat: Blocks read time'
          type: DEPENDENT
          key: pgsql.dbstat.sum.blk_read_time
          value_type: FLOAT
          units: s
          description: 'Time spent reading data file blocks by backends.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.blk_read_time
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: storage
        - uuid: 40b1da9a55cf4312a66dffa9031b9b15
          name: 'Dbstat: Blocks write time'
          type: DEPENDENT
          key: pgsql.dbstat.sum.blk_write_time
          value_type: FLOAT
          units: s
          description: 'Time spent writing data file blocks by backends.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.blk_write_time
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: storage
        - uuid: ef6c8945243f41e88a08d93e66eec666
          name: 'Dbstat: Conflicts per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.conflicts.rate
          value_type: FLOAT
          description: 'Number of queries canceled per second due to conflicts with recovery (conflicts occur only on standby servers; see pg_stat_database_conflicts for details).'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.conflicts
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: queries
        - uuid: 5adcf2ce06984da2b0b0600d88e88451
          name: 'Dbstat: Deadlocks per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.deadlocks.rate
          value_type: FLOAT
          description: 'Number of deadlocks detected per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.deadlocks
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: deadlocks
        - uuid: 26da7e85356644cdbe4d9efd20e43dd2
          name: 'Dbstat: Backends connected'
          type: DEPENDENT
          key: pgsql.dbstat.sum.numbackends
          description: 'Number of connected backends.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.numbackends
          master_item:
            key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: backends
        - uuid: 4c18ecf383154136ad68d5d938fc83d7
          name: 'Dbstat: Number temp bytes per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.temp_bytes.rate
          value_type: FLOAT
          units: b
          description: 'Total amount of data written per second to temporary files by queries.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.temp_bytes
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: storage
        - uuid: 0c7ad16e40e3454aaad27a6fe4b5e62d
          name: 'Dbstat: Number temp files per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.temp_files.rate
          value_type: FLOAT
          description: 'Number of temporary files created by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.temp_files
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: storage
        - uuid: e3cd2d8ec2b8454f949c69bb00e0db57
          name: 'Dbstat: Rows deleted per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.tup_deleted.rate
          value_type: FLOAT
          description: 'Number of rows deleted by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tup_deleted
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: queries
        - uuid: 9f09f94dcd6744e8b6a53167b1835a16
          name: 'Dbstat: Rows fetched per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.tup_fetched.rate
          value_type: FLOAT
          description: 'Number of rows fetched by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tup_fetched
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: queries
        - uuid: 916291299e624959993f8a585da6c9c0
          name: 'Dbstat: Rows inserted per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.tup_inserted.rate
          value_type: FLOAT
          description: 'Number of rows inserted by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tup_inserted
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: queries
        - uuid: fc8f68f5068240f3acd2d18443efc624
          name: 'Dbstat: Rows returned per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.tup_returned.rate
          value_type: FLOAT
          description: 'Number of rows returned by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tup_returned
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: queries
        - uuid: 802d541dd0314f8fba827e6d28013b5c
          name: 'Dbstat: Rows updated per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.tup_updated.rate
          value_type: FLOAT
          description: 'Number of rows updated by queries per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tup_updated
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: queries
        - uuid: c00a09d04d4443d885006b29c5c14546
          name: 'Dbstat: Committed transactions per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.xact_commit.rate
          value_type: FLOAT
          description: 'Number of transactions that have been committed per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.xact_commit
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: transactions
        - uuid: 8f2259521add4cc0bd5e274604172d04
          name: 'Dbstat: Roll backed transactions per second'
          type: DEPENDENT
          key: pgsql.dbstat.sum.xact_rollback.rate
          value_type: FLOAT
          description: 'Number of transactions that have been rolled back per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.xact_rollback
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'db.odbc.select[pgsql.dbstat.sum,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: transactions
        - uuid: 59722a42ba084a4f9a65f6b11f1180f4
          name: 'WAL: Segments count'
          type: DEPENDENT
          key: pgsql.wal.count
          description: 'Number of WAL segments.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.count
          master_item:
            key: 'db.odbc.select[pgsql.wal.stat,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: wal
        - uuid: 5ffd0e54dd464b5c941ba40b696beda9
          name: 'WAL: Bytes received'
          type: DEPENDENT
          key: pgsql.wal.receive
          units: B
          description: 'WAL receive, in bytes.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.receive
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'db.odbc.select[pgsql.wal.stat,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: wal
        - uuid: 0dec7fe5cbe24fcf802cb387ca8edf98
          name: 'WAL: Bytes written'
          type: DEPENDENT
          key: pgsql.wal.write
          units: B
          description: 'WAL write, in bytes.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.write
            - type: CHANGE_PER_SECOND
          master_item:
            key: 'db.odbc.select[pgsql.wal.stat,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          tags:
            - tag: component
              value: wal
      discovery_rules:
        - uuid: 1c51decca55847a8adba4260f53e0acf
          name: 'Database discovery'
          type: ODBC
          key: 'db.odbc.select[pgsql.db.discovery,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          delay: 1h
          params: |
            WITH T AS (
              SELECT
                datname AS "{#DBNAME}"
              FROM pg_database
              WHERE
                NOT datistemplate
                AND datallowconn
                AND datname != 'postgres'
            )
            SELECT '{"data":'|| regexp_replace(coalesce(json_agg(T), '[]'::json)::text, E'[\\n\\r\\s]+', '', 'g') || '}'
            FROM T
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          filter:
            evaltype: AND
            conditions:
              - macro: '{#DBNAME}'
                value: '{$PG.LLD.FILTER.DBNAME}'
          description: |
            Discovers databases (DB) in the database management system (DBMS), except:
            - templates;
            - default "postgres" DB;
            - DBs that do not allow connections.
          item_prototypes:
            - uuid: 98b74e578a3e48f3990bc16eb0217a17
              name: 'DB [{#DBNAME}]: Database age'
              type: ODBC
              key: 'db.odbc.select[pgsql.db.age,,"Database={#DBNAME};{$PG.CONNSTRING.ODBC}"]'
              delay: 10m
              params: |
                SELECT age(datfrozenxid)
                  FROM pg_catalog.pg_database
                  WHERE datname = '{#DBNAME}'
              username: '{$PG.USER}'
              password: '{$PG.PASSWORD}'
              description: 'Database age.'
              tags:
                - tag: component
                  value: application
                - tag: database
                  value: '{#DBNAME}'
            - uuid: cb7067b756bc4b3eb5be2ee2361df6f8
              name: 'DB [{#DBNAME}]: Bloating tables'
              type: ODBC
              key: 'db.odbc.select[pgsql.db.bloating_tables,,"Database={#DBNAME};{$PG.CONNSTRING.ODBC}"]'
              params: |
                SELECT count(*)
                FROM pg_catalog.pg_stat_all_tables
                WHERE (n_dead_tup/(n_live_tup+n_dead_tup)::float8) > 0.2
                  AND (n_live_tup+n_dead_tup) > 50
              username: '{$PG.USER}'
              password: '{$PG.PASSWORD}'
              description: 'Number of bloating tables.'
              tags:
                - tag: component
                  value: tables
                - tag: database
                  value: '{#DBNAME}'
            - uuid: f6bc4dd7f66a4a399a16230b6a7a8f2d
              name: 'DB [{#DBNAME}]: Database size'
              type: ODBC
              key: 'db.odbc.select[pgsql.db.size,,"Database={#DBNAME};{$PG.CONNSTRING.ODBC}"]'
              delay: 5m
              units: B
              params: 'SELECT pg_database_size(current_database())'
              username: '{$PG.USER}'
              password: '{$PG.PASSWORD}'
              description: 'Database size.'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: d6c61f75147e414a99dfba56ea8ba422
              name: 'DB [{#DBNAME}]: Blocks hit per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.blks_hit.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of times per second disk blocks were found already in the buffer cache, so that a read was not necessary.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.blks_hit
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: cache
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 086c614609174dabab3b7a231353f4fa
              name: 'DB [{#DBNAME}]: Disk blocks read per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.blks_read.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of disk blocks read per second in this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.blks_read
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 3ce43b1b7b874278abef353c6c791c95
              name: 'DB [{#DBNAME}]: Disk blocks read time per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.blk_read_time.rate["{#DBNAME}"]'
              value_type: FLOAT
              units: s
              description: 'Time spent reading data file blocks by backends per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.blk_read_time
                - type: MULTIPLIER
                  parameters:
                    - '0.001'
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 9c443a5bae6b4b4c84e6272cb254a38e
              name: 'DB [{#DBNAME}]: Disk blocks write time per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.blk_write_time.rate["{#DBNAME}"]'
              value_type: FLOAT
              units: s
              description: 'Time spent writing data file blocks by backends per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.blk_write_time
                - type: MULTIPLIER
                  parameters:
                    - '0.001'
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 8a772dae1d8f40978bfcceebfabe87de
              name: 'DB [{#DBNAME}]: Detected conflicts per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.conflicts.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of queries canceled due to conflicts with recovery in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.conflicts
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
              trigger_prototypes:
                - uuid: 8dc225c8a2824e5cb62b0ce4dd11dc1e
                  expression: 'min(/PostgreSQL by ODBC/pgsql.dbstat.conflicts.rate["{#DBNAME}"],5m) > {$PG.CONFLICTS.MAX.WARN:"{#DBNAME}"}'
                  name: 'PostgreSQL: DB [{#DBNAME}]: Too many recovery conflicts'
                  event_name: 'PostgreSQL: DB [{#DBNAME}]: Too many recovery conflicts (over {$PG.CONFLICTS.MAX.WARN:"{#DBNAME}"} in 5m)'
                  priority: AVERAGE
                  description: |
                    The primary and standby servers are in many ways loosely connected. Actions on the primary will have an effect on the standby. As a result, there is potential for negative interactions or conflicts between them.
                    https://www.postgresql.org/docs/current/hot-standby.html#HOT-STANDBY-CONFLICT
                  tags:
                    - tag: scope
                      value: performance
            - uuid: c4f382ef370640aa93c265dabe0b6dcd
              name: 'DB [{#DBNAME}]: Detected deadlocks per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.deadlocks.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of detected deadlocks in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.deadlocks
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: deadlocks
                - tag: database
                  value: '{#DBNAME}'
              trigger_prototypes:
                - uuid: 7e9c3fad615448deafbd21abdac7936d
                  expression: 'min(/PostgreSQL by ODBC/pgsql.dbstat.deadlocks.rate["{#DBNAME}"],5m) > {$PG.DEADLOCKS.MAX.WARN:"{#DBNAME}"}'
                  name: 'PostgreSQL: DB [{#DBNAME}]: Deadlock occurred'
                  event_name: 'PostgreSQL: DB [{#DBNAME}]: Deadlock occurred (over {$PG.DEADLOCKS.MAX.WARN:"{#DBNAME}"} in 5m)'
                  priority: HIGH
                  description: 'Number of deadlocks detected per second exceeds {$PG.DEADLOCKS.MAX.WARN:"{#DBNAME}"} for 5m.'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 4e977e75b4044928a75dcdd713be1169
              name: 'DB [{#DBNAME}]: Get dbstat'
              type: DEPENDENT
              key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              history: '0'
              value_type: TEXT
              description: 'Get dbstat metrics for database "{#DBNAME}".'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''{#DBNAME}'']'
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'db.odbc.select[pgsql.dbstat,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: raw
                - tag: database
                  value: '{#DBNAME}'
            - uuid: d65dc8860c6e4e00aca8dfc35c5e3346
              name: 'DB [{#DBNAME}]: Backends connected'
              type: DEPENDENT
              key: 'pgsql.dbstat.numbackends["{#DBNAME}"]'
              description: 'Number of backends currently connected to this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.numbackends
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: backends
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 65ce0c82404340bbb180bdb734573596
              name: 'DB [{#DBNAME}]: Temp_bytes written per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.temp_bytes.rate["{#DBNAME}"]'
              units: B
              description: 'Total amount of data written to temporary files by queries in this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.temp_bytes
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 9b079ed6377841ee87005af6ebaaa830
              name: 'DB [{#DBNAME}]: Temp_files created per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.temp_files.rate["{#DBNAME}"]'
              description: 'Total number of temporary files created by queries in this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.temp_files
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: storage
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 207b2e99c61044e091007f45cceb7088
              name: 'DB [{#DBNAME}]: Tuples deleted per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_deleted.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of rows deleted by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_deleted
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 7e6add2efe2f4cc79982351c448bd921
              name: 'DB [{#DBNAME}]: Tuples fetched per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_fetched.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of rows fetched by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_fetched
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 43bb96408a9e4832b7e272770c989593
              name: 'DB [{#DBNAME}]: Tuples inserted per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_inserted.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of rows inserted by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_inserted
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 638cde24706448d09fa06c9571657a9d
              name: 'DB [{#DBNAME}]: Tuples returned per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_returned.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Number of rows returned by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_returned
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 73f71c2f1b9043b48152e91a3e3c41a1
              name: 'DB [{#DBNAME}]: Tuples updated per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.tup_updated.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of rows updated by queries in this database per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tup_updated
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 7ff29324ad4c48b7b28faaf3e16efbd6
              name: 'DB [{#DBNAME}]: Commits per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.xact_commit.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Number of transactions in this database that have been committed per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.xact_commit
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: transactions
                - tag: database
                  value: '{#DBNAME}'
            - uuid: a840bb06684140c8b70406a7f8b14873
              name: 'DB [{#DBNAME}]: Rollbacks per second'
              type: DEPENDENT
              key: 'pgsql.dbstat.xact_rollback.rate["{#DBNAME}"]'
              value_type: FLOAT
              description: 'Total number of transactions in this database that have been rolled back.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.xact_rollback
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'pgsql.dbstat.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: transactions
                - tag: database
                  value: '{#DBNAME}'
            - uuid: e9fa95b198b14da9b416bd1bc7c00911
              name: 'DB [{#DBNAME}]: Num of accessexclusive locks'
              type: DEPENDENT
              key: 'pgsql.locks.accessexclusive["{#DBNAME}"]'
              description: 'Number of accessexclusive locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.accessexclusive
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: fbc1bb60b8214041b64095672995e8ec
              name: 'DB [{#DBNAME}]: Num of accessshare locks'
              type: DEPENDENT
              key: 'pgsql.locks.accessshare["{#DBNAME}"]'
              description: 'Number of accessshare locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.accessshare
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: a98106f8644b4f77b8e2cf1dc7ed9586
              name: 'DB [{#DBNAME}]: Num of exclusive locks'
              type: DEPENDENT
              key: 'pgsql.locks.exclusive["{#DBNAME}"]'
              description: 'Number of exclusive locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.exclusive
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 350ebc4e054c4290a92293ba625c40dd
              name: 'DB [{#DBNAME}]: Get locks'
              type: DEPENDENT
              key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              history: '0'
              value_type: TEXT
              description: 'Get locks metrics for database "{#DBNAME}".'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''{#DBNAME}'']'
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'db.odbc.select[pgsql.locks,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: raw
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 0abfbce470824232a7516747f6f2714a
              name: 'DB [{#DBNAME}]: Num of rowexclusive locks'
              type: DEPENDENT
              key: 'pgsql.locks.rowexclusive["{#DBNAME}"]'
              description: 'Number of rowexclusive locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.rowexclusive
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 24347f06596f4fc1af2753fbdd0b720c
              name: 'DB [{#DBNAME}]: Num of rowshare locks'
              type: DEPENDENT
              key: 'pgsql.locks.rowshare["{#DBNAME}"]'
              description: 'Number of rowshare locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''{#DBNAME}''].rowshare'
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: dedcbbc9ee234e778b48947561077850
              name: 'DB [{#DBNAME}]: Num of sharerowexclusive locks'
              type: DEPENDENT
              key: 'pgsql.locks.sharerowexclusive["{#DBNAME}"]'
              description: 'Number of total sharerowexclusive for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.sharerowexclusive
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: acaaf4e4ae97426589ea7fe351da0a48
              name: 'DB [{#DBNAME}]: Num of shareupdateexclusive locks'
              type: DEPENDENT
              key: 'pgsql.locks.shareupdateexclusive["{#DBNAME}"]'
              description: 'Number of shareupdateexclusive locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.shareupdateexclusive
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 03df53fbfc2f4ac2a5d0793e0ed14f4c
              name: 'DB [{#DBNAME}]: Num of share locks'
              type: DEPENDENT
              key: 'pgsql.locks.share["{#DBNAME}"]'
              description: 'Number of share locks for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.share
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 02f319126deb4de19d95443304d97c0d
              name: 'DB [{#DBNAME}]: Num of locks total'
              type: DEPENDENT
              key: 'pgsql.locks.total["{#DBNAME}"]'
              description: 'Total number of locks in this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.total
              master_item:
                key: 'pgsql.locks.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: locks
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 16fd0bd835fd4db7b5ebb635780d9fe6
              name: 'DB [{#DBNAME}]: Get queries'
              type: DEPENDENT
              key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              history: '0'
              value_type: TEXT
              description: 'Get queries metrics for database "{#DBNAME}".'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''{#DBNAME}'']'
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'db.odbc.select[pgsql.queries,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: raw
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 100a8f6b18644a308f8117913862dcf4
              name: 'DB [{#DBNAME}]: Queries slow maintenance count'
              type: DEPENDENT
              key: 'pgsql.queries.mro.slow_count["{#DBNAME}"]'
              description: 'Slow maintenance query count for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.mro_slow_count
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: f430eda6eae54a918a03b27f34709f54
              name: 'DB [{#DBNAME}]: Queries max maintenance time'
              type: DEPENDENT
              key: 'pgsql.queries.mro.time_max["{#DBNAME}"]'
              units: s
              description: 'Max maintenance query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.mro_time_max
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 856a7e26192848e1aadb5bdff25cb92a
              name: 'DB [{#DBNAME}]: Queries sum maintenance time'
              type: DEPENDENT
              key: 'pgsql.queries.mro.time_sum["{#DBNAME}"]'
              units: s
              description: 'Sum maintenance query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.mro_time_sum
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: b324beea02f742c381d8241ba1e9382b
              name: 'DB [{#DBNAME}]: Queries slow query count'
              type: DEPENDENT
              key: 'pgsql.queries.query.slow_count["{#DBNAME}"]'
              description: 'Slow query count for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.query_slow_count
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
              trigger_prototypes:
                - uuid: bc790cd8e2c24638ad8a6552af1b9bbe
                  expression: 'min(/PostgreSQL by ODBC/pgsql.queries.query.slow_count["{#DBNAME}"],5m)>{$PG.SLOW_QUERIES.MAX.WARN:"{#DBNAME}"}'
                  name: 'PostgreSQL: DB [{#DBNAME}]: Too many slow queries'
                  event_name: 'PostgreSQL: DB [{#DBNAME}]: Too many slow queries (over {$PG.SLOW_QUERIES.MAX.WARN:"{#DBNAME}"} in 5m)'
                  priority: WARNING
                  description: 'The number of detected slow queries exceeds the limit of {$PG.SLOW_QUERIES.MAX.WARN:"{#DBNAME}"}.'
                  tags:
                    - tag: scope
                      value: performance
            - uuid: 0c0717a146344ec4a7abf4e6c35cb7ae
              name: 'DB [{#DBNAME}]: Queries max query time'
              type: DEPENDENT
              key: 'pgsql.queries.query.time_max["{#DBNAME}"]'
              units: s
              description: 'Max query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.query_time_max
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: e2e686428e2b4f65b7dcbb9a6a3b0f93
              name: 'DB [{#DBNAME}]: Queries sum query time'
              type: DEPENDENT
              key: 'pgsql.queries.query.time_sum["{#DBNAME}"]'
              units: s
              description: 'Sum query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.query_time_sum
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 06fb68c43e0144e8aa85c0acceeafbfc
              name: 'DB [{#DBNAME}]: Queries slow transaction count'
              type: DEPENDENT
              key: 'pgsql.queries.tx.slow_count["{#DBNAME}"]'
              description: 'Slow transaction query count for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tx_slow_count
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: 0eced9bbc0d94332a1ec9fb45913b931
              name: 'DB [{#DBNAME}]: Queries max transaction time'
              type: DEPENDENT
              key: 'pgsql.queries.tx.time_max["{#DBNAME}"]'
              units: s
              description: 'Max transaction query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tx_time_max
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
            - uuid: a51a95891cd849de9eeaa6c4dbcbefbe
              name: 'DB [{#DBNAME}]: Queries sum transaction time'
              type: DEPENDENT
              key: 'pgsql.queries.tx.time_sum["{#DBNAME}"]'
              units: s
              description: 'Sum transaction query time for this database.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.tx_time_sum
              master_item:
                key: 'pgsql.queries.get_metrics["{#DBNAME}"]'
              tags:
                - tag: component
                  value: queries
                - tag: database
                  value: '{#DBNAME}'
          graph_prototypes:
            - uuid: 7b2e7e0542174a7a996bac8014f9a664
              name: 'DB [{#DBNAME}]: Locks'
              graph_items:
                - drawtype: GRADIENT_LINE
                  color: 199C0D
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.locks.total["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.locks.accessexclusive["{#DBNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.locks.accessshare["{#DBNAME}"]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.locks.exclusive["{#DBNAME}"]'
                - sortorder: '4'
                  color: FC6EA3
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.locks.rowexclusive["{#DBNAME}"]'
                - sortorder: '5'
                  color: 6C59DC
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.locks.rowshare["{#DBNAME}"]'
                - sortorder: '6'
                  color: C7A72D
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.locks.sharerowexclusive["{#DBNAME}"]'
                - sortorder: '7'
                  color: BA2A5D
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.locks.shareupdateexclusive["{#DBNAME}"]'
                - sortorder: '8'
                  color: F230E0
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.locks.share["{#DBNAME}"]'
            - uuid: 70065416f33d4a3a9046576a344e965a
              name: 'DB [{#DBNAME}]: Number of bloating tables'
              graph_items:
                - drawtype: GRADIENT_LINE
                  color: 199C0D
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'db.odbc.select[pgsql.db.bloating_tables,,"Database={#DBNAME};{$PG.CONNSTRING.ODBC}"]'
            - uuid: f9162816d4f740dd8e4863c726b64105
              name: 'DB [{#DBNAME}]: pg_stat_database metrics'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.dbstat.blks_hit.rate["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.dbstat.blks_read.rate["{#DBNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.dbstat.conflicts.rate["{#DBNAME}"]'
                - sortorder: '3'
                  color: F7941D
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.dbstat.deadlocks.rate["{#DBNAME}"]'
                - sortorder: '4'
                  color: FC6EA3
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.dbstat.temp_bytes.rate["{#DBNAME}"]'
                - sortorder: '5'
                  color: 6C59DC
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.dbstat.temp_files.rate["{#DBNAME}"]'
                - sortorder: '6'
                  color: C7A72D
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.dbstat.tup_deleted.rate["{#DBNAME}"]'
                - sortorder: '7'
                  color: BA2A5D
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.dbstat.tup_fetched.rate["{#DBNAME}"]'
                - sortorder: '8'
                  color: F230E0
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.dbstat.tup_inserted.rate["{#DBNAME}"]'
                - sortorder: '9'
                  color: 5CCD18
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.dbstat.tup_returned.rate["{#DBNAME}"]'
                - sortorder: '10'
                  color: BB2A02
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.dbstat.tup_updated.rate["{#DBNAME}"]'
                - sortorder: '11'
                  color: AC41A5
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.dbstat.xact_commit.rate["{#DBNAME}"]'
                - sortorder: '12'
                  color: 89ABF8
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.dbstat.xact_rollback.rate["{#DBNAME}"]'
            - uuid: 79b2ba5736054e8a93e70d7af063a0b9
              name: 'DB [{#DBNAME}]: Queries'
              ymin_type_1: FIXED
              graph_items:
                - color: 199C0D
                  yaxisside: RIGHT
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.queries.mro.time_max["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  yaxisside: RIGHT
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.queries.query.time_max["{#DBNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  yaxisside: RIGHT
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.queries.tx.time_max["{#DBNAME}"]'
                - sortorder: '3'
                  drawtype: GRADIENT_LINE
                  color: F7941D
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.queries.mro.time_sum["{#DBNAME}"]'
                - sortorder: '4'
                  drawtype: GRADIENT_LINE
                  color: FC6EA3
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.queries.query.time_sum["{#DBNAME}"]'
                - sortorder: '5'
                  drawtype: GRADIENT_LINE
                  color: 6C59DC
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.queries.tx.time_sum["{#DBNAME}"]'
            - uuid: 7ee8911784824e8380dd07235779a5ea
              name: 'DB [{#DBNAME}]: Size'
              graph_items:
                - drawtype: GRADIENT_LINE
                  color: 199C0D
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'db.odbc.select[pgsql.db.size,,"Database={#DBNAME};{$PG.CONNSTRING.ODBC}"]'
            - uuid: 88a09d63e9214cf1bf8ee82ae485f442
              name: 'DB [{#DBNAME}]: Slow queries'
              ymin_type_1: FIXED
              graph_items:
                - color: 199C0D
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.queries.mro.slow_count["{#DBNAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.queries.query.slow_count["{#DBNAME}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.queries.tx.slow_count["{#DBNAME}"]'
        - uuid: 46a6f3cdfff244a28cb712c4186afc7f
          name: 'Replication discovery'
          type: ODBC
          key: 'db.odbc.select[pgsql.replication.process.discovery,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
          delay: 15m
          params: |
            SELECT json_build_object('data',COALESCE(json_agg(json_build_object('{#APPLICATION_NAME}',application_name)), '[]'))		
            FROM pg_stat_replication
          username: '{$PG.USER}'
          password: '{$PG.PASSWORD}'
          filter:
            evaltype: AND
            conditions:
              - macro: '{#APPLICATION_NAME}'
                value: '{$PG.LLD.FILTER.APPLICATION}'
          description: 'Discovers replication lag metrics.'
          item_prototypes:
            - uuid: 9e7797789d2c47efb9af2c86f8c6a93e
              name: 'Application [{#APPLICATION_NAME}]: Get replication'
              type: DEPENDENT
              key: 'pgsql.replication.get_metrics["{#APPLICATION_NAME}"]'
              history: '0'
              value_type: TEXT
              description: 'Collect metrics from the "pg_stat_replication" about the application "{#APPLICATION_NAME}" that is connected to this WAL sender, which contains information about the WAL sender process, showing statistics about replication to that sender''s connected standby server.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''{#APPLICATION_NAME}'']'
                  error_handler: DISCARD_VALUE
              master_item:
                key: 'db.odbc.select[pgsql.replication.process,,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: application
                  value: '{#APPLICATION_NAME}'
                - tag: component
                  value: raw
            - uuid: 86109b6d1b084de186dcda5d455da992
              name: 'Application [{#APPLICATION_NAME}]: Replication flush lag'
              type: DEPENDENT
              key: 'pgsql.replication.process.flush_lag["{#APPLICATION_NAME}"]'
              value_type: FLOAT
              units: s
              description: 'Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written and flushed it (but not yet applied it). This can be used to gauge the delay that synchronous_commit level on incurred while committing if this server was configured as a synchronous standby.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.flush_lag
              master_item:
                key: 'pgsql.replication.get_metrics["{#APPLICATION_NAME}"]'
              tags:
                - tag: application
                  value: '{#APPLICATION_NAME}'
                - tag: component
                  value: replication
            - uuid: 2cad17fa29c24f0da0fffe962c337f13
              name: 'Application [{#APPLICATION_NAME}]: Replication replay lag'
              type: DEPENDENT
              key: 'pgsql.replication.process.replay_lag["{#APPLICATION_NAME}"]'
              value_type: FLOAT
              units: s
              description: 'Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written, flushed and applied it. This can be used to gauge the delay that synchronous_commit level remote_apply incurred while committing if this server was configured as a synchronous standby.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.replay_lag
              master_item:
                key: 'pgsql.replication.get_metrics["{#APPLICATION_NAME}"]'
              tags:
                - tag: application
                  value: '{#APPLICATION_NAME}'
                - tag: component
                  value: replication
            - uuid: f5f62a5cac254d5eb891beadd6ca950d
              name: 'Application [{#APPLICATION_NAME}]: Replication write lag'
              type: DEPENDENT
              key: 'pgsql.replication.process.write_lag["{#APPLICATION_NAME}"]'
              value_type: FLOAT
              units: s
              description: 'Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written it (but not yet flushed it or applied it). This can be used to gauge the delay that synchronous_commit level remote_write incurred while committing if this server was configured as a synchronous standby.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.write_lag
              master_item:
                key: 'pgsql.replication.get_metrics["{#APPLICATION_NAME}"]'
              tags:
                - tag: application
                  value: '{#APPLICATION_NAME}'
                - tag: component
                  value: replication
          graph_prototypes:
            - uuid: 52b70e3a3691467d8ca7a420d2f7f3c5
              name: 'Application [{#APPLICATION_NAME}]: Replication lag'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.replication.process.flush_lag["{#APPLICATION_NAME}"]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.replication.process.replay_lag["{#APPLICATION_NAME}"]'
                - sortorder: '2'
                  color: 00611C
                  item:
                    host: 'PostgreSQL by ODBC'
                    key: 'pgsql.replication.process.write_lag["{#APPLICATION_NAME}"]'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
        - uuid: fee729c8c626409ba1849e0f6d99392c
          name: 'Bgwriter metrics discovery (versions above 17)'
          type: DEPENDENT
          key: pgsql.bgwriter.above_17.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#BELOW_V17}'
                value: 'false'
          description: 'Discovers "bgwriter" metrics for PostgreSQL version 17 and above.'
          item_prototypes:
            - uuid: 46c4d56f21b24f4face87858445e7b5e
              name: 'Get bgwriter{#SINGLETON}'
              type: ODBC
              key: 'db.odbc.select[pgsql.bgwriter.above_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              history: '0'
              value_type: TEXT
              params: |
                SELECT row_to_json(T) FROM (
                  SELECT
                    psc.num_timed AS checkpoints_timed,
                    psc.num_requested AS checkpoints_req,
                    psc.write_time AS checkpoint_write_time,
                    psc.sync_time AS checkpoint_sync_time,
                    psc.buffers_written AS buffers_checkpoint,
                    psb.buffers_clean AS buffers_clean,
                    psb.maxwritten_clean AS maxwritten_clean,
                    psb.buffers_alloc AS buffers_alloc
                  FROM
                    pg_stat_checkpointer AS psc,
                    pg_stat_bgwriter AS psb
                ) T
              username: '{$PG.USER}'
              password: '{$PG.PASSWORD}'
              description: |
                Collect all metrics from pg_stat_bgwriter:
                https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-BGWRITER-VIEW
              tags:
                - tag: component
                  value: raw
            - uuid: 7c2521a1c02240d6846344cc447ffd45
              name: 'Bgwriter: Buffers allocated per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.buffers_alloc.rate.above_17[{#SINGLETON}]'
              value_type: FLOAT
              description: 'Number of buffers allocated per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.buffers_alloc
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.above_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
            - uuid: 52123eb6463b4d7d990a66398d773e0c
              name: 'Checkpoint: Buffers written during checkpoints per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.buffers_checkpoint.rate.above_17[{#SINGLETON}]'
              value_type: FLOAT
              description: 'Number of buffers written during checkpoints per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.buffers_checkpoint
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.above_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
            - uuid: e29ed04f09044901a25e3865acf98965
              name: 'Checkpoint: Buffers written by the background writer per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.buffers_clean.rate.above_17[{#SINGLETON}]'
              value_type: FLOAT
              description: 'Number of buffers written by the background writer per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.buffers_clean
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.above_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
            - uuid: 28219abecf7a44ff948ce97840263b41
              name: 'Checkpoint: Requested per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.checkpoints_req.rate.above_17[{#SINGLETON}]'
              value_type: FLOAT
              description: 'Number of requested checkpoints that have been performed per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.checkpoints_req
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.above_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
            - uuid: 8065cdd159d84ea69b99983abf0d6beb
              name: 'Checkpoint: Scheduled per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.checkpoints_timed.rate.above_17[{#SINGLETON}]'
              value_type: FLOAT
              description: 'Number of scheduled checkpoints that have been performed per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.checkpoints_timed
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.above_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
            - uuid: 5a5d84878d22478aa856228b4486b55d
              name: 'Bgwriter: Checkpoint sync time per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.checkpoint_sync_time.rate.above_17[{#SINGLETON}]'
              value_type: FLOAT
              units: s
              description: 'Total amount of time per second that has been spent in the portion of checkpoint processing where files are synchronized to disk.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.checkpoint_sync_time
                - type: MULTIPLIER
                  parameters:
                    - '0.001'
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.above_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
            - uuid: a84ae8aceaf44abaa33d925757b71b8f
              name: 'Checkpoint: Checkpoint write time per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.checkpoint_write_time.rate.above_17[{#SINGLETON}]'
              value_type: FLOAT
              units: s
              description: 'Total amount of time per second that has been spent in the portion of checkpoint processing where files are written to disk.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.checkpoint_write_time
                - type: MULTIPLIER
                  parameters:
                    - '0.001'
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.above_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
            - uuid: 70d6cea0481741d08a572e732b3e237d
              name: 'Bgwriter: Number of bgwriter cleaning scan stopped per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.maxwritten_clean.rate.above_17[{#SINGLETON}]'
              value_type: FLOAT
              description: 'Number of times the background writer stopped a cleaning scan because it had written too many buffers per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.maxwritten_clean
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.above_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
          master_item:
            key: pgsql.bgwriter.lld
        - uuid: fcbd89dc14aa4bd99446016d453f850d
          name: 'Bgwriter metrics discovery (versions below 17)'
          type: DEPENDENT
          key: pgsql.bgwriter.below_17.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#BELOW_V17}'
                value: 'true'
          description: 'Discovers "bgwriter" metrics for PostgreSQL below version 17.'
          item_prototypes:
            - uuid: 777e615655634c8bae2e13cef153314b
              name: 'Get bgwriter{#SINGLETON}'
              type: ODBC
              key: 'db.odbc.select[pgsql.bgwriter.below_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              history: '0'
              value_type: TEXT
              params: |
                SELECT row_to_json(T) FROM (
                  SELECT checkpoints_timed,
                    checkpoints_req,
                    checkpoint_write_time,
                    checkpoint_sync_time,
                    buffers_checkpoint AS buffers_checkpoint,
                    buffers_clean AS buffers_clean,
                    maxwritten_clean,
                    buffers_backend AS buffers_backend,
                    buffers_backend_fsync,
                    buffers_alloc AS buffers_alloc
                  FROM pg_stat_bgwriter) T
              username: '{$PG.USER}'
              password: '{$PG.PASSWORD}'
              description: |
                Collect all metrics from pg_stat_bgwriter:
                https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-BGWRITER-VIEW
              tags:
                - tag: component
                  value: raw
            - uuid: cc397d603cec450593a9871dd39e6db6
              name: 'Bgwriter: Buffers allocated per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.buffers_alloc.rate.below_17[{#SINGLETON}]'
              value_type: FLOAT
              description: 'Number of buffers allocated per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.buffers_alloc
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.below_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
            - uuid: 09f43b8bf08c41839ef48f8aefc5dd39
              name: 'Bgwriter: Buffers written directly by a backend per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.buffers_backend.rate.below_17[{#SINGLETON}]'
              value_type: FLOAT
              description: 'Number of buffers written directly by a backend per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.buffers_backend
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.below_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
            - uuid: b734c475147040bfa431390e6b524f4c
              name: 'Bgwriter: Times a backend executed its own fsync per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.buffers_backend_fsync.rate.below_17[{#SINGLETON}]'
              value_type: FLOAT
              description: 'Number of times a backend had to execute its own fsync call per second (normally the background writer handles those even when the backend does its own write).'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.buffers_backend_fsync
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.below_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
            - uuid: 38ea04f3a47f4dcda9b61c6866c0efe3
              name: 'Checkpoint: Buffers written during checkpoints per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.buffers_checkpoint.rate.below_17[{#SINGLETON}]'
              value_type: FLOAT
              description: 'Number of buffers written during checkpoints per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.buffers_checkpoint
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.below_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
            - uuid: 9cf1b0c328d34490a66f79b32be20efd
              name: 'Checkpoint: Buffers written by the background writer per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.buffers_clean.rate.below_17[{#SINGLETON}]'
              value_type: FLOAT
              description: 'Number of buffers written by the background writer per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.buffers_clean
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.below_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
            - uuid: 05340503596c48b7b3e7ce763e1b22ef
              name: 'Checkpoint: Requested per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.checkpoints_req.rate.below_17[{#SINGLETON}]'
              value_type: FLOAT
              description: 'Number of requested checkpoints that have been performed per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.checkpoints_req
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.below_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
            - uuid: 18f66c4149444c7b8b0190ac74488859
              name: 'Checkpoint: Scheduled per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.checkpoints_timed.rate.below_17[{#SINGLETON}]'
              value_type: FLOAT
              description: 'Number of scheduled checkpoints that have been performed per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.checkpoints_timed
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.below_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
            - uuid: e7d10f58ada9468abc4ad7b4a9900c1c
              name: 'Bgwriter: Checkpoint sync time per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.checkpoint_sync_time.rate.below_17[{#SINGLETON}]'
              value_type: FLOAT
              units: s
              description: 'Total amount of time per second that has been spent in the portion of checkpoint processing where files are synchronized to disk.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.checkpoint_sync_time
                - type: MULTIPLIER
                  parameters:
                    - '0.001'
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.below_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
            - uuid: c7810e79f2d94f0e9a4f462d76b10a24
              name: 'Checkpoint: Checkpoint write time per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.checkpoint_write_time.rate.below_17[{#SINGLETON}]'
              value_type: FLOAT
              units: s
              description: 'Total amount of time per second that has been spent in the portion of checkpoint processing where files are written to disk.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.checkpoint_write_time
                - type: MULTIPLIER
                  parameters:
                    - '0.001'
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.below_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
            - uuid: 987ad2df6df14f1eabe2b1c6eb6713fc
              name: 'Bgwriter: Number of bgwriter cleaning scan stopped per second{#SINGLETON}'
              type: DEPENDENT
              key: 'pgsql.bgwriter.maxwritten_clean.rate.below_17[{#SINGLETON}]'
              value_type: FLOAT
              description: 'Number of times the background writer stopped a cleaning scan because it had written too many buffers per second.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.maxwritten_clean
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'db.odbc.select[pgsql.bgwriter.below_17{#SINGLETON},,"Database={$PG.DATABASE};{$PG.CONNSTRING.ODBC}"]'
              tags:
                - tag: component
                  value: bgwriter
          master_item:
            key: pgsql.bgwriter.lld
      tags:
        - tag: class
          value: database
        - tag: subclass
          value: sql
        - tag: target
          value: postgresql
      macros:
        - macro: '{$PG.CONFLICTS.MAX.WARN}'
          value: '0'
          description: 'Maximum number of recovery conflicts for trigger expression.'
          config:
            type: TEXT
            priority: '9'
            section_name: Thresholds
            label: 'Maximum number of recovery conflicts'
            description: 'Maximum number of recovery conflicts for trigger expression. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.CONNSTRING.ODBC}'
          value: Servername=localhost;Port=5432;Driver=/usr/lib64/psqlodbcw.so
          description: 'Connection string for the PostgreSQL instance.'
          config:
            type: TEXT
            priority: '1'
            label: 'PostgreSQL connection string'
            description: 'Connection string for the PostgreSQL instance.'
            required: 'YES'
        - macro: '{$PG.CONN_TOTAL_PCT.MAX.WARN}'
          value: '90'
          description: 'Maximum percentage of current connections for trigger expression.'
          config:
            type: TEXT
            priority: '8'
            section_name: Thresholds
            label: 'Maximum percentage of current connections'
            description: 'Maximum percentage of current connections for trigger expression. In the range from 0 to 100 inclusive.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.DATABASE}'
          value: postgres
          description: 'Default PostgreSQL database for the connection.'
          config:
            type: TEXT
            priority: '4'
            label: 'Default PostgreSQL database for the connection'
            description: 'Default PostgreSQL database.'
            required: 'YES'
        - macro: '{$PG.DEADLOCKS.MAX.WARN}'
          value: '0'
          description: 'Maximum number of detected deadlocks for trigger expression.'
          config:
            type: TEXT
            priority: '7'
            section_name: Thresholds
            label: 'Maximum number of detected deadlocks'
            description: 'Maximum number of detected deadlocks for trigger expression. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.LLD.FILTER.APPLICATION}'
          value: .+
          description: 'Filter of discoverable applications.'
          config:
            type: TEXT
            priority: '6'
            section_name: Filters
            label: 'Applications LLD filter'
            description: 'Filter of discoverable applications.'
        - macro: '{$PG.LLD.FILTER.DBNAME}'
          value: .+
          description: 'Filter of discoverable databases.'
          config:
            type: TEXT
            priority: '5'
            section_name: Filters
            label: 'Database name LLD filter'
            description: 'Filter of discoverable databases.'
        - macro: '{$PG.PASSWORD}'
          type: SECRET_TEXT
          description: 'PostgreSQL user password.'
          config:
            type: TEXT
            priority: '3'
            label: 'PostgreSQL user password'
            description: 'PostgreSQL password.'
            required: 'YES'
        - macro: '{$PG.QUERY_ETIME.MAX.WARN}'
          value: '30'
          description: 'Execution time limit for count of slow queries.'
          config:
            type: TEXT
            priority: '10'
            section_name: Thresholds
            label: 'Slow queries execution time threshold'
            description: 'Execution time threshold for queries to be considered slow. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.SLOW_QUERIES.MAX.WARN}'
          value: '5'
          description: 'Slow queries count threshold for a trigger.'
          config:
            type: TEXT
            priority: '11'
            section_name: Thresholds
            label: 'Slow queries count threshold'
            description: 'Slow queries count threshold for a trigger. No less than 0.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$PG.USER}'
          value: zbx_monitor
          description: 'PostgreSQL username.'
          config:
            type: TEXT
            priority: '2'
            label: 'PostgreSQL username'
            description: 'PostgreSQL username.'
            required: 'YES'
      dashboards:
        - uuid: 6f15f8b6e90b4d09b9e1d4fb323ac438
          name: 'PostgreSQL databases'
          pages:
            - widgets:
                - type: graphprototype
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by ODBC'
                        name: 'DB [{#DBNAME}]: pg_stat_database metrics'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: graphprototype
                  'y': '5'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by ODBC'
                        name: 'DB [{#DBNAME}]: Size'
                    - type: STRING
                      name: reference
                      value: AAAAC
                - type: graphprototype
                  'y': '10'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by ODBC'
                        name: 'DB [{#DBNAME}]: Queries'
                    - type: STRING
                      name: reference
                      value: AAAAE
                - type: graphprototype
                  x: '36'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by ODBC'
                        name: 'DB [{#DBNAME}]: Locks'
                    - type: STRING
                      name: reference
                      value: AAAAB
                - type: graphprototype
                  x: '36'
                  'y': '5'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by ODBC'
                        name: 'DB [{#DBNAME}]: Number of bloating tables'
                    - type: STRING
                      name: reference
                      value: AAAAD
                - type: graphprototype
                  x: '36'
                  'y': '10'
                  width: '36'
                  height: '5'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'PostgreSQL by ODBC'
                        name: 'DB [{#DBNAME}]: Slow queries'
                    - type: STRING
                      name: reference
                      value: AAAAF
      valuemaps:
        - uuid: 6e5062ae5345454f95cb8608b35eddf4
          name: 'PostgreSQL recovery role'
          mappings:
            - value: '0'
              newvalue: Master
            - value: '1'
              newvalue: Standby
        - uuid: 75393338fb514612a5f0ba57cec318b3
          name: 'PostgreSQL replication status'
          mappings:
            - value: '0'
              newvalue: Down
            - value: '1'
              newvalue: Up
            - value: '2'
              newvalue: Master
        - uuid: f2af00a32d1e471a98b9e4e6148f68f3
          name: 'Service state'
          mappings:
            - value: '0'
              newvalue: Down
            - value: '1'
              newvalue: Up
  triggers:
    - uuid: 33ce7cc965e44a519ef57b22a6d7c3c9
      expression: |
        length(last(/GitHub organization by HTTP/github.org.copilot.data_get.check))>0 or length(last(/GitHub organization by HTTP/github.org.repo.get.check))>0 or 
        length(last(/GitHub organization by HTTP/github.org.copilot.billing_get.check))>0
      name: 'GitHub: There are errors in requests to API'
      priority: AVERAGE
      description: 'Errors have been received in response to API requests. Check the latest values for details.'
      tags:
        - tag: scope
          value: availability
  graphs:
    - uuid: 749ed49ec625449db0a345d639f7d8fd
      name: 'Kubernetes API: HTTP requests rate'
      graph_items:
        - color: 199C0D
          item:
            host: 'Kubernetes API server by HTTP'
            key: kubernetes.api.apiserver_request_total_200.rate
        - sortorder: '1'
          color: F63100
          item:
            host: 'Kubernetes API server by HTTP'
            key: kubernetes.api.rest_client_requests_total_200.rate
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Kubernetes API server by HTTP'
            key: kubernetes.api.apiserver_request_total_300.rate
        - sortorder: '3'
          color: F7941D
          item:
            host: 'Kubernetes API server by HTTP'
            key: kubernetes.api.rest_client_requests_total_300.rate
        - sortorder: '4'
          color: FC6EA3
          item:
            host: 'Kubernetes API server by HTTP'
            key: kubernetes.api.apiserver_request_total_400.rate
        - sortorder: '5'
          color: 6C59DC
          item:
            host: 'Kubernetes API server by HTTP'
            key: kubernetes.api.rest_client_requests_total_400.rate
        - sortorder: '6'
          color: C7A72D
          item:
            host: 'Kubernetes API server by HTTP'
            key: kubernetes.api.apiserver_request_total_500.rate
        - sortorder: '7'
          color: BA2A5D
          item:
            host: 'Kubernetes API server by HTTP'
            key: kubernetes.api.rest_client_requests_total_500.rate
        - sortorder: '8'
          color: F230E0
          item:
            host: 'Kubernetes API server by HTTP'
            key: kubernetes.api.apiserver_request_total_0.rate
    - uuid: 23af35d1d9af40e2ace1915ab8df7eec
      name: 'Kubernetes Controller Manager: Memory usage'
      graph_items:
        - color: 199C0D
          item:
            host: 'Kubernetes Controller manager by HTTP'
            key: kubernetes.controller.process_virtual_memory_bytes
        - sortorder: '1'
          color: F63100
          item:
            host: 'Kubernetes Controller manager by HTTP'
            key: kubernetes.controller.process_resident_memory_bytes
    - uuid: 908af34b10044af9b028e5e024eb89b3
      name: 'Kubernetes Controller Manager: REST Client query rate'
      graph_items:
        - color: 199C0D
          item:
            host: 'Kubernetes Controller manager by HTTP'
            key: kubernetes.controller.client_http_requests_500.rate
        - sortorder: '1'
          color: F63100
          item:
            host: 'Kubernetes Controller manager by HTTP'
            key: kubernetes.controller.client_http_requests_400.rate
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Kubernetes Controller manager by HTTP'
            key: kubernetes.controller.client_http_requests_300.rate
        - sortorder: '3'
          color: F7941D
          item:
            host: 'Kubernetes Controller manager by HTTP'
            key: kubernetes.controller.client_http_requests_200.rate
    - uuid: dd98f209541449f4a476718c46a0e721
      name: 'Kubernetes Scheduler: Memory usage'
      graph_items:
        - color: 199C0D
          item:
            host: 'Kubernetes Scheduler by HTTP'
            key: kubernetes.scheduler.process_virtual_memory_bytes
        - sortorder: '1'
          color: F63100
          item:
            host: 'Kubernetes Scheduler by HTTP'
            key: kubernetes.scheduler.process_resident_memory_bytes
    - uuid: fd57f67690424eb6a2e5bee610c305ad
      name: 'Kubernetes Scheduler: REST Client query rate'
      graph_items:
        - color: 199C0D
          item:
            host: 'Kubernetes Scheduler by HTTP'
            key: kubernetes.scheduler.client_http_requests_500.rate
        - sortorder: '1'
          color: F63100
          item:
            host: 'Kubernetes Scheduler by HTTP'
            key: kubernetes.scheduler.client_http_requests_400.rate
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Kubernetes Scheduler by HTTP'
            key: kubernetes.scheduler.client_http_requests_300.rate
        - sortorder: '3'
          color: F7941D
          item:
            host: 'Kubernetes Scheduler by HTTP'
            key: kubernetes.scheduler.client_http_requests_200.rate
    - uuid: 4ee3ca9852a2440ea100e21291ac9103
      name: 'Kubernetes Scheduler: Scheduling attempts rate'
      graph_items:
        - color: 199C0D
          item:
            host: 'Kubernetes Scheduler by HTTP'
            key: kubernetes.scheduler.scheduler_schedule_attempts.scheduled.rate
        - sortorder: '1'
          color: F63100
          item:
            host: 'Kubernetes Scheduler by HTTP'
            key: kubernetes.scheduler.scheduler_schedule_attempts.unschedulable.rate
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Kubernetes Scheduler by HTTP'
            key: kubernetes.scheduler.scheduler_schedule_attempts.error.rate
    - uuid: 774218efca844a978b61077f0e253ddf
      name: 'Number of issues'
      graph_items:
        - color: 199C0D
          item:
            host: 'GitHub repository by HTTP'
            key: github.repo.issues.total
        - sortorder: '1'
          color: F63100
          item:
            host: 'GitHub repository by HTTP'
            key: github.repo.issues.open
        - sortorder: '2'
          color: 00611C
          item:
            host: 'GitHub repository by HTTP'
            key: github.repo.issues.closed
    - uuid: a6de9d61e5f74a5f97946792c7c101fe
      name: 'Number of PRs'
      graph_items:
        - color: 199C0D
          item:
            host: 'GitHub repository by HTTP'
            key: github.repo.pr.total
        - sortorder: '1'
          color: F63100
          item:
            host: 'GitHub repository by HTTP'
            key: github.repo.pr.open
        - sortorder: '2'
          color: 00611C
          item:
            host: 'GitHub repository by HTTP'
            key: github.repo.pr.closed
    - uuid: 794cb86105c14f1aab297634292d8b67
      name: 'Number of releases and tags'
      graph_items:
        - color: 199C0D
          item:
            host: 'GitHub repository by HTTP'
            key: github.repo.releases.count
        - sortorder: '1'
          color: F63100
          item:
            host: 'GitHub repository by HTTP'
            key: github.repo.tags.count
    - uuid: 94173b91d3bf40a6a9188f0efecaabdd
      name: 'Requests limit usage'
      graph_items:
        - color: 199C0D
          item:
            host: 'GitHub repository by HTTP'
            key: github.repo.requests.limit
        - sortorder: '1'
          color: F63100
          item:
            host: 'GitHub repository by HTTP'
            key: github.repo.requests.used
    - uuid: 7e33e0dd5faa45418defd8e5e7f07e49
      name: 'Requests limit utilization, in %'
      ymin_type_1: FIXED
      ymax_type_1: FIXED
      graph_items:
        - color: 199C0D
          item:
            host: 'GitHub repository by HTTP'
            key: github.repo.requests.util
