zabbix_export:
  version: '7.4'
  template_groups:
    - uuid: c2c162144c2d4c5491c8801193af4945
      name: Templates/Cloud
  host_groups:
    - uuid: 137f19e6e2dc4219b33553b812627bc2
      name: 'Virtual machines'
  templates:
    - uuid: 4e3fb27f028e4c35b8c9fc43b11c07d7
      template: 'OpenStack by HTTP'
      name: 'OpenStack by HTTP'
      description: |
        Requests OpenStack API access token and discovers available OpenStack services using OpenStack Identity API by HTTP using script item and creates host prototypes for them.
        
        Template uses OpenStack application credentials for authorization.
        
        Zabbix currently supports OpenStack Nova service.
        
        Read the template documentation prior to using this 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"
      vendor:
        name: Zabbix
        version: 7.4-0
      groups:
        - name: Templates/Cloud
      items:
        - uuid: 0518d08edbf2480abf15f4ef0e7a251a
          name: 'Get access token and service catalog'
          type: SCRIPT
          key: openstack.identity.auth
          delay: '{$OPENSTACK.AUTH.INTERVAL}'
          history: '0'
          value_type: TEXT
          params: |
            
            const request_path = '/v3/auth/tokens';
            
            function checkParams(params) {
            	['api_url', 'app_cred_id', 'app_cred_secret'].forEach(function (field) {
            		if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            	return params;
            }
            
            function getHttpData(url, params, app_cred_id, app_cred_secret) {
            	const request = new HttpRequest();
            
            	request.addHeader('Content-Type: application/json');
            
            	const request_body = {
            		"auth": {
            			"identity": {
            				"methods": [
            					"application_credential"
            				],
            				"application_credential": {
            					"id": app_cred_id,
            					"secret": app_cred_secret
            				}
            			}
            		}
            	};
            
            	if (params['http_proxy']) {
            		request.setProxy(params['http_proxy'])
            		Zabbix.log(4, '[ Openstack Nova API ] Using http proxy: ' + params['http_proxy']);
            	}
            
            	const response = request.post(url, JSON.stringify(request_body));
            	Zabbix.log(4, '[ Openstack Identity API ] [ ' + url + ' ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            	if (request.getStatus() !== 201) {
            		if (typeof (response.error && response.error.message) !== 'undefined') {
            			throw response.error.message;
            		} else {
            			throw 'Failed to receive data: invalid response status code. Check debug log for more information.';
            		}
            	}
            
            	return {'request': request, 'response': response};
            }
            
            function parseHttpData(http_data) {
            	var token;
            	const headers = http_data['request'].getHeaders(true);
            	if (typeof headers === "object") {
            		if (headers !== null) {
            			try {
            				token = headers["X-Subject-Token"][0];
            			} catch (error) {
            				throw 'Failed to parse response received from OpenStack Identity API. Check debug log for more information.';
            			}
            		} else {
            			throw 'Response object is empty. Check debug log for more information.';
            		}
            	} else {
            		throw 'Cannot process response data: received data is not an object. Check debug log for more information.';
            	}
            
            	const supported_services = ['nova'];
            
            	var ret = [];
            	const data = JSON.parse(http_data['response']);
            	if (data['token']['catalog']) {
            		const service_catalog = data['token']['catalog'];
            	} else {
            		throw 'Cannot find service catalog in HTTP response.'
            	}
            
            	service_catalog.forEach(function (service) {
            		if (supported_services.indexOf(service.name) > -1) {
            			service.endpoints.forEach(function (endpoint) {
            				if (endpoint.interface === 'public') {
            					ret.push({
            						'service_name': service.name[0].toUpperCase() + service.name.slice(1),
            						'service_url': endpoint.url,
            						'token': token
            					});
            				}
            			})
            		}
            	});
            
            	return JSON.stringify(ret);
            }
            
            const params = checkParams(JSON.parse(value)),
            	url = params.api_url,
            	auth_cred_id = params.app_cred_id,
            	auth_cred_secret = params.app_cred_secret;
            
            const httpData = getHttpData(url + request_path, params, auth_cred_id, auth_cred_secret);
            return parseHttpData(httpData);
          description: 'Authorizes user on the OpenStack Identity service and gets the service catalog.'
          timeout: 10s
          parameters:
            - name: api_url
              value: '{$OPENSTACK.KEYSTONE.API.ENDPOINT}'
            - name: app_cred_id
              value: '{$OPENSTACK.APP.CRED.ID}'
            - name: app_cred_secret
              value: '{$OPENSTACK.APP.CRED.SECRET}'
            - name: http_proxy
              value: '{$OPENSTACK.HTTP.PROXY}'
          tags:
            - tag: component
              value: raw
      discovery_rules:
        - uuid: f827e364d7bd4013b02504a58fdc2d39
          name: 'OpenStack: Nova discovery'
          type: DEPENDENT
          key: openstack.services.nova.discovery
          filter:
            conditions:
              - macro: '{#SERVICE_NAME}'
                value: ^Nova$
          description: 'Discovers OpenStack services from the monitoring user''s services catalog.'
          host_prototypes:
            - uuid: 580d769292ec48379c5b84cd5c72533b
              host: 'OpenStack {#SERVICE_NAME}'
              name: 'OpenStack {#SERVICE_NAME}'
              group_links:
                - group:
                    name: 'Virtual machines'
              templates:
                - name: 'OpenStack Nova by HTTP'
              macros:
                - macro: '{$OPENSTACK.NOVA.SERVICE.URL}'
                  value: '{#SERVICE_URL}'
                  description: 'OpenStack Nova service path.'
                - macro: '{$OPENSTACK.TOKEN}'
                  value: '{#TOKEN}'
                  description: 'OpenStack authorization token.'
          master_item:
            key: openstack.identity.auth
          lld_macro_paths:
            - lld_macro: '{#SERVICE_NAME}'
              path: $.service_name
            - lld_macro: '{#SERVICE_URL}'
              path: $.service_url
            - lld_macro: '{#TOKEN}'
              path: $.token
      tags:
        - tag: class
          value: cloud
        - tag: target
          value: openstack
      macros:
        - macro: '{$OPENSTACK.APP.CRED.ID}'
          description: 'Application credential ID for monitoring user access.'
        - macro: '{$OPENSTACK.APP.CRED.SECRET}'
          type: SECRET_TEXT
          description: 'Application credential password for monitoring user access.'
        - macro: '{$OPENSTACK.AUTH.INTERVAL}'
          value: 50m
          description: 'API token regeneration interval, in minutes. By default, OpenStack API tokens expire after 60m.'
        - macro: '{$OPENSTACK.HTTP.PROXY}'
          description: 'Sets the HTTP proxy for the authorization item. Host prototypes will also use this value for HTTP proxy. If this parameter is empty, then no proxy is used.'
        - macro: '{$OPENSTACK.KEYSTONE.API.ENDPOINT}'
          description: 'API endpoint for Identity Service, e.g., https://local.openstack:5000.'
    - uuid: ff637e001b91472d8730eb7f10e65800
      template: 'OpenStack Nova by HTTP'
      name: 'OpenStack Nova by HTTP'
      description: |
        Discovers and monitors project limits, servers, services, hypervisors, availability zones, hypervisors and tenants with OpenStack Compute API by HTTP using script and HTTP agent items.
        
        This template receives token and service URL from parent host, therefore no additional configuration is necessary.
        
        Read the template documentation prior to using this 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"
      vendor:
        name: Zabbix
        version: 7.4-0
      groups:
        - name: Templates/Cloud
      items:
        - uuid: 87d263a6f797439c8c7699d96f4305fb
          name: 'Get availability zones'
          type: HTTP_AGENT
          key: openstack.nova.availability_zone.get
          delay: '{$OPENSTACK.NOVA.INTERVAL.AVAILABILITY_ZONE}'
          history: '0'
          value_type: TEXT
          description: 'Gets a list of availability zones and its data.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.availabilityZoneInfo
              error_handler: CUSTOM_ERROR
              error_handler_params: 'Could not get availability zones list'
          timeout: 10s
          url: '{$OPENSTACK.NOVA.SERVICE.URL}/os-availability-zone/detail'
          http_proxy: '{$OPENSTACK.HTTP.PROXY}'
          headers:
            - name: X-Auth-Token
              value: '{$OPENSTACK.TOKEN}'
          tags:
            - tag: component
              value: raw
        - uuid: c4297b412ad54bae85a1219e2d988bcb
          name: 'Get hypervisors'
          type: HTTP_AGENT
          key: openstack.nova.hypervisors.get
          delay: '{$OPENSTACK.NOVA.INTERVAL.HYPERVISOR}'
          history: '0'
          value_type: TEXT
          description: 'Gets a list of hypervisors and its data.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.hypervisors
              error_handler: CUSTOM_ERROR
              error_handler_params: 'Could not get hypervisors list'
          timeout: 10s
          url: '{$OPENSTACK.NOVA.SERVICE.URL}/os-hypervisors/detail'
          http_proxy: '{$OPENSTACK.HTTP.PROXY}'
          headers:
            - name: X-Auth-Token
              value: '{$OPENSTACK.TOKEN}'
          tags:
            - tag: component
              value: raw
        - uuid: 02698d2fcd2949868013dedb311b8db3
          name: 'Get absolute limits'
          type: HTTP_AGENT
          key: openstack.nova.limits.get
          delay: '{$OPENSTACK.NOVA.INTERVAL.LIMITS}'
          history: '0'
          value_type: TEXT
          description: 'Gets absolute limits for the project.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.limits.absolute
              error_handler: CUSTOM_ERROR
              error_handler_params: 'Could not get absolute project limits'
          timeout: 10s
          url: '{$OPENSTACK.NOVA.SERVICE.URL}/limits'
          http_proxy: '{$OPENSTACK.HTTP.PROXY}'
          headers:
            - name: X-Auth-Token
              value: '{$OPENSTACK.TOKEN}'
          tags:
            - tag: component
              value: raw
        - uuid: bea005220b704f1fb6ca523647ae24ce
          name: 'Instances count, current'
          type: DEPENDENT
          key: openstack.nova.limits.instances.current
          description: 'Number of servers in each tenant.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.totalInstancesUsed
          master_item:
            key: openstack.nova.limits.get
          tags:
            - tag: component
              value: environment
        - uuid: 29898c0cb13d4ccebc3da95c082da29b
          name: 'Instances count, free'
          type: CALCULATED
          key: openstack.nova.limits.instances.free
          delay: '{$OPENSTACK.NOVA.INTERVAL.LIMITS}'
          params: last(//openstack.nova.limits.instances.max)-last(//openstack.nova.limits.instances.current)
          description: 'Number of available servers for each tenant.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          tags:
            - tag: component
              value: environment
        - uuid: 7526be4743564c32a293f96daf7cb242
          name: 'Instances count, max'
          type: DEPENDENT
          key: openstack.nova.limits.instances.max
          description: 'Number of allowed servers for each tenant.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.maxTotalInstances
          master_item:
            key: openstack.nova.limits.get
          tags:
            - tag: component
              value: environment
        - uuid: 64ae014b201945f299f80080dc63176d
          name: 'RAM usage, current'
          type: DEPENDENT
          key: openstack.nova.limits.ram.current
          units: b
          description: 'Amount of used server RAM.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.totalRAMUsed
            - type: MULTIPLIER
              parameters:
                - '1048576'
          master_item:
            key: openstack.nova.limits.get
          tags:
            - tag: component
              value: environment
        - uuid: bdc1492bbb5c4bcd844eaa6f6e76c1ff
          name: 'RAM usage, free'
          type: CALCULATED
          key: openstack.nova.limits.ram.free
          delay: '{$OPENSTACK.NOVA.INTERVAL.LIMITS}'
          units: b
          params: last(//openstack.nova.limits.ram.max)-last(//openstack.nova.limits.ram.current)
          description: 'Amount of available server RAM.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          tags:
            - tag: component
              value: environment
        - uuid: 50f2128cace04cf5a783e438de813e72
          name: 'RAM usage, max'
          type: DEPENDENT
          key: openstack.nova.limits.ram.max
          units: b
          description: 'Amount of allowed server RAM.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.maxTotalRAMSize
            - type: MULTIPLIER
              parameters:
                - '1048576'
          master_item:
            key: openstack.nova.limits.get
          tags:
            - tag: component
              value: environment
        - uuid: 678f2c0017f54d8b827876005f6ca670
          name: 'vCPUs usage, current'
          type: DEPENDENT
          key: openstack.nova.limits.vcpu.current
          description: 'Number of used server cores in each tenant.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.totalCoresUsed
          master_item:
            key: openstack.nova.limits.get
          tags:
            - tag: component
              value: environment
        - uuid: 97d3b897722d4910aea8e4c3c5f6c9a9
          name: 'vCPUs usage, free'
          type: CALCULATED
          key: openstack.nova.limits.vcpu.free
          delay: '{$OPENSTACK.NOVA.INTERVAL.LIMITS}'
          params: last(//openstack.nova.limits.vcpu.max)-last(//openstack.nova.limits.vcpu.current)
          description: 'Number of available server cores for each tenant.'
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          tags:
            - tag: component
              value: environment
        - uuid: e0583793b29b4bb195198d196cc1f0cc
          name: 'vCPUs usage, max'
          type: DEPENDENT
          key: openstack.nova.limits.vcpu.max
          description: 'Number of allowed server cores for each tenant.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.maxTotalCores
          master_item:
            key: openstack.nova.limits.get
          tags:
            - tag: component
              value: environment
        - uuid: 85d746d8b6cf404f95eeb7903c2e66e0
          name: 'Get servers'
          type: HTTP_AGENT
          key: openstack.nova.servers.get
          delay: '{$OPENSTACK.NOVA.INTERVAL.SERVERS}'
          history: '0'
          value_type: TEXT
          description: 'Gets a list of servers.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.servers
              error_handler: CUSTOM_ERROR
              error_handler_params: 'Could not get servers list'
          timeout: 10s
          url: '{$OPENSTACK.NOVA.SERVICE.URL}/servers'
          http_proxy: '{$OPENSTACK.HTTP.PROXY}'
          headers:
            - name: X-Auth-Token
              value: '{$OPENSTACK.TOKEN}'
          tags:
            - tag: component
              value: raw
        - uuid: 3db93b6116ad416eb10da851cce385a1
          name: 'Get compute services'
          type: HTTP_AGENT
          key: openstack.nova.services.get
          delay: '{$OPENSTACK.NOVA.INTERVAL.SERVICES}'
          history: '0'
          value_type: TEXT
          description: 'Gets a list of compute services and its data.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.services
              error_handler: CUSTOM_ERROR
              error_handler_params: 'Could not get compute services list'
          timeout: 10s
          url: '{$OPENSTACK.NOVA.SERVICE.URL}/os-services'
          http_proxy: '{$OPENSTACK.HTTP.PROXY}'
          headers:
            - name: X-Auth-Token
              value: '{$OPENSTACK.TOKEN}'
          tags:
            - tag: component
              value: raw
        - uuid: c258e567922c4f71a4dee9c0d6b88b1e
          name: 'Get tenants'
          type: SCRIPT
          key: openstack.nova.tenant.get
          delay: '{$OPENSTACK.NOVA.INTERVAL.TENANTS}'
          history: '0'
          value_type: TEXT
          params: |
            
            const request_path = '/os-simple-tenant-usage';
            
            function checkParams(params) {
            	['api_url', 'api_token', 'period'].forEach(function (field) {
            		if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            		if (field === 'period') {
            			const supported_values = ['y', 'm', 'w', 'd']
            			if (supported_values.indexOf(params[field]) === -1) {
            				throw 'Tenant period not correctly set. Expected one of "y", "m", "w", "d"; received: ' + field + '.';
            			}
            		}
            	});
            	return params;
            }
            
            function buildUrl(url, period) {
            	const current_date = new Date();
            	var datetime_formatted = ''
            	switch (period) {
            		case 'y':
            			datetime_formatted =
            				current_date.getFullYear() + '-' +
            				'1-' +
            				'1T' +
            				'00:00:00'
            			break;
            		case 'm':
            			datetime_formatted =
            			current_date.getFullYear() + '-' +
            				(current_date.getMonth() + 1) + '-' +
            			'1T' +
            			'00:00:00'
            			break;
            		case 'w':
            			const first_date_of_week = current_date.getDate() - current_date.getDay() + 1
            			datetime_formatted =
            				current_date.getFullYear() + '-' +
            				(current_date.getMonth() + 1) + '-' +
            				first_date_of_week + 'T' +
            				'00:00:00'
            			break;
            		case 'd':
            			datetime_formatted =
            				current_date.getFullYear() + '-' +
            				(current_date.getMonth() + 1) + '-' +
            				current_date.getDate() + 'T' +
            				'00:00:00'
            			break;
            	}
            
            	return url + request_path + '?' +
            		'start=' + encodeURIComponent(datetime_formatted)
            }
            
            function getHttpData(url, params, api_token) {
            	const request = new HttpRequest();
            
            	request.addHeader('Content-Type: application/json');
            	request.addHeader('X-Auth-Token: ' + api_token);
            	if (params['http_proxy']) {
            		request.setProxy(params['http_proxy'])
            		Zabbix.log(4, '[ Openstack Nova API ] Using http proxy: ' + params['http_proxy']);
            	}
            
            	const response = request.get(url, JSON.stringify(params));
            	Zabbix.log(4, '[ Openstack Nova API ] [ ' + url + ' ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            	if (request.getStatus() !== 200) {
            		if (typeof (response.error && response.error.message) !== 'undefined') {
            			throw response.error.message;
            		} else {
            			throw 'Failed to receive data: invalid response status code ( ' + request.getStatus() + ' ). Check debug log for more information.';
            		}
            	}
            
            	return response;
            }
            
            const params = checkParams(JSON.parse(value)),
            	url = params.api_url,
            	token = params.api_token,
            	period = params.period;
            
            return getHttpData(buildUrl(url, period), params, token);
          description: 'Gets a list of tenants and its data.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.tenant_usages
              error_handler: CUSTOM_ERROR
              error_handler_params: 'Could not get tenant list'
          timeout: 10s
          parameters:
            - name: api_token
              value: '{$OPENSTACK.TOKEN}'
            - name: api_url
              value: '{$OPENSTACK.NOVA.SERVICE.URL}'
            - name: http_proxy
              value: '{$OPENSTACK.HTTP.PROXY}'
            - name: period
              value: '{$OPENSTACK.NOVA.TENANT.PERIOD}'
          tags:
            - tag: component
              value: raw
      discovery_rules:
        - uuid: 55f919d49a364921a0e63e51dcabe9e2
          name: 'Nova: Availability zones discovery'
          type: DEPENDENT
          key: openstack.nova.availability_zone.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#ZONE_NAME}'
                value: '{$OPENSTACK.AVAILABILITY_ZONE.DISCOVERY.NAME.MATCHES}'
              - macro: '{#ZONE_NAME}'
                value: '{$OPENSTACK.AVAILABILITY_ZONE.DISCOVERY.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discovers OpenStack Nova availability zones.'
          item_prototypes:
            - uuid: 46f1348ce86742a6a645e137b0ecea63
              name: 'Availability zone [{#ZONE_NAME}]: Host count'
              type: DEPENDENT
              key: 'openstack.nova.availability_zone.host_count[{#ZONE_NAME}]'
              description: 'Count of hosts and service objects under single availability zone.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[''hosts''].[*].[*].length()'
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the detailed availability zone report'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'openstack.nova.availability_zone.raw[{#ZONE_NAME}]'
              tags:
                - tag: component
                  value: application
                - tag: component
                  value: zone
            - uuid: 988be318a8d345e4ba1d339e7e877a2c
              name: 'Availability zone [{#ZONE_NAME}]: Raw data'
              type: DEPENDENT
              key: 'openstack.nova.availability_zone.raw[{#ZONE_NAME}]'
              history: '0'
              value_type: TEXT
              description: 'Raw data of the availability zone.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.zoneName == "{#ZONE_NAME}")].first()'
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the detailed availability zone report'
              master_item:
                key: openstack.nova.availability_zone.get
              tags:
                - tag: component
                  value: raw
            - uuid: 2d99e000412244b998417c19399a8ff9
              name: 'Availability zone [{#ZONE_NAME}]: State'
              type: DEPENDENT
              key: 'openstack.nova.availability_zone.state[{#ZONE_NAME}]'
              description: 'Current state of the availability zone.'
              valuemap:
                name: 'Availability zone state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.zoneState.available
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the detailed availability zone report'
                - type: BOOL_TO_DECIMAL
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'openstack.nova.availability_zone.raw[{#ZONE_NAME}]'
              tags:
                - tag: component
                  value: application
                - tag: component
                  value: zone
              trigger_prototypes:
                - uuid: 0b4865c81de741b8a96574eeb450cf40
                  expression: 'last(/OpenStack Nova by HTTP/openstack.nova.availability_zone.state[{#ZONE_NAME}])=0'
                  name: 'OpenStack Nova: Availability zone [{#ZONE_NAME}]: Zone is unavailable'
                  opdata: 'Current zone state: {ITEM.LASTVALUE}'
                  priority: WARNING
                  description: 'Availability zone is not available.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: openstack.nova.availability_zone.get
          lld_macro_paths:
            - lld_macro: '{#ZONE_NAME}'
              path: $.zoneName
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
        - uuid: 84b17b240632413fbc3cd5b261cc2fd6
          name: 'Nova: Hypervisor discovery'
          type: DEPENDENT
          key: openstack.nova.hypervisors.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#HOSTNAME}'
                value: '{$OPENSTACK.HYPERVISOR.DISCOVERY.HOSTNAME.MATCHES}'
              - macro: '{#HOSTNAME}'
                value: '{$OPENSTACK.HYPERVISOR.DISCOVERY.HOSTNAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#HOST_IP}'
                value: '{$OPENSTACK.HYPERVISOR.DISCOVERY.IP.MATCHES}'
              - macro: '{#HOST_IP}'
                value: '{$OPENSTACK.HYPERVISOR.DISCOVERY.IP.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#TYPE}'
                value: '{$OPENSTACK.HYPERVISOR.DISCOVERY.TYPE.MATCHES}'
              - macro: '{#TYPE}'
                value: '{$OPENSTACK.HYPERVISOR.DISCOVERY.TYPE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discovers OpenStack Nova hypervisors.'
          item_prototypes:
            - uuid: 3edd8fcf7d3643119b7b21111155fcc0
              name: 'Hypervisor [{#ID}]:[{#HOSTNAME}]: Raw data'
              type: DEPENDENT
              key: 'openstack.nova.hypervisors.raw[{#ID}]'
              history: '0'
              value_type: TEXT
              description: 'Raw data of the hypervisor.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.id == "{#ID}")].first()'
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the detailed hypervisor report'
              master_item:
                key: openstack.nova.hypervisors.get
              tags:
                - tag: component
                  value: raw
            - uuid: ef893a8517414964ade5d40064291f87
              name: 'Hypervisor [{#ID}]:[{#HOSTNAME}]: State'
              type: DEPENDENT
              key: 'openstack.nova.hypervisors.state[{#ID}]'
              description: 'State of the hypervisor.'
              valuemap:
                name: 'General state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the detailed hypervisor report'
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const idx = [
                      	'down',
                      	'up'
                      ].indexOf(value);
                      return idx !== -1 ? idx : 10;
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'openstack.nova.hypervisors.raw[{#ID}]'
              tags:
                - tag: component
                  value: application
                - tag: component
                  value: hypervisor
              trigger_prototypes:
                - uuid: 5fb5ed829d9747499c385d268bf229ea
                  expression: 'last(/OpenStack Nova by HTTP/openstack.nova.hypervisors.state[{#ID}])=0'
                  name: 'OpenStack Nova: Hypervisor [{#ID}]:[{#HOSTNAME}]: State is "down"'
                  opdata: 'Current state: {ITEM.LASTVALUE}'
                  priority: WARNING
                  description: 'State of the hypervisor is "down".'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 26d06619594049c594998359a4659686
              name: 'Hypervisor [{#ID}]:[{#HOSTNAME}]: Status'
              type: DEPENDENT
              key: 'openstack.nova.hypervisors.status[{#ID}]'
              description: 'Status of the hypervisor.'
              valuemap:
                name: 'General status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the detailed hypervisor report'
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const idx = [
                      	'disabled',
                      	'enabled'
                      ].indexOf(value);
                      return idx !== -1 ? idx : 10;
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'openstack.nova.hypervisors.raw[{#ID}]'
              tags:
                - tag: component
                  value: application
                - tag: component
                  value: hypervisor
              trigger_prototypes:
                - uuid: 5022a6a84f884a31be1ff440a3c14732
                  expression: 'last(/OpenStack Nova by HTTP/openstack.nova.hypervisors.status[{#ID}])=0'
                  name: 'OpenStack Nova: Hypervisor [{#ID}]:[{#HOSTNAME}]: Status is "disabled"'
                  opdata: 'Current status: {ITEM.LASTVALUE}'
                  priority: INFO
                  description: 'Status of the hypervisor is disabled.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 5e9ced69d41d40ffabb04f9fd88b7730
              name: 'Hypervisor [{#ID}]:[{#HOSTNAME}]: Version'
              type: DEPENDENT
              key: 'openstack.nova.hypervisors.version[{#ID}]'
              value_type: FLOAT
              description: 'Hypervisor version.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.hypervisor_version
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the detailed hypervisor report'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'openstack.nova.hypervisors.raw[{#ID}]'
              tags:
                - tag: component
                  value: application
                - tag: component
                  value: hypervisor
              trigger_prototypes:
                - uuid: 958ce612bb0a4b1ea67aba594dbd53b3
                  expression: 'last(/OpenStack Nova by HTTP/openstack.nova.hypervisors.version[{#ID}])<>last(/OpenStack Nova by HTTP/openstack.nova.hypervisors.version[{#ID}],#2) and length(last(/OpenStack Nova by HTTP/openstack.nova.hypervisors.version[{#ID}]))>0'
                  name: 'OpenStack Nova: Hypervisor [{#ID}]:[{#HOSTNAME}]: Version has changed'
                  opdata: 'Current version: {ITEM.LASTVALUE}'
                  priority: INFO
                  description: 'Version of the hypervisor has changed. Acknowledge to close the problem manually.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
          master_item:
            key: openstack.nova.hypervisors.get
          lld_macro_paths:
            - lld_macro: '{#HOSTNAME}'
              path: $.hypervisor_hostname
            - lld_macro: '{#HOST_IP}'
              path: $.host_ip
            - lld_macro: '{#ID}'
              path: $.id
            - lld_macro: '{#TYPE}'
              path: $.hypervisor_type
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
        - uuid: b38111e1499f414cbe662fada0d40b10
          name: 'Nova: Servers discovery'
          type: DEPENDENT
          key: openstack.nova.server.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#SERVER_NAME}'
                value: '{$OPENSTACK.SERVER.DISCOVERY.NAME.MATCHES}'
              - macro: '{#SERVER_NAME}'
                value: '{$OPENSTACK.SERVER.DISCOVERY.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discovers OpenStack Nova servers.'
          item_prototypes:
            - uuid: 84fd4be0c5f84744ac6bd93d4d4e8f0e
              name: 'Server [{#SERVER_ID}]:[{#SERVER_NAME}]: Status'
              type: HTTP_AGENT
              key: 'openstack.nova.server.status.get[{#SERVER_ID}]'
              delay: '{$OPENSTACK.NOVA.INTERVAL.SERVERS}'
              description: 'Server status.'
              valuemap:
                name: 'Server status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.server.status
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the detailed server report'
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const idx = [
                      	'SHUTOFF',
                      	'ACTIVE',
                      	'PAUSED',
                      	'BUILD',
                      	'DELETED',
                      	'ERROR',
                      	'HARD_REBOOT',
                      	'MIGRATING',
                      	'PASSWORD',
                      	'REBOOT',
                      	'REBUILD',
                      	'RESCUE',
                      	'RESIZE',
                      	'REVERT_RESIZE',
                      	'SHELVED',
                      	'SHELVED_OFFLOADED',
                      	'SOFT_DELETED',
                      	'SUSPENDED',
                      	'UNKNOWN',
                      	'VERIFY_RESIZE',
                      ].indexOf(value);
                      return idx !== -1 ? idx : 30;
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              timeout: 10s
              url: '{$OPENSTACK.NOVA.SERVICE.URL}/servers/{#SERVER_ID}'
              http_proxy: '{$OPENSTACK.HTTP.PROXY}'
              headers:
                - name: X-Auth-Token
                  value: '{$OPENSTACK.TOKEN}'
              tags:
                - tag: component
                  value: application
                - tag: component
                  value: server
              trigger_prototypes:
                - uuid: 490262a25fb842c9a9b83a2e0be83654
                  expression: 'last(/OpenStack Nova by HTTP/openstack.nova.server.status.get[{#SERVER_ID}])<>last(/OpenStack Nova by HTTP/openstack.nova.server.status.get[{#SERVER_ID}],#2) and length(last(/OpenStack Nova by HTTP/openstack.nova.server.status.get[{#SERVER_ID}]))>0'
                  name: 'OpenStack Nova: Server [{#SERVER_ID}]:[{#SERVER_NAME}]: Status has changed'
                  opdata: 'Current status: {ITEM.LASTVALUE}'
                  priority: INFO
                  description: 'Status of the server has changed. Acknowledge to close the problem manually.'
                  manual_close: 'YES'
                  dependencies:
                    - name: 'OpenStack Nova: Server [{#SERVER_ID}]:[{#SERVER_NAME}]: Status is "ERROR"'
                      expression: 'last(/OpenStack Nova by HTTP/openstack.nova.server.status.get[{#SERVER_ID}])=5'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 7d2ca81f24154099b3857aeaadef114f
                  expression: 'last(/OpenStack Nova by HTTP/openstack.nova.server.status.get[{#SERVER_ID}])=5'
                  name: 'OpenStack Nova: Server [{#SERVER_ID}]:[{#SERVER_NAME}]: Status is "ERROR"'
                  opdata: 'Current status: {ITEM.LASTVALUE}'
                  priority: HIGH
                  description: 'Server is in "ERROR" status.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: openstack.nova.servers.get
          lld_macro_paths:
            - lld_macro: '{#SERVER_ID}'
              path: $.id
            - lld_macro: '{#SERVER_NAME}'
              path: $.name
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
        - uuid: 4af40cd615d74e54a3759041470995fe
          name: 'Nova: Compute services discovery'
          type: DEPENDENT
          key: openstack.nova.services.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#BINARY}'
                value: '{$OPENSTACK.SERVICES.DISCOVERY.BINARY.MATCHES}'
              - macro: '{#BINARY}'
                value: '{$OPENSTACK.SERVICES.DISCOVERY.BINARY.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#HOST}'
                value: '{$OPENSTACK.SERVICES.DISCOVERY.HOST.MATCHES}'
              - macro: '{#HOST}'
                value: '{$OPENSTACK.SERVICES.DISCOVERY.HOST.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discovers OpenStack compute services.'
          item_prototypes:
            - uuid: 3bd724dad043411187a86466cf8ee2c6
              name: 'Compute service [{#HOST}]:[{#BINARY}]:[{#ID}]: Disabling reason'
              type: DEPENDENT
              key: 'openstack.nova.services.disabled.reason[{#ID}]'
              value_type: CHAR
              description: 'Reason for disabling a service.'
              valuemap:
                name: 'Compute service disabling reason'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.disabled_reason
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the detailed services report'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'openstack.nova.services.raw[{#ID}]'
              tags:
                - tag: component
                  value: application
                - tag: component
                  value: service
            - uuid: 60c5f4461ad84269983168b359a0ff87
              name: 'Compute service [{#HOST}]:[{#BINARY}]:[{#ID}]: Raw data'
              type: DEPENDENT
              key: 'openstack.nova.services.raw[{#ID}]'
              history: '0'
              value_type: TEXT
              description: 'Raw data of the service.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.id == "{#ID}")].first()'
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the detailed services report'
              master_item:
                key: openstack.nova.services.get
              tags:
                - tag: component
                  value: raw
            - uuid: 8f123b2f902647b381b2c9a5af3bee80
              name: 'Compute service [{#HOST}]:[{#BINARY}]:[{#ID}]: State'
              type: DEPENDENT
              key: 'openstack.nova.services.state[{#ID}]'
              description: 'State of the service.'
              valuemap:
                name: 'General state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.state
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the detailed services report'
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const idx = [
                      	'down',
                      	'up'
                      ].indexOf(value);
                      return idx !== -1 ? idx : 10;
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'openstack.nova.services.raw[{#ID}]'
              tags:
                - tag: component
                  value: application
                - tag: component
                  value: service
              trigger_prototypes:
                - uuid: 9479c68ee2db4104ac44f47931d96929
                  expression: 'last(/OpenStack Nova by HTTP/openstack.nova.services.state[{#ID}])=0'
                  name: 'OpenStack Nova: Compute service [{#HOST}]:[{#BINARY}]:[{#ID}]: State is "down"'
                  opdata: 'Current state: {ITEM.LASTVALUE}'
                  priority: WARNING
                  description: 'State of the service is "down".'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 65288a6f75094c74bbb04651c87cb323
              name: 'Compute service [{#HOST}]:[{#BINARY}]:[{#ID}]: Status'
              type: DEPENDENT
              key: 'openstack.nova.services.status[{#ID}]'
              description: 'Status of the service.'
              valuemap:
                name: 'General status'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.status
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the detailed services report'
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const idx = [
                      	'disabled',
                      	'enabled'
                      ].indexOf(value);
                      return idx !== -1 ? idx : 10;
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'openstack.nova.services.raw[{#ID}]'
              tags:
                - tag: component
                  value: application
                - tag: component
                  value: service
          trigger_prototypes:
            - uuid: 177fa631136c4340816ee9e2cf90f1ac
              expression: 'last(/OpenStack Nova by HTTP/openstack.nova.services.status[{#ID}])=0 and length(last(/OpenStack Nova by HTTP/openstack.nova.services.disabled.reason[{#ID}]))>=0'
              name: 'OpenStack Nova: Compute service [{#HOST}]:[{#BINARY}]:[{#ID}]: Status is "disabled"'
              opdata: 'Current state: {ITEM.LASTVALUE1}, disabling reason: "{ITEM.VALUE2}"'
              priority: INFO
              description: 'Status of the server is disabled. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: availability
          master_item:
            key: openstack.nova.services.get
          lld_macro_paths:
            - lld_macro: '{#BINARY}'
              path: $.binary
            - lld_macro: '{#HOST}'
              path: $.host
            - lld_macro: '{#ID}'
              path: $.id
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
        - uuid: dba72b914e5c45fd9049ee5e4194bdcf
          name: 'Nova: Tenant discovery'
          type: DEPENDENT
          key: openstack.nova.tenant.discovery
          description: 'Discovers tenants and their usage data.'
          item_prototypes:
            - uuid: 73e8e9b39da64358948407efd6aded6b
              name: 'Tenant [{#TENANT_ID}]: Total disk usage'
              type: DEPENDENT
              key: 'openstack.nova.tenant.disk_usage[{#TENANT_ID}]'
              value_type: FLOAT
              units: '!hours'
              description: |
                Total disk usage hours for the current tenant (project).
                Multiplying the server disk size (in GiB) by hours the server exists, and then adding that all together for each server.
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.total_local_gb_usage
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the detailed tenant report'
                - type: JAVASCRIPT
                  parameters:
                    - 'return Math.round(value * 100) / 100;'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'openstack.nova.tenant.raw[{#TENANT_ID}]'
              tags:
                - tag: component
                  value: application
                - tag: component
                  value: tenant
            - uuid: c96dd7741d344b7f95f571640712faa0
              name: 'Tenant [{#TENANT_ID}]: Raw data'
              type: DEPENDENT
              key: 'openstack.nova.tenant.raw[{#TENANT_ID}]'
              history: '0'
              value_type: TEXT
              description: 'Raw data of the tenant.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.tenant_id == "{#TENANT_ID}")].first()'
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the tenant report'
              master_item:
                key: openstack.nova.tenant.get
              tags:
                - tag: component
                  value: raw
            - uuid: 634ccd12a49e440fb72f622f3fa36034
              name: 'Tenant [{#TENANT_ID}]: Total hours'
              type: DEPENDENT
              key: 'openstack.nova.tenant.total_hours[{#TENANT_ID}]'
              value_type: FLOAT
              units: '!hours'
              description: 'Total duration that the servers exist (in hours).'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.total_hours
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the detailed tenant report'
                - type: JAVASCRIPT
                  parameters:
                    - 'return Math.round(value * 100) / 100;'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'openstack.nova.tenant.raw[{#TENANT_ID}]'
              tags:
                - tag: component
                  value: application
                - tag: component
                  value: tenant
            - uuid: ce4fccd4d93a4621af8982d3e6b9dcbb
              name: 'Tenant [{#TENANT_ID}]: Total memory usage'
              type: DEPENDENT
              key: 'openstack.nova.tenant.total_memory_mb_usage[{#TENANT_ID}]'
              value_type: FLOAT
              units: '!hours'
              description: |
                Total memory usage hours for the current tenant (project).
                Multiplying the server memory size (in MiB) by hours the server exists, and then adding that all together for each server.
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.total_memory_mb_usage
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the detailed tenant report'
                - type: JAVASCRIPT
                  parameters:
                    - 'return Math.round(value * 100) / 100;'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'openstack.nova.tenant.raw[{#TENANT_ID}]'
              tags:
                - tag: component
                  value: application
                - tag: component
                  value: tenant
            - uuid: eee30f1ee62c40839bcf623c8a0a6ae6
              name: 'Tenant [{#TENANT_ID}]: Total vCPUs usage'
              type: DEPENDENT
              key: 'openstack.nova.tenant.total_vcpu[{#TENANT_ID}]'
              value_type: FLOAT
              units: '!hours'
              description: |
                Total vCPU usage hours for the current tenant (project).
                Multiplying the number of virtual CPUs of the server by hours the server exists, and then adding that all together for each server.
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.total_vcpus_usage
                  error_handler: CUSTOM_ERROR
                  error_handler_params: 'Could not parse the detailed tenant report'
                - type: JAVASCRIPT
                  parameters:
                    - 'return Math.round(value * 100) / 100;'
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'openstack.nova.tenant.raw[{#TENANT_ID}]'
              tags:
                - tag: component
                  value: application
                - tag: component
                  value: tenant
          graph_prototypes:
            - uuid: d456ccd13e38476bb43a948fd42fae1d
              name: 'Tenant [{#TENANT_ID}]: Total disk utilization'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'OpenStack Nova by HTTP'
                    key: 'openstack.nova.tenant.disk_usage[{#TENANT_ID}]'
            - uuid: 97466fabfd21468584658ffe480d7e22
              name: 'Tenant [{#TENANT_ID}]: Total hours utilization'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'OpenStack Nova by HTTP'
                    key: 'openstack.nova.tenant.total_hours[{#TENANT_ID}]'
            - uuid: a6b67816bd694539b0ebb77255ab479c
              name: 'Tenant [{#TENANT_ID}]: Total memory utilization'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'OpenStack Nova by HTTP'
                    key: 'openstack.nova.tenant.total_memory_mb_usage[{#TENANT_ID}]'
            - uuid: b8b3899c252945138cc8e241f37d8d40
              name: 'Tenant [{#TENANT_ID}]: Total vCPUs utilization'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'OpenStack Nova by HTTP'
                    key: 'openstack.nova.tenant.total_vcpu[{#TENANT_ID}]'
          master_item:
            key: openstack.nova.tenant.get
          lld_macro_paths:
            - lld_macro: '{#TENANT_ID}'
              path: $.tenant_id
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
      tags:
        - tag: class
          value: cloud
        - tag: target
          value: nova
        - tag: target
          value: openstack
      macros:
        - macro: '{$OPENSTACK.AVAILABILITY_ZONE.DISCOVERY.NAME.MATCHES}'
          value: '.*'
          description: 'Sets the zone name regex filter to use in availability zone discovery for including.'
        - macro: '{$OPENSTACK.AVAILABILITY_ZONE.DISCOVERY.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the zone name regex filter to use in availability zone discovery for excluding.'
        - macro: '{$OPENSTACK.HTTP.PROXY}'
          description: 'Sets the HTTP proxy for script and HTTP agent items. If this parameter is empty, then no proxy is used.'
        - macro: '{$OPENSTACK.HYPERVISOR.DISCOVERY.HOSTNAME.MATCHES}'
          value: '.*'
          description: 'Sets the hostname regex filter to use in hypervisor discovery for including.'
        - macro: '{$OPENSTACK.HYPERVISOR.DISCOVERY.HOSTNAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the hostname regex filter to use in hypervisor discovery for excluding.'
        - macro: '{$OPENSTACK.HYPERVISOR.DISCOVERY.IP.MATCHES}'
          value: '.*'
          description: 'Sets the host IP address regex filter to use in hypervisor discovery for including.'
        - macro: '{$OPENSTACK.HYPERVISOR.DISCOVERY.IP.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the host IP address regex filter to use in hypervisor discovery for excluding.'
        - macro: '{$OPENSTACK.HYPERVISOR.DISCOVERY.TYPE.MATCHES}'
          value: '.*'
          description: 'Sets the type regex filter to use in hypervisor discovery for including.'
        - macro: '{$OPENSTACK.HYPERVISOR.DISCOVERY.TYPE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the type regex filter to use in hypervisor discovery for excluding.'
        - macro: '{$OPENSTACK.NOVA.CPU.UTIL.HIGH}'
          value: '90'
          description: 'Sets the percentage threshold for creating a high severity event about vCPU resource usage.'
        - macro: '{$OPENSTACK.NOVA.CPU.UTIL.WARN}'
          value: '75'
          description: 'Sets the percentage threshold for creating a warning severity event about vCPU resource usage.'
        - macro: '{$OPENSTACK.NOVA.INSTANCES.UTIL.HIGH}'
          value: '90'
          description: 'Sets the percentage threshold for creating a high severity event about instances resource count.'
        - macro: '{$OPENSTACK.NOVA.INSTANCES.UTIL.WARN}'
          value: '75'
          description: 'Sets the percentage threshold for creating a warning severity event about instances resource count.'
        - macro: '{$OPENSTACK.NOVA.INTERVAL.AVAILABILITY_ZONE}'
          value: 3m
          description: 'Interval for availability zone HTTP agent item query.'
        - macro: '{$OPENSTACK.NOVA.INTERVAL.HYPERVISOR}'
          value: 3m
          description: 'Interval for hypervisor HTTP agent item query.'
        - macro: '{$OPENSTACK.NOVA.INTERVAL.LIMITS}'
          value: 3m
          description: 'Interval for absolute limit HTTP agent item query.'
        - macro: '{$OPENSTACK.NOVA.INTERVAL.SERVERS}'
          value: 3m
          description: 'Interval for server HTTP agent item queries.'
        - macro: '{$OPENSTACK.NOVA.INTERVAL.SERVICES}'
          value: 3m
          description: 'Interval for service HTTP agent item query.'
        - macro: '{$OPENSTACK.NOVA.INTERVAL.TENANTS}'
          value: 3m
          description: 'Interval for tenant HTTP agent item query.'
        - macro: '{$OPENSTACK.NOVA.RAM.UTIL.HIGH}'
          value: '90'
          description: 'Sets the percentage threshold for creating a high severity event about RAM resource usage.'
        - macro: '{$OPENSTACK.NOVA.RAM.UTIL.WARN}'
          value: '75'
          description: 'Sets the percentage threshold for creating a warning severity event about RAM resource usage.'
        - macro: '{$OPENSTACK.NOVA.SERVICE.URL}'
          description: 'API endpoint for Nova Service, e.g., https://local.openstack:8774/v2.1.'
        - macro: '{$OPENSTACK.NOVA.TENANT.PERIOD}'
          value: m
          description: |
            Period for which tenant usage statistics will be queried. Possible values are:
             'y' - current year until now,
             'm' - current month until now,
             'w' - current week until now,
             'd' - current day until now.
        - macro: '{$OPENSTACK.SERVER.DISCOVERY.NAME.MATCHES}'
          value: '.*'
          description: 'Sets the server name regex filter to use in server discovery for including.'
        - macro: '{$OPENSTACK.SERVER.DISCOVERY.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the server name regex filter to use in server discovery for excluding.'
        - macro: '{$OPENSTACK.SERVICES.DISCOVERY.BINARY.MATCHES}'
          value: '.*'
          description: 'Sets the binary name regex filter to use in compute services discovery for including.'
        - macro: '{$OPENSTACK.SERVICES.DISCOVERY.BINARY.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the binary name regex filter to use in compute services discovery for excluding.'
        - macro: '{$OPENSTACK.SERVICES.DISCOVERY.HOST.MATCHES}'
          value: '.*'
          description: 'Sets the host name regex filter to use in compute services discovery for including.'
        - macro: '{$OPENSTACK.SERVICES.DISCOVERY.HOST.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the host name regex filter to use in compute services discovery for excluding.'
        - macro: '{$OPENSTACK.TOKEN}'
          type: SECRET_TEXT
          description: 'API token for the monitoring user.'
      dashboards:
        - uuid: 462016340f49447f80b5d2405f3a682a
          name: 'Nova: Limits overview'
          pages:
            - widgets:
                - type: graph
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'OpenStack Nova by HTTP'
                        name: 'Nova: Instances utilization'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: graph
                  'y': '5'
                  width: '72'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'OpenStack Nova by HTTP'
                        name: 'Nova: RAM utilization'
                    - type: STRING
                      name: reference
                      value: AAAAC
                - type: graph
                  x: '36'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'OpenStack Nova by HTTP'
                        name: 'Nova: vCPUs utilization'
                    - type: STRING
                      name: reference
                      value: AAAAB
      valuemaps:
        - uuid: b5d0c4e859eb4b2d854f551e3d8aeff5
          name: 'Availability zone state'
          mappings:
            - value: '0'
              newvalue: Unavailable
            - value: '1'
              newvalue: Available
        - uuid: 1073ca0bea3f46ebbfbcaba628484be8
          name: 'Compute service disabling reason'
          mappings:
            - value: 'null'
              newvalue: N/A
        - uuid: a497438c723f4be88f452af2e8627613
          name: 'General state'
          mappings:
            - value: '0'
              newvalue: Down
            - value: '1'
              newvalue: Up
            - value: '10'
              newvalue: Unknown
        - uuid: c8109a75cda24fe1afec8ea68686cdb0
          name: 'General status'
          mappings:
            - value: '0'
              newvalue: Disabled
            - value: '1'
              newvalue: Enabled
            - value: '10'
              newvalue: Unknown
        - uuid: 375a709551d84ba3b0d4f24b6e0bd291
          name: 'Server status'
          mappings:
            - value: '0'
              newvalue: SHUTOFF
            - value: '1'
              newvalue: ACTIVE
            - value: '2'
              newvalue: PAUSED
            - value: '3'
              newvalue: BUILD
            - value: '4'
              newvalue: DELETED
            - value: '5'
              newvalue: ERROR
            - value: '6'
              newvalue: HARD_REBOOT
            - value: '7'
              newvalue: MIGRATING
            - value: '8'
              newvalue: PASSWORD
            - value: '9'
              newvalue: REBOOT
            - value: '10'
              newvalue: REBUILD
            - value: '11'
              newvalue: RESCUE
            - value: '12'
              newvalue: RESIZE
            - value: '13'
              newvalue: REVERT_RESIZE
            - value: '14'
              newvalue: SHELVED
            - value: '15'
              newvalue: SHELVED_OFFLOADED
            - value: '16'
              newvalue: SOFT_DELETED
            - value: '17'
              newvalue: SUSPENDED
            - value: '18'
              newvalue: UNKNOWN
            - value: '19'
              newvalue: VERIFY_RESIZE
            - value: '30'
              newvalue: Unknown
  triggers:
    - uuid: 3dbae725014d4f289e20f002f2674dc7
      expression: 'last(/OpenStack Nova by HTTP/openstack.nova.limits.instances.current) >= ({$OPENSTACK.NOVA.INSTANCES.UTIL.WARN} / 100 * last(/OpenStack Nova by HTTP/openstack.nova.limits.instances.max))'
      name: 'OpenStack Nova: Current instances count is high'
      event_name: 'OpenStack Nova: Current instances count is high (used >= {$OPENSTACK.NOVA.INSTANCES.UTIL.WARN}%)'
      opdata: 'Current: {ITEM.LASTVALUE1}, MAX: {ITEM.LASTVALUE2}'
      priority: WARNING
      description: 'Current instances count has exceeded {$OPENSTACK.NOVA.INSTANCES.UTIL.WARN}% of the max available instances count.'
      dependencies:
        - name: 'OpenStack Nova: Current instances count is too high'
          expression: 'last(/OpenStack Nova by HTTP/openstack.nova.limits.instances.current) >= ({$OPENSTACK.NOVA.INSTANCES.UTIL.HIGH} / 100 * last(/OpenStack Nova by HTTP/openstack.nova.limits.instances.max))'
      tags:
        - tag: scope
          value: capacity
    - uuid: 22592fabc09d416598fb4fb806048040
      expression: 'last(/OpenStack Nova by HTTP/openstack.nova.limits.instances.current) >= ({$OPENSTACK.NOVA.INSTANCES.UTIL.HIGH} / 100 * last(/OpenStack Nova by HTTP/openstack.nova.limits.instances.max))'
      name: 'OpenStack Nova: Current instances count is too high'
      event_name: 'OpenStack Nova: Current instances count is too high (used >= {$OPENSTACK.NOVA.INSTANCES.UTIL.HIGH}%)'
      opdata: 'Current: {ITEM.LASTVALUE1}, MAX: {ITEM.LASTVALUE2}'
      priority: HIGH
      description: 'Current instances count has exceeded {$OPENSTACK.NOVA.INSTANCES.UTIL.HIGH}% of the max available instances count.'
      tags:
        - tag: scope
          value: capacity
    - uuid: c9d9eca4b3e540f491210b5c2312e1ba
      expression: 'last(/OpenStack Nova by HTTP/openstack.nova.limits.ram.current) >= ({$OPENSTACK.NOVA.RAM.UTIL.WARN} / 100 * last(/OpenStack Nova by HTTP/openstack.nova.limits.ram.max))'
      name: 'OpenStack Nova: Current RAM usage is high'
      event_name: 'OpenStack Nova: Current RAM usage is high (used >= {$OPENSTACK.NOVA.RAM.UTIL.WARN}%)'
      opdata: 'Current: {ITEM.LASTVALUE1}, MAX: {ITEM.LASTVALUE2}'
      priority: WARNING
      description: 'Current RAM usage has exceeded {$OPENSTACK.NOVA.RAM.UTIL.WARN}% of the max available RAM usage.'
      dependencies:
        - name: 'OpenStack Nova: Current RAM usage is too high'
          expression: 'last(/OpenStack Nova by HTTP/openstack.nova.limits.ram.current) >= ({$OPENSTACK.NOVA.RAM.UTIL.HIGH} / 100 * last(/OpenStack Nova by HTTP/openstack.nova.limits.ram.max))'
      tags:
        - tag: scope
          value: capacity
    - uuid: 9dfd643fb555419c9c3200a07cc7647e
      expression: 'last(/OpenStack Nova by HTTP/openstack.nova.limits.ram.current) >= ({$OPENSTACK.NOVA.RAM.UTIL.HIGH} / 100 * last(/OpenStack Nova by HTTP/openstack.nova.limits.ram.max))'
      name: 'OpenStack Nova: Current RAM usage is too high'
      event_name: 'OpenStack Nova: Current RAM usage is too high (used >= {$OPENSTACK.NOVA.RAM.UTIL.HIGH}%)'
      opdata: 'Current: {ITEM.LASTVALUE1}, MAX: {ITEM.LASTVALUE2}'
      priority: HIGH
      description: 'Current RAM usage has exceeded {$OPENSTACK.NOVA.RAM.UTIL.HIGH}% of the max available RAM usage.'
      tags:
        - tag: scope
          value: capacity
    - uuid: 85b1a132602344e39a50ef10b29fca15
      expression: 'last(/OpenStack Nova by HTTP/openstack.nova.limits.vcpu.current) >= ({$OPENSTACK.NOVA.CPU.UTIL.WARN} / 100 * last(/OpenStack Nova by HTTP/openstack.nova.limits.vcpu.max))'
      name: 'OpenStack Nova: Current vCPU usage is high'
      event_name: 'OpenStack Nova: Current vCPU usage is high (used >= {$OPENSTACK.NOVA.CPU.UTIL.WARN}%)'
      opdata: 'Current: {ITEM.LASTVALUE1}, MAX: {ITEM.LASTVALUE2}'
      priority: WARNING
      description: 'Current vCPU usage has exceeded {$OPENSTACK.NOVA.CPU.UTIL.WARN}% of the max available vCPU usage.'
      dependencies:
        - name: 'OpenStack Nova: Current vCPU usage is too high'
          expression: 'last(/OpenStack Nova by HTTP/openstack.nova.limits.vcpu.current) >= ({$OPENSTACK.NOVA.CPU.UTIL.HIGH} / 100 * last(/OpenStack Nova by HTTP/openstack.nova.limits.vcpu.max))'
      tags:
        - tag: scope
          value: capacity
    - uuid: e62a7fb598b34a0cb5bee6bc0370f7dd
      expression: 'last(/OpenStack Nova by HTTP/openstack.nova.limits.vcpu.current) >= ({$OPENSTACK.NOVA.CPU.UTIL.HIGH} / 100 * last(/OpenStack Nova by HTTP/openstack.nova.limits.vcpu.max))'
      name: 'OpenStack Nova: Current vCPU usage is too high'
      event_name: 'OpenStack Nova: Current vCPU usage is too high (used >= {$OPENSTACK.NOVA.CPU.UTIL.HIGH}%)'
      opdata: 'Current: {ITEM.LASTVALUE1}, MAX: {ITEM.LASTVALUE2}'
      priority: HIGH
      description: 'Current vCPU usage has exceeded {$OPENSTACK.NOVA.CPU.UTIL.HIGH}% of the max available vCPU usage.'
      tags:
        - tag: scope
          value: capacity
  graphs:
    - uuid: 462db790ba6c451b8d2d4f4669ed11b5
      name: 'Nova: Instances utilization'
      graph_items:
        - color: 00FF00
          item:
            host: 'OpenStack Nova by HTTP'
            key: openstack.nova.limits.instances.current
        - sortorder: '1'
          drawtype: DASHED_LINE
          color: FF0000
          item:
            host: 'OpenStack Nova by HTTP'
            key: openstack.nova.limits.instances.max
    - uuid: d65df309a6ae47f48ebf245257750e58
      name: 'Nova: RAM utilization'
      graph_items:
        - color: 00FF00
          item:
            host: 'OpenStack Nova by HTTP'
            key: openstack.nova.limits.ram.current
        - sortorder: '1'
          drawtype: DASHED_LINE
          color: FF0000
          item:
            host: 'OpenStack Nova by HTTP'
            key: openstack.nova.limits.ram.max
    - uuid: 5c7434d968b64c118138e413758630c0
      name: 'Nova: vCPUs utilization'
      graph_items:
        - color: 00FF00
          item:
            host: 'OpenStack Nova by HTTP'
            key: openstack.nova.limits.vcpu.current
        - sortorder: '1'
          drawtype: DASHED_LINE
          color: FF0000
          item:
            host: 'OpenStack Nova by HTTP'
            key: openstack.nova.limits.vcpu.max