zabbix_export:
  version: '7.0'
  template_groups:
    - uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
      name: Templates/Applications
  templates:
    - uuid: 5a61a243b96a48f7ab46642ce2ffc02e
      template: 'Kubernetes namespaces by HTTP Prometheus'
      name: 'Kubernetes namespaces by HTTP Prometheus'
      description: |
        Get Kubernetes namespaces metrics by HTTP.
        Metrics are collected by requests to Kubernetes API.
      groups:
        - name: Templates/Applications
      items:
        - uuid: ec98b7bf3430448198138b8b7d811423
          name: 'Get cAdvisor metrics'
          type: DEPENDENT
          key: get.cadvisor.metrics
          delay: '0'
          history: '0'
          value_type: TEXT
          trends: '0'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.nodes
            - type: JAVASCRIPT
              parameters:
                - |
                  var Kube = {
                  
                  	apiRequest: function (query) {
                  		var request = new HttpRequest();
                  		request.addHeader('Authorization: Bearer ' + '{$KUBE.API.TOKEN}');
                  		response = request.get(query + '/metrics/cadvisor');
                  
                  		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;
                  		}
                  		return response;
                  	}
                  }
                  
                  try {
                  	var nodes = JSON.parse(value);
                  	var allResponses = '';
                  	for (var i = 0; i < nodes.length; i++){
                  	    var url = nodes[i].filternode.kubeletURL;
                  	    var response = Kube.apiRequest(url);
                  	    allResponses += response + '\n';
                  	}
                  	return allResponses;
                  }
                  catch (error) {
                  	error += (String(error).endsWith('.')) ? '' : '.';
                  	Zabbix.log(3, '[ Kubernetes ] ERROR: ' + error);
                  	return JSON.stringify({ error: error });
                  }
          master_item:
            key: kube.nodes
          tags:
            - tag: component
              value: raw
        - uuid: b631f6073d654c2a8535b50340c80b9e
          name: 'Kubernetes: Get nodes'
          type: SCRIPT
          key: kube.nodes
          delay: 0;s00
          history: '0'
          value_type: TEXT
          trends: '0'
          params: |
            var Kube = {
            	params: {},
            	pods_limit: 1000,
            
            	setParams: function (params) {
            		['api_token', 'api_url'].forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined'
            				|| params[field] === '') {
            				throw 'Required param is not set: "' + field + '".';
            			}
            		});
            		['pod_filter_labels', 'pod_filter_annotations', 'namespace_name', 'kubelet_scheme', 'kubelet_port'].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);
            
            		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'),
            			output = [];
            		if (typeof result !== 'object'
            			|| typeof result.items === 'undefined') {
            			throw 'Cannot get nodes from Kubernetes API. Check debug log for more information.';
            		}
            
            		result.items.forEach(function (filternode) {
            			Zabbix.log(4, '[ Kubernetes ] Filtered node "' + filternode.metadata.name + '"');
            
            			output.push({
            				filternode
            			});
            		});
            
            		return output;
            	},
            
            	getPods: function () {
            		var result = [],
            			continue_token,
            			Pods = [];
            
            		while (continue_token !== '') {
            			var data = Kube.apiRequest('api/v1/namespaces/' + Kube.params.namespace_name + '/pods?limit=' + Kube.pods_limit
            				+ ((typeof continue_token !== 'undefined') ? '&continue=' + continue_token : ''));
            
            			if (typeof data !== 'object'
            				|| typeof data.items === 'undefined') {
            				throw 'Cannot get pods from Kubernetes API. Check debug log for more information.';
            			};
            
            			result.push.apply(result, data.items);
            			continue_token = data.metadata.continue || '';
            		}
            		result.forEach(function (pod) {
            
            			var containers = {
            				limits: { cpu: 0, memory: 0 },
            				requests: { cpu: 0, memory: 0 },
            				restartCount: 0
            			},
            				containerStatuses = [{ restartCount: 0 }];
            
            			if (typeof pod.status.hostIP === 'object'
            				|| typeof pod.status.hostIP === 'undefined') {
            				pod.status.hostIP = 'none';
            			};
            
            			Kube.getField(pod, 'spec.containers').forEach(function (container) {
            				var limits = container.resources.limits,
            					requests = container.resources.requests;
            
            				if (typeof limits !== 'undefined') {
            					containers.limits.cpu += Fmt.cpuFormat(limits.cpu);
            					containers.limits.memory += Fmt.memoryFormat(limits.memory);
            				}
            
            				if (typeof requests !== 'undefined') {
            					containers.requests.cpu += Fmt.cpuFormat(requests.cpu);
            					containers.requests.memory += Fmt.memoryFormat(requests.memory);
            				}
            			});
            
            			if (typeof pod.status.containerStatuses !== 'object'
            				|| typeof pod.status.containerStatuses === 'undefined') {
            				pod.status.containerStatuses = containerStatuses;
            			};
            			pod.status.containerStatuses.forEach(function (container) {
            				containers.restartCount += container.restartCount;
            
            			});
            
            			Pods.push({
            				'name': pod.metadata.name,
            				'nodeIP': pod.status.hostIP,
            				'namespace': pod.metadata.namespace,
            				'labels': pod.metadata.labels,
            				'annotations': pod.metadata.annotations,
            				'phase': pod.status.phase,
            				'conditions': pod.status.conditions,
            				'startTime': pod.status.startTime,
            				'containers': containers,
            				'hostname': 'none'
            			})
            		});
            		return Pods;
            	},
            },
            
            	Fmt = {
            		factors: {
            			Ki: 1024, K: 1000,
            			Mi: 1024 ** 2, M: 1000 ** 2,
            			Gi: 1024 ** 3, G: 1000 ** 3,
            			Ti: 1024 ** 4, T: 1000 ** 4,
            		},
            
            		cpuFormat: function (cpu) {
            			if (typeof cpu === 'undefined') {
            				return 0;
            			}
            
            			if (cpu.indexOf('m') > -1) {
            				return parseInt(cpu) / 1000;
            			}
            
            			return parseInt(cpu);
            		},
            
            		memoryFormat: function (mem) {
            			if (typeof mem === 'undefined') {
            				return 0;
            			}
            
            			var pair,
            				factor;
            
            			if (pair = mem.match(/(\d+)(\w*)/)) {
            				if (factor = Fmt.factors[pair[2]]) {
            					return parseInt(pair[1]) * factor;
            				}
            
            				return mem;
            			}
            
            			return parseInt(mem);
            		}
            
            	}
            
            try {
            	Kube.setParams(JSON.parse(value));
            
            	var nodes = Kube.getNodes(),
            		IPv4 = /(?:\d{1,3}\.){3}\d{1,3}/,
            		pods = Kube.getPods(),
            		Pods = [],
            		hostname = Kube.params.api_url.match(/https?:\/\/([\w.-]+|\[[a-f0-9:]+\]|[^a-zA-Z:]+)(?::\d+)?/),
            		filterPodLabels = Kube.parseFilters(Kube.params.pod_filter_labels),
            		filterPodAnnotations = Kube.parseFilters(Kube.params.pod_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.';
            	};
            	for (idx in nodes) {
            		var nodePodsCount = 0,
            			endpointpod = [],
            			roles = [];
            		Object.keys(nodes[idx].filternode.metadata.labels).forEach(function (label) {
            			var splitLabel = label.match(/^node-role.kubernetes.io\/([\w\.-]+)/);
            
            			if (splitLabel) {
            				roles.push(splitLabel[1]);
            			}
            		});
            		var internalIPs = Kube.getField(nodes[idx].filternode, 'status.addresses').filter(function (addr) {
            			return addr.type === 'InternalIP';
            		});
            		var internalIP = internalIPs.length && internalIPs[0].address;
            
            		var Hostname = Kube.getField(nodes[idx].filternode, 'status.addresses').filter(function (addr) {
            			return addr.type === 'Hostname';
            		});
            		var Hostname = Hostname.length && Hostname[0].address;
            
            		pods.forEach(function (pod) {
            			if (pod.nodeIP !== internalIP) {
            				return;
            			}
            			nodePodsCount++;
            			pod.hostname = Hostname;
            			Pods = pods.filter(function (f) {
            				return (f.hostname !== 'none' || f.phase === 'Pending') && (
            					Kube.filter(f.name, f.labels, filterPodLabels)
            					&& Kube.filter(f.name, f.annotations, filterPodAnnotations)
            				);
            			}
            			)
            		});
            
            		delete nodes[idx].filternode.metadata.managedFields;
            		delete nodes[idx].filternode.status.images;
            		nodes[idx].filternode.status.capacity.cpu = Fmt.cpuFormat(nodes[idx].filternode.status.capacity.cpu);
            		nodes[idx].filternode.status.capacity.memory = Fmt.memoryFormat(nodes[idx].filternode.status.capacity.memory);
            		nodes[idx].filternode.status.allocatable.cpu = Fmt.cpuFormat(nodes[idx].filternode.status.allocatable.cpu);
            		nodes[idx].filternode.status.allocatable.memory = Fmt.memoryFormat(nodes[idx].filternode.status.allocatable.memory);
            		nodes[idx].filternode.status.podsCount = nodePodsCount;
            		nodes[idx].filternode.status.roles = roles.join(', ');
            		nodes[idx].filternode.internalIP = internalIP;
            		nodes[idx].filternode.clusterhostname = hostname[1];
            		nodes[idx].filternode.kubeletURL = Kube.params.kubelet_scheme + '://' + (IPv4.test(internalIP) ? internalIP : '[' + internalIP + ']') + ':' + Kube.params.kubelet_port;
            
            	}
            
            	return JSON.stringify({ nodes, Pods });
            }
            catch (error) {
            	error += (String(error).endsWith('.')) ? '' : '.';
            	Zabbix.log(3, '[ Kubernetes ] ERROR: ' + error);
            	return JSON.stringify({ error: error });
            }
          description: 'Collecting and processing cluster nodes data via Kubernetes API.'
          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: namespace_name
              value: '{$NAMESPACE.NAME}'
            - name: pod_filter_annotations
              value: '{$KUBE.POD.FILTER.ANNOTATIONS}'
            - name: pod_filter_labels
              value: '{$KUBE.POD.FILTER.LABELS}'
          tags:
            - tag: component
              value: raw
        - uuid: 815e9e697cea448a990a4492cefd7e6b
          name: 'Kubernetes: Get state metrics'
          type: SCRIPT
          key: kube.state.metrics
          history: '0'
          value_type: TEXT
          trends: '0'
          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
      discovery_rules:
        - uuid: f7ad80736064484da4b3b560b71abb92
          name: 'Network and storage discovery'
          type: DEPENDENT
          key: kube.network.and.storage.discovery
          delay: '0'
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAMESPACE}'
                value: '^{$NAMESPACE.NAME}$'
                formulaid: A
          lifetime: 30d
          enabled_lifetime_type: DISABLE_NEVER
          description: 'Get network and storage statistics for namespace.'
          item_prototypes:
            - uuid: 144a7b27486541b69a9daefd8929a5f4
              name: 'Kubernetes: Bytes received (bps)'
              type: DEPENDENT
              key: 'kube.bytes.received.bps[{#NAMESPACE}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: bps
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'container_network_receive_bytes_total{namespace="{#NAMESPACE}"}'
                    - function
                    - sum
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
                - type: CHANGE_PER_SECOND
                  parameters:
                    - ''
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 5m
              master_item:
                key: get.cadvisor.metrics
              tags:
                - tag: component
                  value: network
            - uuid: 6e4bc5273794470eacf14190dbe86150
              name: 'Kubernetes: Bytes transmitted (bps)'
              type: DEPENDENT
              key: 'kube.bytes.transmitted.bps[{#NAMESPACE}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: bps
              preprocessing:
                - type: PROMETHEUS_PATTERN
                  parameters:
                    - 'container_network_transmit_bytes_total{namespace="{#NAMESPACE}"}'
                    - function
                    - sum
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
                - type: CHANGE_PER_SECOND
                  parameters:
                    - ''
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 5m
              master_item:
                key: get.cadvisor.metrics
              tags:
                - tag: component
                  value: network
          master_item:
            key: kube.state.metrics
          lld_macro_paths:
            - lld_macro: '{#NAMESPACE}'
              path: $.namespace
          preprocessing:
            - type: PROMETHEUS_TO_JSON
              parameters:
                - kube_namespace_created
            - type: JSONPATH
              parameters:
                - $..labels
      tags:
        - tag: class
          value: software
        - tag: target
          value: kubernetes
        - tag: target
          value: nodes
      macros:
        - macro: '{$KUBE.API.TOKEN}'
          description: 'Service account bearer token.'
        - macro: '{$KUBE.API.URL}'
          value: 'https://kubernetes.default.svc.cluster.local:443'
          description: 'Kubernetes API endpoint URL in the format <scheme>://<host>:<port>'
        - macro: '{$KUBE.HTTP.PROXY}'
          description: 'Sets the HTTP proxy to `http_proxy` value. If this parameter is empty, then no proxy is used.'
        - macro: '{$KUBE.KUBELET.PORT}'
          value: '10250'
          description: 'Kubernetes Kubelet metrics endpoint port. Used in Kubelet LLD.'
        - macro: '{$KUBE.KUBELET.SCHEME}'
          value: https
          description: 'Kubernetes Kubelet metrics endpoint scheme. Used in Kubelet LLD.'
        - macro: '{$KUBE.LLD.FILTER.NODE.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable nodes.'
        - macro: '{$KUBE.LLD.FILTER.NODE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter to exclude discovered nodes.'
        - macro: '{$KUBE.POD.FILTER.ANNOTATIONS}'
          description: 'Annotations to filter pods (regex in values are supported). See the template''s README.md for details.'
        - macro: '{$KUBE.POD.FILTER.LABELS}'
          description: 'Labels to filter Pods (regex in values are supported). See the template''s README.md for details.'
        - 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.'
        - macro: '{$KUBE.STATE.ENDPOINT.NAME}'
          value: zabbix-kube-state-metrics
          description: 'Kubernetes state endpoint name.'
        - macro: '{$NAMESPACE.NAME}'
          description: 'Namespace name.'
        - macro: '{$OPENSHIFT.STATE.ENDPOINT.NAME}'
          value: openshift-state-metrics
          description: 'OpenShift state endpoint name.'
      valuemaps:
        - uuid: 85f157e42ecc49bb98c85762d195dff4
          name: 'Namespace phase'
          mappings:
            - value: '1'
              newvalue: Active
            - value: '2'
              newvalue: Terminating
        - uuid: 7703d987e3bd40c68f51f10b3efb3bd7
          name: 'Pod conditions'
          mappings:
            - value: '1'
              newvalue: 'True'
            - value: '2'
              newvalue: 'False'
            - value: '3'
              newvalue: Unknown
        - uuid: 75d710a40e4942eea049de295f60ed05
          name: 'Pod phase'
          mappings:
            - value: '1'
              newvalue: Pending
            - value: '2'
              newvalue: Running
            - value: '3'
              newvalue: Succeeded
            - value: '4'
              newvalue: Failed
            - value: '5'
              newvalue: Unknown
