zabbix_export:
  version: '7.0'
  template_groups:
    - uuid: c2c162144c2d4c5491c8801193af4945
      name: Templates/Cloud
  host_groups:
    - uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
      name: Applications
    - uuid: 748ad4d098d447d492bb935c907f652f
      name: Databases
    - uuid: 137f19e6e2dc4219b33553b812627bc2
      name: 'Virtual machines'
  templates:
    - uuid: 178645e229484bcf9cb030dc1edccebb
      template: 'Oracle Cloud Autonomous Database by HTTP'
      name: 'Oracle Cloud Autonomous Database by HTTP'
      description: |
        This template monitors Oracle Cloud Infrastructure (OCI) autonomous database (serverless) resources.
        
        This template is not meant to be used independently, but together with Oracle Cloud by HTTP as a template for
        LLD host prototypes.
        
        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.0-0
      groups:
        - name: Templates/Cloud
      items:
        - uuid: 8520813edccc4fb9ba975c27914c5633
          name: 'Database availability'
          type: DEPENDENT
          key: oci.aut.db.availability
          value_type: FLOAT
          description: |
            The database is available for connections in the given minute.
            
          valuemap:
            name: 'Database availability'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.DatabaseAvailability
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 5h
          master_item:
            key: oci.aut.db.metrics.stats
          tags:
            - tag: component
              value: environment
          triggers:
            - uuid: 21b1a5c7d7754eb6be30098b2df99a22
              expression: 'last(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.availability) = 0'
              name: 'Database is not available'
              priority: HIGH
              description: 'Autonomous database is not available.'
              dependencies:
                - name: 'Database is not available or accessible'
                  expression: 'last(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.state) = 19 or last(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.state) = 20'
              tags:
                - tag: scope
                  value: availability
        - uuid: 038c4b2c000747799b60cb074aebbce5
          name: 'DB block changes'
          type: DEPENDENT
          key: oci.aut.db.block.changes
          description: |
            The number of changes that were part of an update or delete operation that were made to all blocks in the SGA.
            Such changes generate redo log entries and thus become permanent changes to the database if the transaction is committed.
            This statistic approximates total database work and indicates the rate at which buffers are being dirtied during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.DBBlockChanges
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: a471a74943b24a4a81347404e37b7359
          name: 'Failed connections'
          type: DEPENDENT
          key: oci.aut.db.conn.failed
          description: |
            The number of failed database connections.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.FailedConnections
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: cc1244e911314e9aaa6a995636848809
          name: 'CPU time'
          type: DEPENDENT
          key: oci.aut.db.cpu.time
          value_type: FLOAT
          description: |
            Average rate of accumulation of CPU time by foreground sessions in the database over the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.CpuTime
            - type: JAVASCRIPT
              parameters:
                - 'return Math.round(value * 100) / 100;'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: cpu
        - uuid: da165d0adf324b9e98390d122925fd67
          name: 'CPU utilization, in %'
          type: DEPENDENT
          key: oci.aut.db.cpu.util
          value_type: FLOAT
          units: '%'
          description: |
            The CPU usage expressed as a percentage, aggregated across all consumer groups. The utilization percentage is reported with respect to the number of CPUs the database is allowed to use.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.CpuUtilization
            - type: JAVASCRIPT
              parameters:
                - 'return Math.round(value * 100) / 100;'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: cpu
          triggers:
            - uuid: 59fd2d0eff9f4f5493cd0de94ba57572
              expression: 'min(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.cpu.util,5m) >= {$OCI.AUTONOMOUS.DB.CPU.UTIL.WARN}'
              name: 'Current CPU utilization is high'
              event_name: 'Current CPU utilization is high (util >= {$OCI.AUTONOMOUS.DB.CPU.UTIL.WARN}%)'
              opdata: 'Current: {ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'Current CPU utilization has exceeded `{$OCI.AUTONOMOUS.DB.CPU.UTIL.WARN}`% of the max available value.'
              dependencies:
                - name: 'Current CPU utilization is too high'
                  expression: 'min(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.cpu.util,5m) >= {$OCI.AUTONOMOUS.DB.CPU.UTIL.HIGH}'
              tags:
                - tag: scope
                  value: capacity
            - uuid: f8a53ef11d2140649bc701660183c33d
              expression: 'min(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.cpu.util,5m) >= {$OCI.AUTONOMOUS.DB.CPU.UTIL.HIGH}'
              name: 'Current CPU utilization is too high'
              event_name: 'Current CPU utilization is too high (util >= {$OCI.AUTONOMOUS.DB.CPU.UTIL.HIGH}%)'
              opdata: 'Current: {ITEM.LASTVALUE1}'
              priority: HIGH
              description: 'Current CPU utilization has exceeded `{$OCI.AUTONOMOUS.DB.CPU.UTIL.HIGH}`% of the max available value.'
              tags:
                - tag: scope
                  value: capacity
        - uuid: 47708f3446644bbc9afd11bd0e98d1f5
          name: 'Execute count'
          type: DEPENDENT
          key: oci.aut.db.exec.count
          description: |
            The number of user and recursive calls that executed SQL statements during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.ExecuteCount
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 4a1af0cbea8645cc897d64e3c1ac802e
          name: 'Connection latency'
          type: DEPENDENT
          key: oci.aut.db.latency.conn
          value_type: FLOAT
          units: s
          description: |
            The time taken to connect to an Oracle Autonomous Database Serverless instance in each region from a Compute service virtual machine in the same region.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.ConnectionLatency
            - type: MULTIPLIER
              parameters:
                - '0.001'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 5h
          master_item:
            key: oci.aut.db.metrics.stats
          tags:
            - tag: component
              value: environment
        - uuid: e233b1ab82384297b9ee88556969da31
          name: 'Query latency'
          type: DEPENDENT
          key: oci.aut.db.latency.query
          value_type: FLOAT
          units: s
          description: |
            The time taken to display the results of a simple query on the user's screen.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.QueryLatency
            - type: MULTIPLIER
              parameters:
                - '0.001'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 5h
          master_item:
            key: oci.aut.db.metrics.stats
          tags:
            - tag: component
              value: environment
        - uuid: b39b36b4a72b4cbf80584614c3d996ed
          name: 'Session logical reads'
          type: DEPENDENT
          key: oci.aut.db.logical.reads.session
          description: |
            The sum of `db block gets` and `consistent gets` during the selected time interval. This includes logical reads of database blocks from either the buffer cache or process private memory.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.LogicalReads
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 27b77344e5fc473693e48eb676ceb746
          name: 'Current logons'
          type: DEPENDENT
          key: oci.aut.db.logons
          description: |
            The number of successful logons during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.CurrentLogons
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: f4c0af10cea04decbb049c02f06795e4
          name: 'Failed logons'
          type: DEPENDENT
          key: oci.aut.db.logons.failed
          value_type: FLOAT
          description: |
            The number of logons that failed because of an invalid user name and/or password during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.FailedLogons
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 6104537179324cb48d82e05d64f3a19f
          name: 'Get frequent metrics'
          type: SCRIPT
          key: oci.aut.db.metrics.frequent.get
          history: '0'
          value_type: TEXT
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            function buildMql(id, metrics, defaultStatistic, resourceType) {
            	resourceType = resourceType === '' || resourceType === undefined ? 'resourceId' : resourceType;
            	this.query = '[' + params['req_interval'] + 'm]{' + resourceType + '=' + id + '}.';
            
            	for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
            		const metric = ((Array.isArray(metrics[i]) ? metrics[i] : [metrics[i], defaultStatistic]));
            		metrics[i] = [metric[0], this.query + metric[1]];
            	}
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'db_id', 'http_status_code', 'req_interval', 'compartment_id'], params);
            var oci = new OCI('Autonomous DB', 'Get metrics ' + params['req_interval'] + 'm', params);
            
            const metrics = [
            	['CpuTime', 'mean'],
            	['CpuUtilization', 'mean'],
            	['CurrentLogons', 'count'],
            	'DBBlockChanges',
            	['DBTime', 'mean'],
            	'ExecuteCount',
            	'FailedConnections',
            	['FailedLogons', 'mean'],
            	'HardParseCount',
            	'LogicalReads',
            	'ParseCount',
            	'ParseFailureCount',
            	'PhysicalReads',
            	'PhysicalReadTotalBytes',
            	'PhysicalWrites',
            	'PhysicalWriteTotalBytes',
            	'QueuedStatements',
            	'RedoGenerated',
            	['RunningStatements', 'mean'],
            	'Sessions',
            	'SQLNetBytesFromClient',
            	'SQLNetBytesFromDBLink',
            	'SQLNetBytesToClient',
            	'SQLNetBytesToDBLink',
            	'TransactionCount',
            	'UserCalls',
            	'UserCommits',
            	'UserRollbacks',
            	['WaitTime', 'mean']
            ];
            buildMql(params['db_id'], metrics, 'sum');
            
            var result = {};
            for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
            	result[metrics[i][0]] = oci.extractData('post', oci.executeRequest('post', '/20180401/metrics/actions/summarizeMetricsData', '?compartmentId=' + encodeURIComponent(params['compartment_id']), metrics[i][0] + metrics[i][1] + '()', 'oci_autonomous_database'), 'aggregatedDatapoints');
            }
            return JSON.stringify(result);
          description: |
            Gets all metrics related to the database that have a collection frequency of 1 minute.
            
          timeout: 30s
          parameters:
            - name: api_host
              value: '{$OCI.API.TELEMETRY.HOST}'
            - name: compartment_id
              value: '{$OCI.AUTONOMOUS.DB.COMPARTMENT.ID}'
            - name: db_id
              value: '{$OCI.AUTONOMOUS.DB.ID}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: req_interval
              value: '1'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          tags:
            - tag: component
              value: raw
        - uuid: 87a25240776a4b8a9a17ac053b69fd99
          name: 'Get database stats'
          type: SCRIPT
          key: oci.aut.db.metrics.stats
          delay: 5m
          history: '0'
          value_type: TEXT
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            function buildMql(id, metrics, defaultStatistic, resourceType) {
            	resourceType = resourceType === '' || resourceType === undefined ? 'resourceId' : resourceType;
            	this.query = '[' + params['req_interval'] + 'm]{' + resourceType + '=' + id + '}.';
            
            	for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
            		const metric = ((Array.isArray(metrics[i]) ? metrics[i] : [metrics[i], defaultStatistic]));
            		metrics[i] = [metric[0], this.query + metric[1]];
            	}
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'db_id', 'http_status_code', 'req_interval', 'compartment_id'], params);
            var oci = new OCI('Autonomous DB', 'Get metrics ' + params['req_interval'] + 'm', params);
            
            const metrics = [
            	['DatabaseAvailability', 'last'],
            	'ConnectionLatency',
            	'QueryLatency'
            ];
            buildMql(params['db_id'], metrics, 'max');
            
            var result = {};
            for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
            	result[metrics[i][0]] = oci.extractData('post', oci.executeRequest('post', '/20180401/metrics/actions/summarizeMetricsData', '?compartmentId=' + encodeURIComponent(params['compartment_id']), metrics[i][0] + metrics[i][1] + '()', 'oci_autonomous_database'), 'aggregatedDatapoints');
            }
            return JSON.stringify(result);
          description: |
            Gets all metrics related to specific database that have a collection frequency of 5 minutes.
            
          timeout: 30s
          parameters:
            - name: api_host
              value: '{$OCI.API.TELEMETRY.HOST}'
            - name: compartment_id
              value: '{$OCI.AUTONOMOUS.DB.COMPARTMENT.ID}'
            - name: db_id
              value: '{$OCI.AUTONOMOUS.DB.ID}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: req_interval
              value: '5'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          tags:
            - tag: component
              value: raw
        - uuid: cb2936c594e4450096559b3023f6aa4f
          name: 'Get storage stats'
          type: SCRIPT
          key: oci.aut.db.metrics.storage.stats
          delay: 60m
          history: '0'
          value_type: TEXT
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            function buildMql(id, metrics, defaultStatistic, resourceType) {
            	resourceType = resourceType === '' || resourceType === undefined ? 'resourceId' : resourceType;
            	this.query = '[' + params['req_interval'] + 'm]{' + resourceType + '=' + id + '}.';
            
            	for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
            		const metric = ((Array.isArray(metrics[i]) ? metrics[i] : [metrics[i], defaultStatistic]));
            		metrics[i] = [metric[0], this.query + metric[1]];
            	}
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'db_id', 'http_status_code', 'req_interval', 'compartment_id'], params);
            var oci = new OCI('Autonomous DB', 'Get metrics ' + params['req_interval'] + 'm', params);
            
            const metrics = [
            	'StorageAllocated',
            	'StorageMax',
            	'StorageUsed',
            	['StorageUtilization', 'mean']
            ];
            buildMql(params['db_id'], metrics, 'max');
            
            var result = {};
            for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
            	result[metrics[i][0]] = oci.extractData('post', oci.executeRequest('post', '/20180401/metrics/actions/summarizeMetricsData', '?compartmentId=' + encodeURIComponent(params['compartment_id']), metrics[i][0] + metrics[i][1] + '()', 'oci_autonomous_database'), 'aggregatedDatapoints');
            }
            return JSON.stringify(result);
          description: |
            Gets all storage metrics related to a specific database that have a collection frequency of 60 minutes.
            
          timeout: 30s
          parameters:
            - name: api_host
              value: '{$OCI.API.TELEMETRY.HOST}'
            - name: compartment_id
              value: '{$OCI.AUTONOMOUS.DB.COMPARTMENT.ID}'
            - name: db_id
              value: '{$OCI.AUTONOMOUS.DB.ID}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: req_interval
              value: '60'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          tags:
            - tag: component
              value: raw
        - uuid: 8ca09dafd8a744489ac122d995367a76
          name: 'Parse count (failures)'
          type: DEPENDENT
          key: oci.aut.db.parse.count.failed
          description: |
            The number of parse failures during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.ParseFailureCount
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 0f052e0dd75d4ae190c3b87581e29136
          name: 'Parse count (hard)'
          type: DEPENDENT
          key: oci.aut.db.parse.count.hard
          description: |
            The number of parse calls (real parses) during the selected time interval. A hard parse is an expensive operation in terms of memory use as it requires Oracle to allocate a workheap and other memory structures and then build a parse tree.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.HardParseCount
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: d5097f4c85ee40608ca8096f1d5f81c1
          name: 'Parse count (total)'
          type: DEPENDENT
          key: oci.aut.db.parse.count.total
          description: |
            The number of hard and soft parses during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.ParseCount
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: db1b10f32442428b89a0437176b94906
          name: 'Physical read total bytes'
          type: DEPENDENT
          key: oci.aut.db.physical.read.bytes
          units: B
          description: |
            The size in bytes of disk reads by all database instance activity including application reads, backup and recovery, and other utilities during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.PhysicalReadTotalBytes
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: a0e9f2b67c364a8baecc611ff1637399
          name: 'Physical reads'
          type: DEPENDENT
          key: oci.aut.db.physical.reads
          description: |
            The number of data blocks read from disk during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.PhysicalReads
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 81f85ed2baa44bb3a0b05255cc866c3e
          name: 'Physical write total bytes'
          type: DEPENDENT
          key: oci.aut.db.physical.write.bytes
          units: B
          description: |
            The size in bytes of all disk writes for the database instance including application activity, backup and recovery, and other utilities during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.PhysicalWriteTotalBytes
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 2b9998f8dd7d493496146d10fff0a5ee
          name: 'Physical writes'
          type: DEPENDENT
          key: oci.aut.db.physical.writes
          description: |
            The number of data blocks written to disk during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.PhysicalWrites
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 2acac07f1c30472a84b8864a6cfa7985
          name: 'Queued statements'
          type: DEPENDENT
          key: oci.aut.db.queued.statements
          description: |
            The number of queued SQL statements aggregated across all consumer groups during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.QueuedStatements
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 0f79764cca3f45688d79bb79c762ef99
          name: 'Redo generated'
          type: DEPENDENT
          key: oci.aut.db.redo.gen
          description: |
            Amount of redo generated in bytes during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.RedoGenerated
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 11ca43167a374fe99eab91817957a3fb
          name: Sessions
          type: DEPENDENT
          key: oci.aut.db.sessions
          description: |
            The number of sessions in the database.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.Sessions
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: a71a6114736f4ce89425ed8de504140d
          name: 'Bytes received via SQL*Net from client'
          type: DEPENDENT
          key: oci.aut.db.sqlnet.bytes.recv.client
          units: B
          description: |
            The number of bytes received from the client over Oracle Net Services during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.SQLNetBytesFromClient
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: a1555ae851e1432c94169e430a782c7d
          name: 'Bytes received via SQL*Net from DBLink'
          type: DEPENDENT
          key: oci.aut.db.sqlnet.bytes.recv.dblink
          units: B
          description: |
            The number of bytes received from a database link over Oracle Net Services during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.SQLNetBytesFromDBLink
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 35cdcf2b736745708910f2389a64670d
          name: 'Bytes sent via SQL*Net to client'
          type: DEPENDENT
          key: oci.aut.db.sqlnet.bytes.sent.client
          units: B
          description: |
            The number of bytes sent to the client from the foreground processes during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.SQLNetBytesToClient
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 5cc3975e76a842b89a7c6d2ac5108b8c
          name: 'Bytes sent via SQL*Net to DBLink'
          type: DEPENDENT
          key: oci.aut.db.sqlnet.bytes.sent.dblink
          units: B
          description: |
            The number of bytes sent over a database link during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.SQLNetBytesToDBLink
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 48d69be6970c41fcb110f18e18ff6387
          name: State
          type: SCRIPT
          key: oci.aut.db.state
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'db_id', 'http_status_code'], params);
            var oci = new OCI('Autonomous DB', 'Get state', params);
            
            return oci.extractData('get', oci.executeRequest('get', '/20160918/autonomousDatabases/' + encodeURIComponent(params['db_id']), ''), 'lifecycleState');
          description: |
            Gets the autonomous database state.
            
          valuemap:
            name: 'Autonomous database state'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  const idx = {
                  	'PROVISIONING': 1,
                  	'AVAILABLE': 2,
                  	'STOPPING': 3,
                  	'STOPPED': 4,
                  	'STARTING': 5,
                  	'TERMINATING': 6,
                  	'TERMINATED': 7,
                  	'RESTORE_IN_PROGRESS': 8,
                  	'RESTORE_FAILED': 9,
                  	'BACKUP_IN_PROGRESS': 10,
                  	'SCALE_IN_PROGRESS': 11,
                  	'AVAILABLE_NEEDS_ATTENTION': 12,
                  	'UPDATING': 13,
                  	'MAINTENANCE_IN_PROGRESS': 14,
                  	'RESTARTING': 15,
                  	'RECREATING': 16,
                  	'ROLE_CHANGE_IN_PROGRESS': 17,
                  	'UPGRADING': 18,
                  	'UNAVAILABLE': 19,
                  	'INACCESSIBLE': 20,
                  	'STANDBY': 21
                  };
                  
                  return typeof idx[value] === 'undefined' ? 0 : idx[value];
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          timeout: 10s
          parameters:
            - name: api_host
              value: '{$OCI.API.AUTONOMOUS.DB.HOST}'
            - name: db_id
              value: '{$OCI.AUTONOMOUS.DB.ID}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          tags:
            - tag: component
              value: environment
          triggers:
            - uuid: bb790262359f4e35af895b1a69ad511c
              expression: 'last(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.state) = 12'
              name: 'Available, needs attention'
              priority: WARNING
              description: 'Autonomous database is available, but needs attention.'
              tags:
                - tag: scope
                  value: availability
            - uuid: 18594a88549843c498d0e037f51afc59
              expression: 'last(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.state) = 19 or last(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.state) = 20'
              name: 'Database is not available or accessible'
              priority: HIGH
              description: 'Autonomous database is not available or accessible.'
              tags:
                - tag: scope
                  value: availability
            - uuid: 4ee1a96f29ef461c8830667e19637911
              expression: 'last(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.state) = 9'
              name: 'Restore has failed'
              priority: WARNING
              description: 'Autonomous database restore has failed.'
              tags:
                - tag: scope
                  value: notice
            - uuid: 783550ed705944259190fb10dae3f5a8
              expression: 'last(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.state,#1)<>last(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.state,#2)'
              name: 'State has changed'
              event_name: 'State has changed (new state: {ITEM.VALUE})'
              opdata: 'Current state: {ITEM.LASTVALUE}'
              priority: INFO
              description: 'Autonomous database state has changed.'
              manual_close: 'YES'
              dependencies:
                - name: 'Available, needs attention'
                  expression: 'last(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.state) = 12'
                - name: 'Database is not available or accessible'
                  expression: 'last(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.state) = 19 or last(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.state) = 20'
                - name: 'Restore has failed'
                  expression: 'last(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.state) = 9'
                - name: 'State unknown'
                  expression: 'last(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.state) = 0'
              tags:
                - tag: scope
                  value: notice
            - uuid: 2bc79a5a19a544d39c6de861b94564af
              expression: 'last(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.state) = 0'
              name: 'State unknown'
              priority: WARNING
              description: 'Autonomous database state is unknown.'
              tags:
                - tag: scope
                  value: availability
        - uuid: 6111b1843fe94fefbf1ca1d530832d39
          name: 'Running statements'
          type: DEPENDENT
          key: oci.aut.db.statements.running
          value_type: FLOAT
          description: |
            The number of running SQL statements aggregated across all consumer groups during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.RunningStatements
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 7901279fcb2a4f6285874680ed5f55f5
          name: 'Storage space allocated'
          type: DEPENDENT
          key: oci.aut.db.storage.space.alloc
          value_type: FLOAT
          units: B
          description: |
            Amount of space allocated to the database for all tablespaces during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.StorageAllocated
            - type: MULTIPLIER
              parameters:
                - '1073741824'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 12h
          master_item:
            key: oci.aut.db.metrics.storage.stats
          tags:
            - tag: component
              value: storage
        - uuid: 9dd27df012b24019ad2562822b471a25
          name: 'Maximum storage space'
          type: DEPENDENT
          key: oci.aut.db.storage.space.max
          value_type: FLOAT
          units: B
          description: |
            Maximum amount of storage reserved for the database during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.StorageMax
            - type: MULTIPLIER
              parameters:
                - '1073741824'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 12h
          master_item:
            key: oci.aut.db.metrics.storage.stats
          tags:
            - tag: component
              value: storage
        - uuid: e5378b6a3d33462eb4f3ed6228532d10
          name: 'Storage space used'
          type: DEPENDENT
          key: oci.aut.db.storage.space.used
          value_type: FLOAT
          units: B
          description: |
            Maximum amount of space used during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.StorageUsed
            - type: MULTIPLIER
              parameters:
                - '1073741824'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 12h
          master_item:
            key: oci.aut.db.metrics.storage.stats
          tags:
            - tag: component
              value: storage
        - uuid: 5cad114ed74341199a4d3ef17c9acd8e
          name: 'Storage utilization, in %'
          type: DEPENDENT
          key: oci.aut.db.storage.space.util
          value_type: FLOAT
          units: '%'
          description: |
            The percentage of the reserved maximum storage currently allocated for all database tablespaces. Represents the total reserved space for all tablespaces.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.StorageUtilization
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 12h
          master_item:
            key: oci.aut.db.metrics.storage.stats
          tags:
            - tag: component
              value: storage
          triggers:
            - uuid: 37bb41d830424ba2871e768957225add
              expression: 'min(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.storage.space.util,5m) >= {$OCI.AUTONOMOUS.DB.STORAGE.UTIL.WARN}'
              name: 'Current storage utilization is high'
              event_name: 'Current storage utilization is high (util >= {$OCI.AUTONOMOUS.DB.STORAGE.UTIL.WARN}%)'
              opdata: 'Current: {ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'Current storage utilization has exceeded `{$OCI.AUTONOMOUS.DB.STORAGE.UTIL.WARN}`% of the max available value.'
              dependencies:
                - name: 'Current storage utilization is too high'
                  expression: 'min(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.storage.space.util,5m) >= {$OCI.AUTONOMOUS.DB.STORAGE.UTIL.HIGH}'
              tags:
                - tag: scope
                  value: capacity
            - uuid: 8e16451106094713abaa624967026dc3
              expression: 'min(/Oracle Cloud Autonomous Database by HTTP/oci.aut.db.storage.space.util,5m) >= {$OCI.AUTONOMOUS.DB.STORAGE.UTIL.HIGH}'
              name: 'Current storage utilization is too high'
              event_name: 'Current storage utilization is too high (util >= {$OCI.AUTONOMOUS.DB.STORAGE.UTIL.HIGH}%)'
              opdata: 'Current: {ITEM.LASTVALUE1}'
              priority: HIGH
              description: 'Current storage utilization has exceeded `{$OCI.AUTONOMOUS.DB.STORAGE.UTIL.HIGH}`% of the max available value.'
              tags:
                - tag: scope
                  value: capacity
        - uuid: 3455978b6e2a4291984bf1e7c95551e1
          name: 'DB time'
          type: DEPENDENT
          key: oci.aut.db.time
          value_type: FLOAT
          description: |
            The amount of time database user sessions spend executing database code (CPU time + wait time). Database time is used to infer database call latency as it increases in direct proportion to both database call latency (response time) and call volume.
            It is calculated as the average rate of accumulation of database time by foreground sessions in the database over the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.DBTime
            - type: JAVASCRIPT
              parameters:
                - 'return Math.round(value * 100) / 100;'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 35995e92de8e45b0a8493bc285ccd0c8
          name: 'Transaction count'
          type: DEPENDENT
          key: oci.aut.db.transaction.count
          description: |
            The combined number of user commits and user rollbacks during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.TransactionCount
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 3e1cd8b4c829451499d605512e1a1bf0
          name: 'User calls'
          type: DEPENDENT
          key: oci.aut.db.user.calls
          description: |
            The combined number of logons, parses, and execute calls during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.UserCalls
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 0cda6a956ca1476da28083cfc6de8bcc
          name: 'User commits'
          type: DEPENDENT
          key: oci.aut.db.user.commits
          description: |
            The number of user commits during the selected time interval. When a user commits a transaction, the generated redo that reflects the changes made to database blocks must be written to disk. Commits often represent the closest thing to a user transaction rate.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.UserCommits
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 99292418f1764484b1cda27b70af84cc
          name: 'User rollbacks'
          type: DEPENDENT
          key: oci.aut.db.user.rollbacks
          description: |
            Number of times users manually issue the `ROLLBACK` statement or an error occurs during a user's transactions during the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.UserRollbacks
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
        - uuid: 8f627c48a0a94e41ad1b66d7a4817898
          name: 'Wait time'
          type: DEPENDENT
          key: oci.aut.db.wait.time
          value_type: FLOAT
          description: |
            Average rate of accumulation of non-idle wait time by foreground sessions in the database over the selected time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.WaitTime
            - type: JAVASCRIPT
              parameters:
                - 'return Math.round(value * 100) / 100;'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.aut.db.metrics.frequent.get
          tags:
            - tag: component
              value: environment
      tags:
        - tag: class
          value: cloud
        - tag: target
          value: oci
        - tag: target
          value: oracle-cloud-infrastructure
      macros:
        - macro: '{$OCI.AUTONOMOUS.DB.CPU.UTIL.HIGH}'
          value: '90'
          description: 'Sets the percentage threshold for creating a "high" severity event about CPU resource utilization.'
        - macro: '{$OCI.AUTONOMOUS.DB.CPU.UTIL.WARN}'
          value: '75'
          description: 'Sets the percentage threshold for creating a "warning" severity event about CPU resource utilization.'
        - macro: '{$OCI.AUTONOMOUS.DB.STORAGE.UTIL.HIGH}'
          value: '90'
          description: 'Sets the percentage threshold for creating a "high" severity event about storage resource utilization.'
        - macro: '{$OCI.AUTONOMOUS.DB.STORAGE.UTIL.WARN}'
          value: '75'
          description: 'Sets the percentage threshold for creating a "warning" severity event about storage resource utilization.'
        - macro: '{$OCI.HTTP.PROXY}'
          description: 'Set an HTTP proxy for OCI API requests if needed.'
        - macro: '{$OCI.HTTP.RETURN.CODE.OK}'
          value: '200'
          description: |
            Set the HTTP return code that represents an OK response from the API. The default is "200",  but can vary, for example, if a proxy is used.
            
      dashboards:
        - uuid: 26fb1668002c42e2b311eaef5850f2ad
          name: 'OCI Autonomous DB: Overview'
          pages:
            - name: Main
              display_period: '30'
              widgets:
                - type: item
                  name: State
                  width: '27'
                  height: '4'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 6C00D9
                    - type: STRING
                      name: description
                      value: 'Current State'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.state
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: INTEGER
                      name: units_show
                      value: '0'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                    - type: INTEGER
                      name: value_size
                      value: '35'
                - type: graph
                  name: 'CPU utilization'
                  'y': '4'
                  width: '21'
                  height: '7'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: CPU utilization'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: graph
                  name: 'Storage stats'
                  x: '21'
                  'y': '4'
                  width: '21'
                  height: '7'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: Storage stats'
                    - type: STRING
                      name: reference
                      value: AAAAB
                - type: item
                  name: Availability
                  x: '27'
                  width: '15'
                  height: '4'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 6C00D9
                    - type: STRING
                      name: description
                      value: Availability
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.availability
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: INTEGER
                      name: units_show
                      value: '0'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                    - type: INTEGER
                      name: value_size
                      value: '20'
                - type: item
                  name: 'Conenction latency'
                  x: '42'
                  width: '30'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 6C00D9
                    - type: INTEGER
                      name: decimal_size
                      value: '60'
                    - type: STRING
                      name: description
                      value: 'Conenction Latency'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_size
                      value: '30'
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.latency.conn
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '40'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                    - type: INTEGER
                      name: value_size
                      value: '60'
                - type: gauge
                  name: 'CPU utilization'
                  x: '42'
                  'y': '2'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: STRING
                      name: description
                      value: CPU
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: STRING
                      name: empty_color
                      value: 145C96
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.cpu.util
                    - type: STRING
                      name: max
                      value: '100'
                    - type: STRING
                      name: min
                      value: '0'
                    - type: INTEGER
                      name: rf_rate
                      value: '30'
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: INTEGER
                      name: show.2
                      value: '5'
                    - type: STRING
                      name: units
                      value: '%'
                    - type: INTEGER
                      name: units_bold
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: STRING
                      name: value_arc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: value_arc_size
                      value: '35'
                    - type: INTEGER
                      name: value_bold
                      value: '1'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: Sessions
                  x: '42'
                  'y': '5'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: Sessions
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.sessions
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Running statements'
                  x: '42'
                  'y': '8'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Running Statements'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.statements.running
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: gauge
                  name: 'Storage utilization'
                  x: '57'
                  'y': '2'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: STRING
                      name: description
                      value: 'Storage Utilization'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: STRING
                      name: empty_color
                      value: 00701c
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.storage.space.util
                    - type: STRING
                      name: max
                      value: '100'
                    - type: STRING
                      name: min
                      value: '0'
                    - type: INTEGER
                      name: rf_rate
                      value: '30'
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: INTEGER
                      name: show.2
                      value: '5'
                    - type: STRING
                      name: units
                      value: '%'
                    - type: INTEGER
                      name: units_bold
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: STRING
                      name: value_arc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: value_arc_size
                      value: '35'
                    - type: INTEGER
                      name: value_bold
                      value: '1'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Execute count'
                  x: '57'
                  'y': '5'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Execute Count'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.exec.count
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Queued statements'
                  x: '57'
                  'y': '8'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Queued Statements'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.queued.statements
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
            - name: CPU
              display_period: '30'
              widgets:
                - type: gauge
                  name: 'CPU utilization'
                  width: '36'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: STRING
                      name: description
                      value: CPU
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: STRING
                      name: empty_color
                      value: 145C96
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.cpu.util
                    - type: STRING
                      name: max
                      value: '100'
                    - type: STRING
                      name: min
                      value: '0'
                    - type: INTEGER
                      name: rf_rate
                      value: '30'
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: INTEGER
                      name: show.2
                      value: '5'
                    - type: STRING
                      name: units
                      value: '%'
                    - type: INTEGER
                      name: units_bold
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: STRING
                      name: value_arc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: value_arc_size
                      value: '35'
                    - type: INTEGER
                      name: value_bold
                      value: '1'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'CPU utilization'
                  'y': '3'
                  width: '36'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: CPU utilization'
                    - type: STRING
                      name: reference
                      value: ABAAA
                - type: gauge
                  name: 'CPU time'
                  x: '36'
                  width: '36'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: STRING
                      name: description
                      value: 'CPU Time'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: STRING
                      name: empty_color
                      value: 145C96
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.cpu.util
                    - type: STRING
                      name: max
                      value: '100'
                    - type: STRING
                      name: min
                      value: '0'
                    - type: INTEGER
                      name: rf_rate
                      value: '30'
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: INTEGER
                      name: show.2
                      value: '5'
                    - type: STRING
                      name: units
                      value: '%'
                    - type: INTEGER
                      name: units_bold
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: STRING
                      name: value_arc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: value_arc_size
                      value: '35'
                    - type: INTEGER
                      name: value_bold
                      value: '1'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'CPU time'
                  x: '36'
                  'y': '3'
                  width: '36'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: CPU time'
                    - type: STRING
                      name: reference
                      value: ABAAB
            - name: Storage
              display_period: '30'
              widgets:
                - type: gauge
                  name: 'Storage utilization'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: STRING
                      name: description
                      value: 'Storage Utilization'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: STRING
                      name: empty_color
                      value: 00701c
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.storage.space.util
                    - type: STRING
                      name: max
                      value: '100'
                    - type: STRING
                      name: min
                      value: '0'
                    - type: INTEGER
                      name: rf_rate
                      value: '30'
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: INTEGER
                      name: show.2
                      value: '5'
                    - type: STRING
                      name: units
                      value: '%'
                    - type: INTEGER
                      name: units_bold
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: STRING
                      name: value_arc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: value_arc_size
                      value: '35'
                    - type: INTEGER
                      name: value_bold
                      value: '1'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Storage utilization'
                  'y': '3'
                  width: '18'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: Storage utilization'
                    - type: STRING
                      name: reference
                      value: ACAAA
                - type: item
                  name: 'Max storage space'
                  x: '18'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Max storage space'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.storage.space.max
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Storage stats'
                  x: '18'
                  'y': '3'
                  width: '54'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: Storage stats'
                    - type: STRING
                      name: reference
                      value: ACAAB
                - type: item
                  name: 'Allocated Storage Space'
                  x: '36'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Allocated Storage Space'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.storage.space.alloc
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Used storage space'
                  x: '54'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Used Storage Space'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.storage.space.used
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
            - name: Read/Writes
              display_period: '30'
              widgets:
                - type: item
                  name: 'Physical reads'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Physical Reads'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.physical.reads
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: Read/writes
                  'y': '3'
                  width: '27'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: Physical reads/writes'
                    - type: STRING
                      name: reference
                      value: ADAAA
                - type: item
                  name: 'Physical writes'
                  x: '15'
                  width: '12'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Physical Writes'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.physical.writes
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Physical read total bytes'
                  x: '27'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Physical Read Total Bytes'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.physical.read.bytes
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Physical total read/write bytes'
                  x: '27'
                  'y': '3'
                  width: '27'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: Physical read/write total bytes'
                    - type: STRING
                      name: reference
                      value: ADAAB
                - type: item
                  name: 'Physical write total bytes'
                  x: '42'
                  width: '12'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Physical Write Total Bytes'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.physical.write.bytes
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Logical reads session'
                  x: '54'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Logical Reads Session'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.logical.reads.session
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Logical reads session'
                  x: '54'
                  'y': '3'
                  width: '18'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: Session logical reads'
                    - type: STRING
                      name: reference
                      value: ADAAC
                    - type: INTEGER
                      name: show_legend
                      value: '0'
            - name: Sessions
              display_period: '30'
              widgets:
                - type: item
                  name: Sessions
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: Sessions
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.sessions
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Failed connections'
                  'y': '3'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FF0000
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Failed Connections'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.conn.failed
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Session stats'
                  'y': '6'
                  width: '30'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: Session stats'
                    - type: STRING
                      name: reference
                      value: AEAAA
                - type: item
                  name: Logons
                  x: '15'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: Logons
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.logons
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Failed logons'
                  x: '15'
                  'y': '3'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FF0000
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Failed Logons'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.logons.failed
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Wait time'
                  x: '30'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Wait Time'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.wait.time
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Wait time'
                  x: '30'
                  'y': '3'
                  width: '15'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: Wait time'
                    - type: STRING
                      name: reference
                      value: AEAAB
                    - type: INTEGER
                      name: show_legend
                      value: '0'
                - type: item
                  name: 'DB time'
                  x: '45'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'DB Time'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.time
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'DB time'
                  x: '45'
                  'y': '3'
                  width: '15'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: DB time'
                    - type: STRING
                      name: reference
                      value: AEAAC
                    - type: INTEGER
                      name: show_legend
                      value: '0'
                - type: item
                  name: 'Connection latency'
                  x: '60'
                  width: '12'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Connection Latency'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.latency.conn
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Connection latency'
                  x: '60'
                  'y': '3'
                  width: '12'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: Connection latency'
                    - type: STRING
                      name: reference
                      value: AEAAD
                    - type: INTEGER
                      name: show_legend
                      value: '0'
            - name: Users
              display_period: '30'
              widgets:
                - type: item
                  name: 'User calls'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'User Calls'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.user.calls
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'User calls'
                  'y': '3'
                  width: '18'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: User calls'
                    - type: STRING
                      name: reference
                      value: AFAAA
                - type: item
                  name: 'User commits'
                  x: '18'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'User Commits'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.user.commits
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'User commits'
                  x: '18'
                  'y': '3'
                  width: '18'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: User commits'
                    - type: STRING
                      name: reference
                      value: AFAAB
                - type: item
                  name: 'User rollbacks'
                  x: '36'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'User Rollbacks'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.user.rollbacks
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'User rollbacks'
                  x: '36'
                  'y': '3'
                  width: '18'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: User rollbacks'
                    - type: STRING
                      name: reference
                      value: AFAAC
                - type: item
                  name: 'Execute count'
                  x: '54'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Execute Count'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.exec.count
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Execute count'
                  x: '54'
                  'y': '3'
                  width: '18'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: Execute count'
                    - type: STRING
                      name: reference
                      value: AFAAD
            - name: Parses
              display_period: '30'
              widgets:
                - type: item
                  name: 'Parse count (hard)'
                  width: '24'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Parse Count (Hard)'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.parse.count.hard
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Parse count (hard)'
                  'y': '3'
                  width: '24'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: Parse count hard'
                    - type: STRING
                      name: reference
                      value: AGAAA
                - type: item
                  name: 'Parse count (failures)'
                  x: '24'
                  width: '24'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Parse Count (Failures)'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.parse.count.failed
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Parse count (failures)'
                  x: '24'
                  'y': '3'
                  width: '24'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: Parse count failures'
                    - type: STRING
                      name: reference
                      value: AGAAB
                - type: item
                  name: 'Parse count (total)'
                  x: '48'
                  width: '24'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Parse Count (Total)'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.parse.count.total
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Parse count (total)'
                  x: '48'
                  'y': '3'
                  width: '24'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: Parse count total'
                    - type: STRING
                      name: reference
                      value: AGAAC
            - name: 'SQL*Net'
              display_period: '30'
              widgets:
                - type: item
                  name: 'Bytes received from client'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Bytes Received From Client'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.sqlnet.bytes.recv.client
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'SQL*Net client bytes'
                  'y': '3'
                  width: '36'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: SQL*Net client bytes'
                    - type: STRING
                      name: reference
                      value: AHAAA
                - type: item
                  name: 'Bytes sent to client'
                  x: '18'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Bytes Sent To Client'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.sqlnet.bytes.sent.client
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Bytes received from DBLink'
                  x: '36'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Bytes Received From DBLink'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.sqlnet.bytes.recv.dblink
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'SQL*Net DBLink bytes'
                  x: '36'
                  'y': '3'
                  width: '36'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: SQL*Net DBLink bytes'
                    - type: STRING
                      name: reference
                      value: AHAAB
                - type: item
                  name: 'Bytes sent to DBLink'
                  x: '54'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Bytes Sent To DBLink'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.sqlnet.bytes.sent.dblink
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
            - name: 'DB Calls'
              display_period: '30'
              widgets:
                - type: item
                  name: 'Query latency'
                  width: '21'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 6C00D9
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Query Latency'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.latency.query
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Query latency'
                  'y': '3'
                  width: '21'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: Query latency'
                    - type: STRING
                      name: reference
                      value: AIAAA
                - type: item
                  name: 'Running statements'
                  x: '21'
                  width: '12'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Running Statements'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.statements.running
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: Statements
                  x: '21'
                  'y': '3'
                  width: '36'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        name: 'OCI Autonomous DB: Statements'
                    - type: STRING
                      name: reference
                      value: AIAAB
                - type: item
                  name: 'Queued statements'
                  x: '33'
                  width: '12'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Queued Statements'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.queued.statements
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Transaction count'
                  x: '45'
                  width: '12'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Transaction Count'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.transaction.count
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'DB block changes'
                  x: '57'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'DB Block Changes'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.block.changes
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Redo generated'
                  x: '57'
                  'y': '3'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Redo Generated'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Autonomous Database by HTTP'
                        key: oci.aut.db.redo.gen
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
      valuemaps:
        - uuid: e336c0d4e22f4f9f9c42d6de65fed068
          name: 'Autonomous database state'
          mappings:
            - value: '0'
              newvalue: Unknown
            - value: '1'
              newvalue: Provisioning
            - value: '2'
              newvalue: Available
            - value: '3'
              newvalue: Stopping
            - value: '4'
              newvalue: Stopped
            - value: '5'
              newvalue: Starting
            - value: '6'
              newvalue: Terminating
            - value: '7'
              newvalue: Terminated
            - value: '8'
              newvalue: 'Restore in progress'
            - value: '9'
              newvalue: 'Restore failed'
            - value: '10'
              newvalue: 'Backup in progress'
            - value: '11'
              newvalue: 'Scale in progress'
            - value: '12'
              newvalue: 'Available needs attention'
            - value: '13'
              newvalue: Updating
            - value: '14'
              newvalue: 'Maintenance in progress'
            - value: '15'
              newvalue: Restarting
            - value: '16'
              newvalue: Recreating
            - value: '17'
              newvalue: 'Role change in progress'
            - value: '18'
              newvalue: Upgrading
            - value: '19'
              newvalue: Unavailable
            - value: '20'
              newvalue: Inaccessible
            - value: '21'
              newvalue: Standby
        - uuid: 3b30e8a71ef342e78f9f29243aafd992
          name: 'Database availability'
          mappings:
            - value: '0'
              newvalue: Unavailable
            - value: '1'
              newvalue: Available
    - uuid: 8afa1796d280425b99c7ea36900dac24
      template: 'Oracle Cloud Block Volume by HTTP'
      name: 'Oracle Cloud Block Volume by HTTP'
      description: |
        This template monitors Oracle Cloud Infrastructure (OCI) block volume resources.
        
        This template is not meant to be used independently, but together with Oracle Cloud by HTTP as a template for
        LLD host prototypes.
        
        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.0-0
      groups:
        - name: Templates/Cloud
      items:
        - uuid: dc2887a2b954406db8588c0ead37411f
          name: 'Volume guaranteed IOPS'
          type: DEPENDENT
          key: oci.block.volume.iops
          value_type: FLOAT
          units: '!IOPS'
          description: |
            Rate of change for guaranteed IOPS per SLA. Expressed as the average of guaranteed IOPS during a given time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.VolumeGuaranteedIOPS
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.block.volume.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: 5c1d0fd1686e4c74b33dbe12956d7b7c
          name: 'Get metrics'
          type: SCRIPT
          key: oci.block.volume.metrics.get
          history: '0'
          value_type: TEXT
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            function buildMql(id, metrics, defaultStatistic, resourceType) {
            	resourceType = resourceType === '' || resourceType === undefined ? 'resourceId' : resourceType;
            	this.query = '[' + params['req_interval'] + 'm]{' + resourceType + '=' + id + '}.';
            
            	for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
            		const metric = ((Array.isArray(metrics[i]) ? metrics[i] : [metrics[i], defaultStatistic]));
            		metrics[i] = [metric[0], this.query + metric[1]];
            	}
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'volume_id', 'http_status_code', 'req_interval', 'compartment_id'], params);
            var oci = new OCI('Block volume', 'Get metrics', params);
            
            const metrics = [
            	'VolumeReadThroughput',
            	'VolumeWriteThroughput',
            	'VolumeReadOps',
            	'VolumeWriteOps',
            	['VolumeThrottledIOs', 'sum'],
            	'VolumeGuaranteedVPUsPerGB',
            	'VolumeGuaranteedIOPS',
            	'VolumeGuaranteedThroughput'
            ];
            buildMql(params['volume_id'], metrics, 'mean');
            
            var result = {};
            for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
            	result[metrics[i][0]] = oci.extractData('post', oci.executeRequest('post', '/20180401/metrics/actions/summarizeMetricsData', '?compartmentId=' + encodeURIComponent(params['compartment_id']), metrics[i][0] + metrics[i][1] + '()', 'oci_blockstore'), 'aggregatedDatapoints');
            }
            return JSON.stringify(result);
          description: |
            Gets block volume metrics.
            
          timeout: 30s
          parameters:
            - name: api_host
              value: '{$OCI.API.TELEMETRY.HOST}'
            - name: compartment_id
              value: '{$OCI.VOLUME.BLOCK.COMPARTMENT.ID}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: req_interval
              value: '1'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
            - name: volume_id
              value: '{$OCI.VOLUME.BLOCK.ID}'
          tags:
            - tag: component
              value: raw
        - uuid: 680f9e8c96d34c099533adc99c33a48f
          name: 'Volume read throughput'
          type: DEPENDENT
          key: oci.block.volume.read
          value_type: FLOAT
          units: Bps
          description: |
            Read throughput. Expressed as bytes read per interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.VolumeReadThroughput
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.block.volume.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: 6b8060ce122142968e73da9a3e0813a1
          name: 'Volume read operations'
          type: DEPENDENT
          key: oci.block.volume.read.ops
          value_type: FLOAT
          units: '!reads'
          description: |
            Activity level from I/O reads. Expressed as reads per interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.VolumeReadOps
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.block.volume.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: 4fdab3067ada41219c8208862e7c8b14
          name: State
          type: SCRIPT
          key: oci.block.volume.state
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'volume_id', 'http_status_code'], params);
            var oci = new OCI('Block volume', 'Get volume state', params);
            
            return oci.extractData('get', oci.executeRequest('get', '/20160918/volumes/' + encodeURIComponent(params['volume_id']), ''), 'lifecycleState');
          description: |
            Gets the block volume state.
            
          valuemap:
            name: 'Block volume state'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  const idx = {
                  	'PROVISIONING': 1,
                  	'RESTORING': 2,
                  	'AVAILABLE': 3,
                  	'TERMINATING': 4,
                  	'TERMINATED': 5,
                  	'FAULTY': 6
                  };
                  
                  return typeof idx[value] === 'undefined' ? 0 : idx[value];
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          timeout: 10s
          parameters:
            - name: api_host
              value: '{$OCI.API.CORE.HOST}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
            - name: volume_id
              value: '{$OCI.VOLUME.BLOCK.ID}'
          tags:
            - tag: component
              value: storage
          triggers:
            - uuid: 4ea859d86e29455aa4bdd2f3667894f6
              expression: 'min(/Oracle Cloud Block Volume by HTTP/oci.block.volume.state,5m) = 0'
              name: 'Block volume state unknown'
              priority: WARNING
              description: 'Block volume state is unknown.'
              dependencies:
                - name: 'Block volume terminated or faulty'
                  expression: 'min(/Oracle Cloud Block Volume by HTTP/oci.block.volume.state,5m) >= 4'
              tags:
                - tag: scope
                  value: availability
            - uuid: b8d9491d762f40c58fb1094fa0468d9e
              expression: 'min(/Oracle Cloud Block Volume by HTTP/oci.block.volume.state,5m) >= 4'
              name: 'Block volume terminated or faulty'
              priority: HIGH
              description: 'Block volume state is "terminated"/"terminating" or "faulty".'
              tags:
                - tag: scope
                  value: availability
        - uuid: cc9ef37437b04a40a4b48a9f21e36ff1
          name: 'Volume throttled operations'
          type: DEPENDENT
          key: oci.block.volume.throttled.ops
          description: |
            Total sum of all the I/O operations that were throttled during a given time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.VolumeThrottledIOs
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.block.volume.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: d1b199adc996404db814ba7568b054df
          name: 'Volume guaranteed throughput'
          type: DEPENDENT
          key: oci.block.volume.throughput
          value_type: FLOAT
          units: Bps
          description: |
            Rate of change for guaranteed throughput per SLA. Expressed as megabytes per interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.VolumeGuaranteedThroughput
            - type: MULTIPLIER
              parameters:
                - '1048576'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.block.volume.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: 607f3c4a8197473bb1872e4ed45edd26
          name: 'Volume guaranteed VPUs/GB'
          type: DEPENDENT
          key: oci.block.volume.vpu
          value_type: FLOAT
          units: '!VPUs'
          description: |
            Rate of change for currently active VPUs/GB. Expressed as the average of active VPUs/GB during a given time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.VolumeGuaranteedVPUsPerGB
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.block.volume.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: 9ec2ce2d21154028a5623b5d0ac9c082
          name: 'Volume write throughput'
          type: DEPENDENT
          key: oci.block.volume.write
          value_type: FLOAT
          units: Bps
          description: |
            Write throughput. Expressed as bytes read per interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.VolumeWriteThroughput
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.block.volume.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: e55fee2db439493992a80e39ca647e9a
          name: 'Volume write operations'
          type: DEPENDENT
          key: oci.block.volume.write.ops
          value_type: FLOAT
          units: '!writes'
          description: |
            Activity level from I/O writes. Expressed as writes per interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.VolumeWriteOps
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.block.volume.metrics.get
          tags:
            - tag: component
              value: storage
      tags:
        - tag: class
          value: cloud
        - tag: target
          value: oci
        - tag: target
          value: oracle-cloud-infrastructure
      macros:
        - macro: '{$OCI.HTTP.PROXY}'
          description: 'Set an HTTP proxy for OCI API requests if needed.'
        - macro: '{$OCI.HTTP.RETURN.CODE.OK}'
          value: '200'
          description: |
            Set the HTTP return code that represents an OK response from the API. The default is "200",  but can vary, for example, if a proxy is used.
            
      dashboards:
        - uuid: f87041e2902c4286a648b0f53daee03f
          name: 'OCI Block Volume: Overview'
          pages:
            - name: Overview
              display_period: '30'
              widgets:
                - type: item
                  name: Availability
                  width: '27'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 6C00D9
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Block Volume by HTTP'
                        key: oci.block.volume.state
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: units_show
                      value: '0'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Volume read operations'
                  'y': '3'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Volume Read Operations'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Block Volume by HTTP'
                        key: oci.block.volume.read.ops
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: Operations
                  'y': '6'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Block Volume by HTTP'
                        name: 'OCI Block Volume: Operations'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: item
                  name: 'Volume write operations'
                  x: '18'
                  'y': '3'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Volume Write Operations'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Block Volume by HTTP'
                        key: oci.block.volume.write.ops
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Guaranteed IOPS'
                  x: '27'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Guaranteed IOPS'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Block Volume by HTTP'
                        key: oci.block.volume.iops
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Volume read throughput'
                  x: '36'
                  'y': '3'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Volume Read Throughput'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Block Volume by HTTP'
                        key: oci.block.volume.read
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: Throughput
                  x: '36'
                  'y': '6'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Block Volume by HTTP'
                        name: 'OCI Block Volume: Throughput'
                    - type: STRING
                      name: reference
                      value: AAAAB
                - type: item
                  name: 'Guaranteed throughput'
                  x: '42'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Guaranteed Throughput'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Block Volume by HTTP'
                        key: oci.block.volume.throughput
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Volume write throughput'
                  x: '54'
                  'y': '3'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Volume Write Throughput'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Block Volume by HTTP'
                        key: oci.block.volume.write
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Guaranteed VPUs/GB'
                  x: '57'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Guaranteed VPUs/GB'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Block Volume by HTTP'
                        key: oci.block.volume.vpu
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
      valuemaps:
        - uuid: 780a56fd95474839943cbd2f8be2fc18
          name: 'Block volume state'
          mappings:
            - value: '0'
              newvalue: Unknown
            - value: '1'
              newvalue: Provisioning
            - value: '2'
              newvalue: Restoring
            - value: '3'
              newvalue: Available
            - value: '4'
              newvalue: Terminating
            - value: '5'
              newvalue: Terminated
            - value: '6'
              newvalue: Faulty
    - uuid: e5486d98ff414c1391de1bd369a7f9db
      template: 'Oracle Cloud Boot Volume by HTTP'
      name: 'Oracle Cloud Boot Volume by HTTP'
      description: |
        Monitor Oracle Cloud Infrastructure (OCI) boot volume.
        
        This template is not meant to be used independently, but instead with Oracle Cloud by HTTP as a template for
        LLD host prototypes.
        
        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.0-0
      groups:
        - name: Templates/Cloud
      items:
        - uuid: c629f4e4424b48288b7e7058eef2ca92
          name: 'Volume guaranteed IOPS'
          type: DEPENDENT
          key: oci.boot.volume.iops
          value_type: FLOAT
          units: '!IOPS'
          description: |
            Rate of change for guaranteed IOPS per SLA. Expressed as the average of guaranteed IOPS during a given time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.VolumeGuaranteedIOPS
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.boot.volume.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: 388e89b8e68149438d714237e785ccde
          name: 'Get metrics'
          type: SCRIPT
          key: oci.boot.volume.metrics.get
          history: '0'
          value_type: TEXT
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            function buildMql(id, metrics, defaultStatistic, resourceType) {
            	resourceType = resourceType === '' || resourceType === undefined ? 'resourceId' : resourceType;
            	this.query = '[' + params['req_interval'] + 'm]{' + resourceType + '=' + id + '}.';
            
            	for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
            		const metric = ((Array.isArray(metrics[i]) ? metrics[i] : [metrics[i], defaultStatistic]));
            		metrics[i] = [metric[0], this.query + metric[1]];
            	}
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'volume_id', 'http_status_code', 'req_interval', 'compartment_id'], params);
            var oci = new OCI('Boot volume', 'Get metrics', params);
            
            const metrics = [
            	'VolumeReadThroughput',
            	'VolumeWriteThroughput',
            	'VolumeReadOps',
            	'VolumeWriteOps',
            	['VolumeThrottledIOs', 'sum'],
            	'VolumeGuaranteedVPUsPerGB',
            	'VolumeGuaranteedIOPS',
            	'VolumeGuaranteedThroughput'
            ];
            buildMql(params['volume_id'], metrics, 'mean');
            
            var result = {};
            for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
            	result[metrics[i][0]] = oci.extractData('post', oci.executeRequest('post', '/20180401/metrics/actions/summarizeMetricsData', '?compartmentId=' + encodeURIComponent(params['compartment_id']), metrics[i][0] + metrics[i][1] + '()', 'oci_blockstore'), 'aggregatedDatapoints');
            }
            return JSON.stringify(result);
          description: |
            Gets boot volume metrics.
            
          timeout: 30s
          parameters:
            - name: api_host
              value: '{$OCI.API.TELEMETRY.HOST}'
            - name: compartment_id
              value: '{$OCI.VOLUME.BOOT.COMPARTMENT.ID}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: req_interval
              value: '1'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
            - name: volume_id
              value: '{$OCI.VOLUME.BOOT.ID}'
          tags:
            - tag: component
              value: raw
        - uuid: 01700702f306414892828674c0046e5c
          name: 'Volume read throughput'
          type: DEPENDENT
          key: oci.boot.volume.read
          value_type: FLOAT
          units: Bps
          description: |
            Read throughput. Expressed as bytes read per interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.VolumeReadThroughput
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.boot.volume.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: b004ee7931dd4eccbfc89d3a8c363209
          name: 'Volume read operations'
          type: DEPENDENT
          key: oci.boot.volume.read.ops
          value_type: FLOAT
          units: '!reads'
          description: |
            Activity level from I/O reads. Expressed as reads per interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.VolumeReadOps
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.boot.volume.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: 3f0e4bed1fd14293b40b23595f01ebb1
          name: State
          type: SCRIPT
          key: oci.boot.volume.state
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'volume_id', 'http_status_code'], params);
            var oci = new OCI('Boot volume', 'Get volume state', params);
            
            return oci.extractData('get', oci.executeRequest('get', '/20160918/bootVolumes/' + encodeURIComponent(params['volume_id']), ''), 'lifecycleState');
          description: |
            Gets the boot volume state.
            
          valuemap:
            name: 'Boot volume state'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  const idx = {
                  	'PROVISIONING': 1,
                  	'RESTORING': 2,
                  	'AVAILABLE': 3,
                  	'TERMINATING': 4,
                  	'TERMINATED': 5,
                  	'FAULTY': 6
                  };
                  
                  return typeof idx[value] === 'undefined' ? 0 : idx[value];
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          timeout: 10s
          parameters:
            - name: api_host
              value: '{$OCI.API.CORE.HOST}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
            - name: volume_id
              value: '{$OCI.VOLUME.BOOT.ID}'
          tags:
            - tag: component
              value: storage
          triggers:
            - uuid: b31f698c5b164afc85a14acc813f463d
              expression: 'min(/Oracle Cloud Boot Volume by HTTP/oci.boot.volume.state,5m) = 0'
              name: 'Boot volume state unknown'
              priority: WARNING
              description: 'Boot volume state is unknown.'
              dependencies:
                - name: 'Boot volume terminated or faulty'
                  expression: 'min(/Oracle Cloud Boot Volume by HTTP/oci.boot.volume.state,5m) >= 4'
              tags:
                - tag: scope
                  value: availability
            - uuid: 6525eef6dd6c4cb0a22a6442773c3cfa
              expression: 'min(/Oracle Cloud Boot Volume by HTTP/oci.boot.volume.state,5m) >= 4'
              name: 'Boot volume terminated or faulty'
              priority: HIGH
              description: 'Boot volume state is "terminated"/"terminating" or "faulty".'
              tags:
                - tag: scope
                  value: availability
        - uuid: cfdc208b621b46508f9addc7ddb0808c
          name: 'Volume throttled operations'
          type: DEPENDENT
          key: oci.boot.volume.throttled.ops
          value_type: FLOAT
          description: |
            Total sum of all the I/O operations that were throttled during a given time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.VolumeThrottledIOs
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.boot.volume.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: 09bc5d7c95fe4b41bed9d786b78eba88
          name: 'Volume guaranteed throughput'
          type: DEPENDENT
          key: oci.boot.volume.throughput
          value_type: FLOAT
          units: Bps
          description: |
            Rate of change for guaranteed throughput per SLA. Expressed as megabytes per interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.VolumeGuaranteedThroughput
            - type: MULTIPLIER
              parameters:
                - '1048576'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.boot.volume.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: a3e5f888d2c84d7eb105f1061b9fadd1
          name: 'Volume guaranteed VPUs/GB'
          type: DEPENDENT
          key: oci.boot.volume.vpu
          value_type: FLOAT
          units: '!VPUs'
          description: |
            Rate of change for currently active VPUs/GB. Expressed as the average of active VPUs/GB during a given time interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.VolumeGuaranteedVPUsPerGB
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.boot.volume.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: a92206102a7a45d7b5c46096486465b6
          name: 'Volume write throughput'
          type: DEPENDENT
          key: oci.boot.volume.write
          value_type: FLOAT
          units: Bps
          description: |
            Write throughput. Expressed as bytes read per interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.VolumeWriteThroughput
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.boot.volume.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: 724197c8dcfe4c3ea52bc25d99de727c
          name: 'Volume write operations'
          type: DEPENDENT
          key: oci.boot.volume.write.ops
          value_type: FLOAT
          units: '!writes'
          description: |
            Activity level from I/O writes. Expressed as writes per interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.VolumeWriteOps
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.boot.volume.metrics.get
          tags:
            - tag: component
              value: storage
      tags:
        - tag: class
          value: cloud
        - tag: target
          value: oci
        - tag: target
          value: oracle-cloud-infrastructure
      macros:
        - macro: '{$OCI.HTTP.PROXY}'
          description: 'Set an HTTP proxy for OCI API requests if needed.'
        - macro: '{$OCI.HTTP.RETURN.CODE.OK}'
          value: '200'
          description: |
            Set the HTTP return code that represents an OK response from the API. The default is "200",  but can vary, for example, if a proxy is used.
            
      dashboards:
        - uuid: 67db0d25f18a45b4913a15ab2618608c
          name: 'OCI Boot Volume: Overview'
          pages:
            - name: Overview
              display_period: '30'
              widgets:
                - type: item
                  name: Availability
                  width: '27'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 6C00D9
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Boot Volume by HTTP'
                        key: oci.boot.volume.state
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: units_show
                      value: '0'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Volume read operations'
                  'y': '3'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Volume Read Operations'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Boot Volume by HTTP'
                        key: oci.boot.volume.read.ops
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: Operations
                  'y': '6'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Boot Volume by HTTP'
                        name: 'OCI Boot Volume: Operations'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: item
                  name: 'Volume write operations'
                  x: '18'
                  'y': '3'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Volume Write Operations'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Boot Volume by HTTP'
                        key: oci.boot.volume.write.ops
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Guaranteed IOPS'
                  x: '27'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: STRING
                      name: description
                      value: 'Guaranteed IOPS'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Boot Volume by HTTP'
                        key: oci.boot.volume.iops
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Volume read throughput'
                  x: '36'
                  'y': '3'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Volume Read Throughput'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Boot Volume by HTTP'
                        key: oci.boot.volume.read
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: Throughput
                  x: '36'
                  'y': '6'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Boot Volume by HTTP'
                        name: 'OCI Boot Volume: Throughput'
                    - type: STRING
                      name: reference
                      value: AAAAB
                - type: item
                  name: 'Guaranteed throughput'
                  x: '42'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Guaranteed Throughput'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Boot Volume by HTTP'
                        key: oci.boot.volume.throughput
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Volume write throughput'
                  x: '54'
                  'y': '3'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Volume Write Throughput'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Boot Volume by HTTP'
                        key: oci.boot.volume.write
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Guaranteed VPUs/GB'
                  x: '57'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Guaranteed VPUs/GB'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Boot Volume by HTTP'
                        key: oci.boot.volume.vpu
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
      valuemaps:
        - uuid: d881a2a2bedc4556a36f3d676ece0456
          name: 'Boot volume state'
          mappings:
            - value: '0'
              newvalue: Unknown
            - value: '1'
              newvalue: Provisioning
            - value: '2'
              newvalue: Restoring
            - value: '3'
              newvalue: Available
            - value: '4'
              newvalue: Terminating
            - value: '5'
              newvalue: Terminated
            - value: '6'
              newvalue: Faulty
    - uuid: 057558a26d934b4683d73a7058499d62
      template: 'Oracle Cloud by HTTP'
      name: 'Oracle Cloud by HTTP'
      description: |
        Monitor resources of Oracle Cloud Infrastructure (OCI) services.
        
        This template handles discovery of various OCI services.
        
        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.0-0
      groups:
        - name: Templates/Cloud
      discovery_rules:
        - uuid: 72fa6dfedfd8497298c5930f48594e72
          name: 'Block volumes discovery'
          type: SCRIPT
          key: oci.block.volumes.discovery
          delay: 1h
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function prepareCompartments(compartments, tenancy) {
            	if (typeof compartments === 'undefined' || compartments === '') {
            		return [tenancy];
            	} else {
            		return compartments.split(',')
            	}
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'http_status_code'], params);
            var oci = new OCI('Block volume', 'Get volumes', params);
            var compartments = prepareCompartments(params['compartment_ocid'], params['tenancy_ocid']);
            
            var buffer = [];
            compartments.forEach(function (compartment) {
            	Array.prototype.push.apply(buffer, oci.extractData('get', oci.executeRequest('get', '/20160918/volumes', '?compartmentId=' + encodeURIComponent(compartment)), ['id', 'displayName', 'lifecycleState', 'freeformTags'], compartment));
            })
            return JSON.stringify(buffer);
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAME}'
                value: '{$OCI.VOLUME.BLOCK.DISCOVERY.NAME.MATCHES}'
              - macro: '{#NAME}'
                value: '{$OCI.VOLUME.BLOCK.DISCOVERY.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#STATE}'
                value: '{$OCI.VOLUME.BLOCK.DISCOVERY.STATE.MATCHES}'
              - macro: '{#STATE}'
                value: '{$OCI.VOLUME.BLOCK.DISCOVERY.STATE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discover block volumes.'
          host_prototypes:
            - uuid: 5030f7dadd5b40558e07a4545d7346bd
              host: 'OCI Block Volume - {#ID}'
              name: 'OCI Block Volume - {#ID}'
              group_links:
                - group:
                    name: Applications
              templates:
                - name: 'Oracle Cloud Block Volume by HTTP'
              macros:
                - macro: '{$OCI.VOLUME.BLOCK.COMPARTMENT.ID}'
                  value: '{#COMPARTMENT}'
                  description: 'Block volume compartment ID.'
                - macro: '{$OCI.VOLUME.BLOCK.ID}'
                  value: '{#ID}'
                  description: 'Block volume ID.'
              tags:
                - tag: oci-block-vol-name
                  value: '{#NAME}'
                - tag: oci-compartment-id
                  value: '{#COMPARTMENT}'
          timeout: 10s
          parameters:
            - name: api_host
              value: '{$OCI.API.CORE.HOST}'
            - name: compartment_ocid
              value: '{$OCI.API.COMPARTMENT.VOLUME.BLOCK}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          lld_macro_paths:
            - lld_macro: '{#COMPARTMENT}'
              path: $.compartment
            - lld_macro: '{#ID}'
              path: $.id
            - lld_macro: '{#NAME}'
              path: $.name
            - lld_macro: '{#STATE}'
              path: $.state
        - uuid: 90982afdf2f9430bb1c5a3755d8e6c6d
          name: 'Boot volumes discovery'
          type: SCRIPT
          key: oci.boot.volumes.discovery
          delay: 1h
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function prepareCompartments(compartments, tenancy) {
            	if (typeof compartments === 'undefined' || compartments === '') {
            		return [tenancy];
            	} else {
            		return compartments.split(',')
            	}
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'http_status_code'], params);
            var oci = new OCI('Boot volume', 'Get volumes', params);
            var compartments = prepareCompartments(params['compartment_ocid'], params['tenancy_ocid']);
            
            var buffer = [];
            compartments.forEach(function (compartment) {
            	Array.prototype.push.apply(buffer, oci.extractData('get', oci.executeRequest('get', '/20160918/bootVolumes', '?compartmentId=' + encodeURIComponent(compartment)), ['id', 'displayName', 'lifecycleState', 'freeformTags'], compartment));
            })
            return JSON.stringify(buffer);
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAME}'
                value: '{$OCI.VOLUME.BOOT.DISCOVERY.NAME.MATCHES}'
              - macro: '{#NAME}'
                value: '{$OCI.VOLUME.BOOT.DISCOVERY.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#STATE}'
                value: '{$OCI.VOLUME.BOOT.DISCOVERY.STATE.MATCHES}'
              - macro: '{#STATE}'
                value: '{$OCI.VOLUME.BOOT.DISCOVERY.STATE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discover boot volumes.'
          host_prototypes:
            - uuid: 914b808a4a014f6e824a3b9c53f1b492
              host: 'OCI Boot Volume - {#ID}'
              name: 'OCI Boot Volume - {#ID}'
              group_links:
                - group:
                    name: Applications
              templates:
                - name: 'Oracle Cloud Boot Volume by HTTP'
              macros:
                - macro: '{$OCI.VOLUME.BOOT.COMPARTMENT.ID}'
                  value: '{#COMPARTMENT}'
                  description: 'Boot volume compartment ID.'
                - macro: '{$OCI.VOLUME.BOOT.ID}'
                  value: '{#ID}'
                  description: 'Boot volume ID.'
              tags:
                - tag: oci-boot-vol-name
                  value: '{#NAME}'
                - tag: oci-compartment-id
                  value: '{#COMPARTMENT}'
          timeout: 10s
          parameters:
            - name: api_host
              value: '{$OCI.API.CORE.HOST}'
            - name: compartment_ocid
              value: '{$OCI.API.COMPARTMENT.VOLUME.BOOT}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          lld_macro_paths:
            - lld_macro: '{#COMPARTMENT}'
              path: $.compartment
            - lld_macro: '{#ID}'
              path: $.id
            - lld_macro: '{#NAME}'
              path: $.name
            - lld_macro: '{#STATE}'
              path: $.state
        - uuid: ea4bbd0e9737406693aa0051cf861115
          name: 'Compute instances discovery'
          type: SCRIPT
          key: oci.compute.discovery
          delay: 1h
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function prepareCompartments(compartments, tenancy) {
            	if (typeof compartments === 'undefined' || compartments === '') {
            		return [tenancy];
            	} else {
            		return compartments.split(',')
            	}
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'http_status_code'], params);
            var oci = new OCI('Compute', 'Get instances', params);
            var compartments = prepareCompartments(params['compartment_ocid'], params['tenancy_ocid']);
            
            var buffer = [];
            compartments.forEach(function (compartment) {
            	Array.prototype.push.apply(buffer, oci.extractData('get', oci.executeRequest('get', '/20160918/instances', '?compartmentId=' + encodeURIComponent(compartment)), ['id', 'displayName', 'lifecycleState', 'freeformTags', 'availabilityDomain'], compartment));
            })
            return JSON.stringify(buffer);
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAME}'
                value: '{$OCI.COMPUTE.DISCOVERY.NAME.MATCHES}'
              - macro: '{#NAME}'
                value: '{$OCI.COMPUTE.DISCOVERY.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#STATE}'
                value: '{$OCI.COMPUTE.DISCOVERY.STATE.MATCHES}'
              - macro: '{#STATE}'
                value: '{$OCI.COMPUTE.DISCOVERY.STATE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discover compute instances.'
          host_prototypes:
            - uuid: 9337374066e04291b2f94f8ad5470f54
              host: 'OCI Compute - {#ID}'
              name: 'OCI Compute - {#ID}'
              group_links:
                - group:
                    name: 'Virtual machines'
              templates:
                - name: 'Oracle Cloud Compute by HTTP'
              macros:
                - macro: '{$OCI.COMPUTE.AVAILABILITY.DOMAIN}'
                  value: '{#DOMAIN}'
                  description: 'Availability domain for instance.'
                - macro: '{$OCI.COMPUTE.COMPARTMENT.ID}'
                  value: '{#COMPARTMENT}'
                  description: 'Compartment ID of OCI compute instance.'
                - macro: '{$OCI.COMPUTE.INSTANCE.ID}'
                  value: '{#ID}'
                  description: 'ID of OCI compute instance.'
              tags:
                - tag: oci-compartment-id
                  value: '{#COMPARTMENT}'
                - tag: oci-compute-name
                  value: '{#NAME}'
          timeout: 10s
          parameters:
            - name: api_host
              value: '{$OCI.API.CORE.HOST}'
            - name: compartment_ocid
              value: '{$OCI.API.COMPARTMENT.COMPUTE}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          lld_macro_paths:
            - lld_macro: '{#COMPARTMENT}'
              path: $.compartment
            - lld_macro: '{#DOMAIN}'
              path: $.domain
            - lld_macro: '{#ID}'
              path: $.id
            - lld_macro: '{#NAME}'
              path: $.name
            - lld_macro: '{#STATE}'
              path: $.state
        - uuid: c69611c5b86043b28c8ce2bc0627b377
          name: 'Autonomous database discovery'
          type: SCRIPT
          key: oci.object.autonomous.db.discovery
          delay: 1h
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function prepareCompartments(compartments, tenancy) {
            	if (typeof compartments === 'undefined' || compartments === '') {
            		return [tenancy];
            	} else {
            		return compartments.split(',')
            	}
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'http_status_code'], params);
            var oci = new OCI('Autonomous DB', 'Get DBs', params);
            var compartments = prepareCompartments(params['compartment_ocid'], params['tenancy_ocid']);
            
            var buffer = [];
            compartments.forEach(function (compartment) {
            	Array.prototype.push.apply(buffer, oci.extractData('get', oci.executeRequest('get', '/20160918/autonomousDatabases', '?compartmentId=' + encodeURIComponent(compartment)), ['id', 'dbName', 'lifecycleState', 'freeformTags'], compartment));
            })
            return JSON.stringify(buffer);
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAME}'
                value: '{$OCI.AUTONOMOUS.DB.DISCOVERY.NAME.MATCHES}'
              - macro: '{#NAME}'
                value: '{$OCI.AUTONOMOUS.DB.DISCOVERY.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#STATE}'
                value: '{$OCI.AUTONOMOUS.DB.DISCOVERY.STATE.MATCHES}'
              - macro: '{#STATE}'
                value: '{$OCI.AUTONOMOUS.DB.DISCOVERY.STATE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discover autonomous databases.'
          host_prototypes:
            - uuid: 88d0076a057c441ab5a531cfcb650e84
              host: 'OCI Autonomous DB - {#NAME}'
              name: 'OCI Autonomous DB - {#NAME}'
              group_links:
                - group:
                    name: Databases
              templates:
                - name: 'Oracle Cloud Autonomous Database by HTTP'
              macros:
                - macro: '{$OCI.AUTONOMOUS.DB.COMPARTMENT.ID}'
                  value: '{#COMPARTMENT}'
                  description: 'Autonomous database compartment ID.'
                - macro: '{$OCI.AUTONOMOUS.DB.ID}'
                  value: '{#ID}'
                  description: 'ID of OCI autonomous database.'
              tags:
                - tag: oci-aut-db-name
                  value: '{#NAME}'
                - tag: oci-compartment-id
                  value: '{#COMPARTMENT}'
          timeout: 10s
          parameters:
            - name: api_host
              value: '{$OCI.API.AUTONOMOUS.DB.HOST}'
            - name: compartment_ocid
              value: '{$OCI.API.COMPARTMENT.AUTONOMOUS.DB}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          lld_macro_paths:
            - lld_macro: '{#COMPARTMENT}'
              path: $.compartment
            - lld_macro: '{#ID}'
              path: $.id
            - lld_macro: '{#NAME}'
              path: $.name
            - lld_macro: '{#STATE}'
              path: $.state
        - uuid: e1949f127af04efeb8c192f23e45b58a
          name: 'Object storage discovery'
          type: SCRIPT
          key: oci.object.storage.discovery
          delay: 1h
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function prepareCompartments(compartments, tenancy) {
            	if (typeof compartments === 'undefined' || compartments === '') {
            		return [tenancy];
            	} else {
            		return compartments.split(',')
            	}
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'http_status_code'], params);
            var oci = new OCI('Object storage', 'Get buckets', params);
            var compartments = prepareCompartments(params['compartment_ocid'], params['tenancy_ocid']);
            const namespace = JSON.parse(oci.executeRequest('get', '/n', ''));
            
            var buffer = [];
            compartments.forEach(function (compartment) {
            	Array.prototype.push.apply(buffer, oci.extractData('get', oci.executeRequest('get', '/n/' + encodeURIComponent(namespace) + '/b/', '?compartmentId=' + encodeURIComponent(compartment) + '&fields=tags'), ['name', 'freeformTags'], compartment));
            })
            return JSON.stringify(buffer);
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAME}'
                value: '{$OCI.OBJECT.STORAGE.DISCOVERY.NAME.MATCHES}'
              - macro: '{#NAME}'
                value: '{$OCI.OBJECT.STORAGE.DISCOVERY.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discover object storage.'
          host_prototypes:
            - uuid: f71e979727ce42daa80a34da5ffb296f
              host: 'OCI Bucket - {#NAME}'
              name: 'OCI Bucket - {#NAME}'
              group_links:
                - group:
                    name: Applications
              templates:
                - name: 'Oracle Cloud Object Storage by HTTP'
              macros:
                - macro: '{$OCI.OBJECT.STORAGE.BUCKET}'
                  value: '{#NAME}'
                  description: 'Object storage bucket name.'
                - macro: '{$OCI.OBJECT.STORAGE.COMPARTMENT.ID}'
                  value: '{#COMPARTMENT}'
                  description: 'Object storage bucket compartment ID.'
              tags:
                - tag: oci-compartment-id
                  value: '{#COMPARTMENT}'
                - tag: oci-obj-store-name
                  value: '{#NAME}'
          timeout: 10s
          parameters:
            - name: api_host
              value: '{$OCI.API.OBJECT.STORAGE.HOST}'
            - name: compartment_ocid
              value: '{$OCI.API.COMPARTMENT.OBJECT.STORAGE}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          lld_macro_paths:
            - lld_macro: '{#COMPARTMENT}'
              path: $.compartment
            - lld_macro: '{#NAME}'
              path: $.name
        - uuid: 378d760173924bf48fbc25c74a520a8b
          name: 'Virtual cloud networks discovery'
          type: SCRIPT
          key: oci.vcn.discovery
          delay: 1h
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function prepareCompartments(compartments, tenancy) {
            	if (typeof compartments === 'undefined' || compartments === '') {
            		return [tenancy];
            	} else {
            		return compartments.split(',')
            	}
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'http_status_code'], params);
            var oci = new OCI('VCN', 'Get VCNs', params);
            var compartments = prepareCompartments(params['compartment_ocid'], params['tenancy_ocid']);
            
            var buffer = [];
            compartments.forEach(function (compartment) {
            	Array.prototype.push.apply(buffer, oci.extractData('get', oci.executeRequest('get', '/20160918/vcns', '?compartmentId=' + encodeURIComponent(compartment)), ['id', 'displayName', 'lifecycleState', 'freeformTags'], compartment));
            })
            return JSON.stringify(buffer);
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAME}'
                value: '{$OCI.VCN.DISCOVERY.NAME.MATCHES}'
              - macro: '{#NAME}'
                value: '{$OCI.VCN.DISCOVERY.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#STATE}'
                value: '{$OCI.VCN.DISCOVERY.STATE.MATCHES}'
              - macro: '{#STATE}'
                value: '{$OCI.VCN.DISCOVERY.STATE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: 'Discover virtual cloud networks (VCNs).'
          host_prototypes:
            - uuid: 5329fee3dbc643ebbb99472c67a0a207
              host: 'OCI VCN - {#ID}'
              name: 'OCI VCN - {#ID}'
              group_links:
                - group:
                    name: Applications
              templates:
                - name: 'Oracle Cloud Networking by HTTP'
              macros:
                - macro: '{$OCI.VCN.COMPARTMENT.ID}'
                  value: '{#COMPARTMENT}'
                  description: 'Compartment ID of OCI VCN (virtual cloud network).'
                - macro: '{$OCI.VCN.ID}'
                  value: '{#ID}'
                  description: 'ID of the OCI VCN (virtual cloud network).'
              tags:
                - tag: oci-compartment-id
                  value: '{#COMPARTMENT}'
                - tag: oci-vcn-name
                  value: '{#NAME}'
          timeout: 10s
          parameters:
            - name: api_host
              value: '{$OCI.API.CORE.HOST}'
            - name: compartment_ocid
              value: '{$OCI.API.COMPARTMENT.VCN}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          lld_macro_paths:
            - lld_macro: '{#COMPARTMENT}'
              path: $.compartment
            - lld_macro: '{#ID}'
              path: $.id
            - lld_macro: '{#NAME}'
              path: $.name
            - lld_macro: '{#STATE}'
              path: $.state
      tags:
        - tag: class
          value: cloud
        - tag: target
          value: oci
        - tag: target
          value: oracle-cloud-infrastructure
      macros:
        - macro: '{$OCI.API.AUTONOMOUS.DB.HOST}'
          description: 'Host for OCI Autonomous Database API endpoint.'
        - macro: '{$OCI.API.COMPARTMENT.AUTONOMOUS.DB}'
          description: 'Compartment OCIDs for autonomous databases. Can be a single value or a comma separated list of values.'
        - macro: '{$OCI.API.COMPARTMENT.COMPUTE}'
          description: 'Compartment OCIDs for compute instances. Can be a single value or a comma separated list of values.'
        - macro: '{$OCI.API.COMPARTMENT.OBJECT.STORAGE}'
          description: 'Compartment OCIDs for object storage buckets. Can be a single value or a comma separated list of values.'
        - macro: '{$OCI.API.COMPARTMENT.VCN}'
          description: 'Compartment OCIDs for virtual cloud networks. Can be a single value or a comma separated list of values.'
        - macro: '{$OCI.API.COMPARTMENT.VOLUME.BLOCK}'
          description: 'Compartment OCIDs for block volumes. Can be a single value or a comma separated list of values.'
        - macro: '{$OCI.API.COMPARTMENT.VOLUME.BOOT}'
          description: 'Compartment OCIDs for boot volumes. Can be a single value or a comma separated list of values.'
        - macro: '{$OCI.API.CORE.HOST}'
          description: 'Host for OCI Core Services API endpoint.'
        - macro: '{$OCI.API.FINGERPRINT}'
          type: SECRET_TEXT
          description: 'Fingerprint of private key.'
        - macro: '{$OCI.API.OBJECT.STORAGE.HOST}'
          description: 'Host for OCI Object Storage API endpoint.'
        - macro: '{$OCI.API.PRIVATE.KEY}'
          type: SECRET_TEXT
          description: 'Entire private key for API access.'
        - macro: '{$OCI.API.TELEMETRY.HOST}'
          description: 'Host for OCI Monitoring API endpoint.'
        - macro: '{$OCI.API.TENANCY}'
          description: 'OCID of tenancy.'
        - macro: '{$OCI.API.USER}'
          description: 'OCID of user.'
        - macro: '{$OCI.AUTONOMOUS.DB.DISCOVERY.NAME.MATCHES}'
          value: '.*'
          description: 'Sets the regex string of autonomous database names to allow in discovery.'
        - macro: '{$OCI.AUTONOMOUS.DB.DISCOVERY.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the regex string of autonomous database names to ignore in discovery.'
        - macro: '{$OCI.AUTONOMOUS.DB.DISCOVERY.STATE.MATCHES}'
          value: '.*'
          description: 'Sets the regex string of autonomous database states to allow in discovery.'
        - macro: '{$OCI.AUTONOMOUS.DB.DISCOVERY.STATE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the regex string of autonomous database states to ignore in discovery.'
        - macro: '{$OCI.COMPUTE.DISCOVERY.NAME.MATCHES}'
          value: '.*'
          description: 'Sets the regex string of compute instance names to allow in discovery.'
        - macro: '{$OCI.COMPUTE.DISCOVERY.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the regex string of compute instance names to ignore in discovery.'
        - macro: '{$OCI.COMPUTE.DISCOVERY.STATE.MATCHES}'
          value: '.*'
          description: 'Sets the regex string of compute instance states to allow in discovery.'
        - macro: '{$OCI.COMPUTE.DISCOVERY.STATE.NOT_MATCHES}'
          value: TERMINATED
          description: 'Sets the regex string of compute instance states to ignore in discovery.'
        - macro: '{$OCI.HTTP.PROXY}'
          description: 'Set an HTTP proxy for OCI API requests if needed.'
        - macro: '{$OCI.HTTP.RETURN.CODE.OK}'
          value: '200'
          description: |
            Set the HTTP return code that represents an OK response from the API. The default is "200",  but can vary, for example, if a proxy is used.
            
        - macro: '{$OCI.OBJECT.STORAGE.DISCOVERY.NAME.MATCHES}'
          value: '.*'
          description: 'Set an HTTP proxy for OCI API requests if needed.'
        - macro: '{$OCI.OBJECT.STORAGE.DISCOVERY.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Set an HTTP proxy for OCI API requests if needed.'
        - macro: '{$OCI.VCN.DISCOVERY.NAME.MATCHES}'
          value: '.*'
          description: 'Sets the regex string of virtual cloud network names to allow in discovery.'
        - macro: '{$OCI.VCN.DISCOVERY.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the regex string of virtual cloud network names to ignore in discovery.'
        - macro: '{$OCI.VCN.DISCOVERY.STATE.MATCHES}'
          value: '.*'
          description: 'Sets the regex string of virtual cloud network states to allow in discovery.'
        - macro: '{$OCI.VCN.DISCOVERY.STATE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the regex string of virtual cloud network states to ignore in discovery.'
        - macro: '{$OCI.VOLUME.BLOCK.DISCOVERY.NAME.MATCHES}'
          value: '.*'
          description: 'Sets the regex string of block volume names to allow in discovery.'
        - macro: '{$OCI.VOLUME.BLOCK.DISCOVERY.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the regex string of block volume names to ignore in discovery.'
        - macro: '{$OCI.VOLUME.BLOCK.DISCOVERY.STATE.MATCHES}'
          value: '.*'
          description: 'Sets the regex string of block volume states to allow in discovery.'
        - macro: '{$OCI.VOLUME.BLOCK.DISCOVERY.STATE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the regex string of block volume states to ignore in discovery.'
        - macro: '{$OCI.VOLUME.BOOT.DISCOVERY.NAME.MATCHES}'
          value: '.*'
          description: 'Sets the regex string of boot volume names to allow in discovery.'
        - macro: '{$OCI.VOLUME.BOOT.DISCOVERY.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the regex string of boot volume names to ignore in discovery.'
        - macro: '{$OCI.VOLUME.BOOT.DISCOVERY.STATE.MATCHES}'
          value: '.*'
          description: 'Sets the regex string of boot volume states to allow in discovery.'
        - macro: '{$OCI.VOLUME.BOOT.DISCOVERY.STATE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the regex string of boot volume states to ignore in discovery.'
    - uuid: e6b0aada359944d09ee4bd46c1a55587
      template: 'Oracle Cloud Compute by HTTP'
      name: 'Oracle Cloud Compute by HTTP'
      description: |
        This template monitors Oracle Cloud Infrastructure (OCI) single compute instance resources and discovers attached
        virtual network interface cards (VNICs) and monitors their resources.
        
        This template is not meant to be used independently, but together with Oracle Cloud by HTTP as a template for
        LLD host prototypes.
        
        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.0-0
      groups:
        - name: Templates/Cloud
      items:
        - uuid: 657ad1d54de4454696573418f5f17f11
          name: 'Get instance availability'
          type: SCRIPT
          key: oci.compute.availability.get
          delay: 5m
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'instance_id', 'http_status_code', 'req_interval', 'compartment_id'], params);
            var oci = new OCI('Compute', 'Get health', params);
            const mql = 'InstanceAccessibilityStatus[' + params['req_interval'] + 'm]{resourceId=' + params['instance_id'] + '}.max()';
            
            return JSON.stringify(oci.extractData('post', oci.executeRequest('post', '/20180401/metrics/actions/summarizeMetricsData', '?compartmentId=' + encodeURIComponent(params['compartment_id']), mql, 'oci_compute_instance_health'), 'aggregatedDatapoints'));
          description: |
            The accessibility status of a virtual machine instance. A value of "1" indicates that the instance is unresponsive due to an issue with the infrastructure or the instance itself. A value of "0" indicates that an accessibility issue has not been detected. If the instance is stopped, then the metric does not have a value.
            
          valuemap:
            name: 'Compute instance availability'
          timeout: 10s
          parameters:
            - name: api_host
              value: '{$OCI.API.TELEMETRY.HOST}'
            - name: compartment_id
              value: '{$OCI.COMPUTE.COMPARTMENT.ID}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: instance_id
              value: '{$OCI.COMPUTE.INSTANCE.ID}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: req_interval
              value: '5'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          tags:
            - tag: component
              value: environment
          triggers:
            - uuid: dbaee26c1de544d08fa6dd76ddc4c06a
              expression: 'last(/Oracle Cloud Compute by HTTP/oci.compute.availability.get) = 1'
              name: 'Compute instance is not available'
              priority: HIGH
              description: 'Current instance availability.'
              tags:
                - tag: scope
                  value: availability
        - uuid: 04a1f534ae844021be0935abf1214951
          name: 'CPU utilization, in %'
          type: DEPENDENT
          key: oci.compute.cpu.util
          value_type: FLOAT
          units: '%'
          description: |
            Activity level from the CPU. Expressed as a percentage of the total time.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.CpuUtilization
            - type: JAVASCRIPT
              parameters:
                - 'return Math.round(value * 100) / 100;'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.compute.metrics.get
          tags:
            - tag: component
              value: cpu
          triggers:
            - uuid: 38987527713b404f842e26ad12ce3015
              expression: 'min(/Oracle Cloud Compute by HTTP/oci.compute.cpu.util,5m) >= {$OCI.COMPUTE.CPU.UTIL.WARN}'
              name: 'Current CPU utilization is high'
              event_name: 'Current CPU utilization is high (util >= {$OCI.COMPUTE.CPU.UTIL.WARN}%)'
              opdata: 'Current: {ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'Current CPU utilization has exceeded `{$OCI.COMPUTE.CPU.UTIL.WARN}`% of the max available value.'
              dependencies:
                - name: 'Current CPU utilization is too high'
                  expression: 'min(/Oracle Cloud Compute by HTTP/oci.compute.cpu.util,5m) >= {$OCI.COMPUTE.CPU.UTIL.HIGH}'
              tags:
                - tag: scope
                  value: capacity
            - uuid: 082ba105bf614996a68054ad8c7d7101
              expression: 'min(/Oracle Cloud Compute by HTTP/oci.compute.cpu.util,5m) >= {$OCI.COMPUTE.CPU.UTIL.HIGH}'
              name: 'Current CPU utilization is too high'
              event_name: 'Current CPU utilization is too high (util >= {$OCI.COMPUTE.CPU.UTIL.HIGH}%)'
              opdata: 'Current: {ITEM.LASTVALUE1}'
              priority: HIGH
              description: 'Current CPU utilization has exceeded `{$OCI.COMPUTE.CPU.UTIL.HIGH}`% of the max available value.'
              tags:
                - tag: scope
                  value: capacity
        - uuid: 670783a729a647db9349d78ac61f1d94
          name: 'Disk read I/O'
          type: DEPENDENT
          key: oci.compute.disk.io.read
          value_type: FLOAT
          units: '!reads/s'
          description: |
            Activity level from I/O reads. Expressed as reads per interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.DiskIopsRead
            - type: JAVASCRIPT
              parameters:
                - 'return Math.round(value * 100) / 100;'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.compute.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: cbd32ebd403c48b2b2f9815f13407afe
          name: 'Disk write I/O'
          type: DEPENDENT
          key: oci.compute.disk.io.write
          value_type: FLOAT
          units: '!writes/s'
          description: |
            Activity level from I/O writes. Expressed as writes per interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.DiskIopsWritten
            - type: JAVASCRIPT
              parameters:
                - 'return Math.round(value * 100) / 100;'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.compute.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: 15d234ef381747bfb76e7ccf9169046d
          name: 'Disk bytes read'
          type: DEPENDENT
          key: oci.compute.disk.read
          value_type: FLOAT
          units: Bps
          description: |
            Read throughput. Expressed as bytes read per interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.DiskBytesRead
            - type: JAVASCRIPT
              parameters:
                - 'return Math.round(value * 100) / 100;'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.compute.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: c7e061599b474ac49082d28572ab74c6
          name: 'Disk bytes written'
          type: DEPENDENT
          key: oci.compute.disk.written
          value_type: FLOAT
          units: Bps
          description: |
            Write throughput. Expressed as bytes written per interval.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.DiskBytesWritten
            - type: JAVASCRIPT
              parameters:
                - 'return Math.round(value * 100) / 100;'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.compute.metrics.get
          tags:
            - tag: component
              value: storage
        - uuid: 75308c4fb9bd4bad8fbb80aa9b62b099
          name: 'Load average'
          type: DEPENDENT
          key: oci.compute.load.avg
          value_type: FLOAT
          units: '!processes'
          description: |
            Average system load calculated over a 1-minute period. Expressed as a number of processes.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.LoadAverage
            - type: JAVASCRIPT
              parameters:
                - 'return Math.round(value * 100) / 100;'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.compute.metrics.get
          tags:
            - tag: component
              value: environment
        - uuid: 610796958f694aa99f3e9ea1082972bf
          name: 'Memory allocation stalls'
          type: DEPENDENT
          key: oci.compute.mem.stalls
          value_type: FLOAT
          units: '!stalls'
          description: |
            Number of times page reclaim was called directly.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.MemoryAllocationStalls
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.compute.metrics.get
          tags:
            - tag: component
              value: memory
        - uuid: ef284ac17689442e835b686126161bc5
          name: 'Memory utilization, in %'
          type: DEPENDENT
          key: oci.compute.mem.util
          value_type: FLOAT
          units: '%'
          description: |
            Space currently in use, measured in pages. Expressed as a percentage of used pages.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.MemoryUtilization
            - type: JAVASCRIPT
              parameters:
                - 'return Math.round(value * 100) / 100;'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.compute.metrics.get
          tags:
            - tag: component
              value: memory
          triggers:
            - uuid: 9baaacf70a4446a7ae816afdc4db0ae8
              expression: 'min(/Oracle Cloud Compute by HTTP/oci.compute.mem.util,5m) >= {$OCI.COMPUTE.MEM.UTIL.WARN}'
              name: 'Current memory utilization is high'
              event_name: 'Current memory utilization is high (util >= {$OCI.COMPUTE.MEM.UTIL.WARN}%)'
              opdata: 'Current: {ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'Current memory utilization has exceeded `{$OCI.COMPUTE.MEM.UTIL.WARN}`% of the max available value.'
              dependencies:
                - name: 'Current memory utilization is too high'
                  expression: 'min(/Oracle Cloud Compute by HTTP/oci.compute.mem.util,5m) >= {$OCI.COMPUTE.MEM.UTIL.HIGH}'
              tags:
                - tag: scope
                  value: capacity
            - uuid: 3b894aa250f04ebdb63fb8a914fbd72a
              expression: 'min(/Oracle Cloud Compute by HTTP/oci.compute.mem.util,5m) >= {$OCI.COMPUTE.MEM.UTIL.HIGH}'
              name: 'Current memory utilization is too high'
              event_name: 'Current memory utilization is too high (util >= {$OCI.COMPUTE.MEM.UTIL.HIGH}%)'
              opdata: 'Current: {ITEM.LASTVALUE1}'
              priority: HIGH
              description: 'Current memory utilization has exceeded `{$OCI.COMPUTE.MEM.UTIL.HIGH}`% of the max available value.'
              tags:
                - tag: scope
                  value: capacity
        - uuid: 65ff665a67374bb082f260ca473dfb1b
          name: 'Get compute metrics'
          type: SCRIPT
          key: oci.compute.metrics.get
          history: '0'
          value_type: TEXT
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            function buildMql(id, metrics, defaultStatistic, resourceType) {
            	resourceType = resourceType === '' || resourceType === undefined ? 'resourceId' : resourceType;
            	this.query = '[' + params['req_interval'] + 'm]{' + resourceType + '=' + id + '}.';
            
            	for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
            		const metric = ((Array.isArray(metrics[i]) ? metrics[i] : [metrics[i], defaultStatistic]));
            		metrics[i] = [metric[0], this.query + metric[1]];
            	}
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'instance_id', 'http_status_code', 'req_interval', 'compartment_id'], params);
            var oci = new OCI('Compute', 'Get metrics', params);
            
            const metrics = [
            	['CpuUtilization', 'mean'],
            	['MemoryUtilization', 'mean'],
            	['LoadAverage', 'mean'],
            	['MemoryAllocationStalls', 'mean'],
            	'DiskBytesRead',
            	'DiskBytesWritten',
            	'DiskIopsRead',
            	'DiskIopsWritten',
            	'NetworksBytesIn',
            	'NetworksBytesOut'
            ];
            buildMql(params['instance_id'], metrics, 'rate');
            
            var result = {};
            for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
            	result[metrics[i][0]] = oci.extractData('post', oci.executeRequest('post', '/20180401/metrics/actions/summarizeMetricsData', '?compartmentId=' + encodeURIComponent(params['compartment_id']), metrics[i][0] + metrics[i][1] + '()', 'oci_computeagent'), 'aggregatedDatapoints');
            }
            return JSON.stringify(result);
          description: |
            Gets compute instance metrics.
            
          timeout: 30s
          parameters:
            - name: api_host
              value: '{$OCI.API.TELEMETRY.HOST}'
            - name: compartment_id
              value: '{$OCI.COMPUTE.COMPARTMENT.ID}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: instance_id
              value: '{$OCI.COMPUTE.INSTANCE.ID}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: req_interval
              value: '1'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          tags:
            - tag: component
              value: raw
        - uuid: 0c910a86a99b47f08dee930f07422f45
          name: 'Network bytes in'
          type: DEPENDENT
          key: oci.compute.network.in
          value_type: FLOAT
          units: Bps
          description: |
            Network bytes in for the compute instance.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.NetworksBytesIn
            - type: JAVASCRIPT
              parameters:
                - 'return Math.round(value * 100) / 100;'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.compute.metrics.get
          tags:
            - tag: component
              value: network
        - uuid: a7a027ae583740e19e5f6288b3f15d10
          name: 'Network bytes out'
          type: DEPENDENT
          key: oci.compute.network.out
          value_type: FLOAT
          units: Bps
          description: |
            Network bytes out for the compute instance.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.NetworksBytesOut
            - type: JAVASCRIPT
              parameters:
                - 'return Math.round(value * 100) / 100;'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.compute.metrics.get
          tags:
            - tag: component
              value: network
        - uuid: 3c4a11c3c8fe40fca36635e2a6882816
          name: State
          type: SCRIPT
          key: oci.compute.state.get
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'instance_id', 'http_status_code'], params);
            var oci = new OCI('Compute', 'Get state', params);
            
            return oci.extractData('get', oci.executeRequest('get', '/20160918/instances/' + encodeURIComponent(params['instance_id']), ''), 'lifecycleState');
          description: |
            The current state of the instance.
            
          valuemap:
            name: 'Compute instance state'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  const idx = {
                  	'MOVING': 1,
                  	'PROVISIONING': 2,
                  	'RUNNING': 3,
                  	'STARTING': 4,
                  	'STOPPING': 5,
                  	'STOPPED': 6,
                  	'CREATING_IMAGE': 7,
                  	'TERMINATING': 8,
                  	'TERMINATED': 9
                  };
                  
                  return typeof idx[value] === 'undefined' ? 0 : idx[value];
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          timeout: 10s
          parameters:
            - name: api_host
              value: '{$OCI.API.CORE.HOST}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: instance_id
              value: '{$OCI.COMPUTE.INSTANCE.ID}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          tags:
            - tag: component
              value: environment
          triggers:
            - uuid: 2bce7c23998f4331a5eca3507fc671d9
              expression: 'last(/Oracle Cloud Compute by HTTP/oci.compute.state.get,#1)<>last(/Oracle Cloud Compute by HTTP/oci.compute.state.get,#2)'
              name: 'State has changed'
              event_name: 'State has changed (new state: {ITEM.VALUE})'
              opdata: 'Current state: {ITEM.LASTVALUE}'
              priority: INFO
              description: 'Compute instance state has changed.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: c0e74098afb14984af6355ac0711662e
          name: 'Get VNICs'
          type: SCRIPT
          key: oci.compute.vnic.get
          history: '0'
          value_type: TEXT
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'instance_id', 'availability_domain', 'http_status_code', 'compartment_id'], params);
            var oci = new OCI('Compute', 'Get VNICs', params);
            
            return JSON.stringify(oci.extractData('get', oci.executeRequest('get', '/20160918/vnicAttachments', '?compartmentId=' + encodeURIComponent(params['compartment_id']) + '&availabilityDomain=' + encodeURIComponent(params['availability_domain']) + '&instanceId=' + encodeURIComponent(params['instance_id'])), ['vnicId', 'displayName', 'lifecycleState']));
          description: |
            Gets information about all virtual network interface cards attached to the instance.
            
          timeout: 30s
          parameters:
            - name: api_host
              value: '{$OCI.API.CORE.HOST}'
            - name: availability_domain
              value: '{$OCI.COMPUTE.AVAILABILITY.DOMAIN}'
            - name: compartment_id
              value: '{$OCI.COMPUTE.COMPARTMENT.ID}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: instance_id
              value: '{$OCI.COMPUTE.INSTANCE.ID}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          tags:
            - tag: component
              value: raw
      discovery_rules:
        - uuid: 4f4a058b2a0b4bddb4ddbdb7613934af
          name: 'VNIC discovery'
          type: DEPENDENT
          key: oci.compute.vnic.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAME}'
                value: '{$OCI.COMPUTE.VNIC.DISCOVERY.NAME.MATCHES}'
              - macro: '{#NAME}'
                value: '{$OCI.COMPUTE.VNIC.DISCOVERY.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#STATE}'
                value: '{$OCI.COMPUTE.VNIC.DISCOVERY.STATE.MATCHES}'
              - macro: '{#STATE}'
                value: '{$OCI.COMPUTE.VNIC.DISCOVERY.STATE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: |
            Discover compute instance VNICs.
            
          item_prototypes:
            - uuid: 45fc4a9241f147c88e45352ac0f5018d
              name: 'VNIC [{#NAME}]: Attachment state'
              type: DEPENDENT
              key: 'oci.compute.vnic.attachment[{#ID}]'
              description: |
                Current attachment state of the VNIC.
                
              valuemap:
                name: 'VNIC attachment state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$[?(@.id == ''{#ID}'')].state.first()'
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const idx = {
                      	'ATTACHING': 1,
                      	'ATTACHED': 2,
                      	'DETACHING': 3,
                      	'DETACHED': 4
                      };
                      
                      return typeof idx[value] === 'undefined' ? 0 : idx[value];
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: oci.compute.vnic.get
              tags:
                - tag: component
                  value: network
                - tag: vnic
                  value: '{#ID}'
              trigger_prototypes:
                - uuid: 7176da6364464cfcacadfcfe7e81fdb3
                  expression: 'min(/Oracle Cloud Compute by HTTP/oci.compute.vnic.attachment[{#ID}],5m) >= 3'
                  name: 'VNIC [{#NAME}]: VNIC is not attached'
                  priority: HIGH
                  description: 'Virtual network interface card attachment status.'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: a9f4e55f3dd848b8bf0c861c81c2690a
              name: 'VNIC [{#NAME}]: Egress packets dropped by security list'
              type: DEPENDENT
              key: 'oci.compute.vnic.egress.packets.dropped[{#ID}]'
              units: '!packets'
              description: |
                Packets sent by the VNIC, destined for the network, dropped due to security rule violations.
                
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.VnicEgressDropsSecurityList
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'oci.compute.vnic.metrics.get[{#ID}]'
              tags:
                - tag: component
                  value: network
                - tag: vnic
                  value: '{#ID}'
            - uuid: 0ac50b3b570a470ca301185489c4d2a4
              name: 'VNIC [{#NAME}]: Smartnic buffer drops from host'
              type: DEPENDENT
              key: 'oci.compute.vnic.host.smartnic.drops[{#ID}]'
              units: '!packets'
              description: |
                Number of packets dropped in SmartNIC from the host due to buffer exhaustion. This metric is available only for Bare Metal Instances. For virtual machines, these metric values are zero.
                
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.SmartnicBufferDropsFromHost
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'oci.compute.vnic.metrics.get[{#ID}]'
              tags:
                - tag: component
                  value: network
                - tag: vnic
                  value: '{#ID}'
            - uuid: 86258bd1db6a46c9862f175acac2daf2
              name: 'VNIC [{#NAME}]: Ingress packets dropped by security list'
              type: DEPENDENT
              key: 'oci.compute.vnic.ingress.packets.dropped[{#ID}]'
              units: '!packets'
              description: |
                Packets received from the network, destined for the VNIC, dropped due to security rule violations.
                
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.VnicIngressDropsSecurityList
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'oci.compute.vnic.metrics.get[{#ID}]'
              tags:
                - tag: component
                  value: network
                - tag: vnic
                  value: '{#ID}'
            - uuid: eb79782153524452ba4ba8506fb207a5
              name: 'VNIC [{#NAME}]: Get metrics'
              type: SCRIPT
              key: 'oci.compute.vnic.metrics.get[{#ID}]'
              history: '0'
              value_type: TEXT
              params: |
                function validateZabbixParams(requiredParams, allParams) {
                	requiredParams.forEach(function (field) {
                		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
                			throw 'Required param is not set: ' + field + '.';
                		}
                	});
                }
                
                function OCI(service, action, params) {
                	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
                	this.request = new HttpRequest();
                
                	this.hash = function (string) {
                		return sha256(string);
                	};
                
                	this.sign = function (string) {
                		return sign('sha256', params['private_key'], string);
                	};
                
                	this.encode = function (hash) {
                		const hexArr = hash.match(/.{1,2}/g);
                		var uInt8Array = new Uint8Array(hexArr.length);
                		hexArr.forEach(function (hex, idx) {
                			uInt8Array[idx] = parseInt(hex, 16);
                		});
                		return btoa(uInt8Array);
                	};
                
                	this.getDate = function () {
                		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
                		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
                		const today = new Date();
                		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
                	};
                
                	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
                		var headers = '(request-target) date host';
                		const contentTypeHeader = 'content-type: application/json';
                		const dateHeader = 'date: ' + this.getDate();
                		const hostHeader = 'host: ' + params['api_host'];
                		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
                		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
                		var reqHeaders = [contentTypeHeader, dateHeader];
                
                		if (httpMethod === 'post') {
                			var body = JSON.stringify({
                				'namespace': namespace,
                				'query': mql
                			});
                			headers = headers + ' x-content-sha256 content-type content-length';
                			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
                			const bodyLengthHeader = 'content-length: ' + body.length;
                			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
                			reqHeaders.push(bodyHeader, bodyLengthHeader);
                		}
                
                		const signature = this.encode(this.sign(signingString));
                
                		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
                		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
                			this.request.addHeader(reqHeaders[header]);
                		}
                
                		if (params['http_proxy']) {
                			this.request.setProxy(params['http_proxy']);
                			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
                		}
                
                		if (httpMethod === 'post') {
                			var apiRateLimitExceeded = false;
                			do {
                				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
                
                				try {
                					if (JSON.parse(response)['code'] === 'TooManyRequests') {
                
                						apiRateLimitExceeded = true;
                						Zabbix.sleep(1000);
                					} else {
                						apiRateLimitExceeded = false;
                					}
                				} catch (error) {
                					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
                					throw 'Could not parse the response. See logs for more information.';
                				}
                			} while (apiRateLimitExceeded);
                		} else {
                			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
                		}
                
                		this.request.clearHeader();
                
                		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
                			return response;
                		} else {
                			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
                			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
                		}
                	};
                
                	this.extractData = function (httpMethod, data, keys, compartment) {
                		try {
                			data = JSON.parse(data);
                		} catch (error) {
                			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
                			throw 'Could not parse received JSON object. See logs for more information.';
                		}
                
                		if (typeof keys == 'object') {
                			var returnBuffer = [];
                			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
                
                				var objectBuffer = {};
                				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
                					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
                						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
                					} else {
                						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
                						throw 'Received an unexpected JSON object. See logs for more information.';
                					}
                				}
                				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
                				returnBuffer.push(objectBuffer);
                			}
                			return returnBuffer;
                		}
                
                		try {
                			if (httpMethod === 'get') {
                				return data[keys];
                			} else {
                				if (data.length === 0) {
                					return 0;
                				}
                				data = data[0][keys];
                				return data[data.length - 1]['value'];
                			}
                		} catch (error) {
                			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
                			throw 'Could not find required key in JSON object. See logs for more information.';
                		}
                	};
                }
                
                function buildMql(id, metrics, defaultStatistic, resourceType) {
                	resourceType = resourceType === '' || resourceType === undefined ? 'resourceId' : resourceType;
                	this.query = '[' + params['req_interval'] + 'm]{' + resourceType + '=' + id + '}.';
                
                	for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
                		const metric = ((Array.isArray(metrics[i]) ? metrics[i] : [metrics[i], defaultStatistic]));
                		metrics[i] = [metric[0], this.query + metric[1]];
                	}
                }
                
                
                const params = JSON.parse(value);
                validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'vnic_id', 'http_status_code', 'req_interval', 'compartment_id'], params);
                var oci = new OCI('Compute - VNIC', 'Get metrics', params);
                
                const metrics = [
                	'VnicEgressDropsSecurityList',
                	'VnicIngressDropsSecurityList',
                	'VnicFromNetworkBytes',
                	'VnicFromNetworkPackets',
                	'VnicToNetworkBytes',
                	'VnicToNetworkPackets',
                	'VnicIngressDropsThrottle',
                	'VnicEgressDropsThrottle',
                	'VnicIngressDropsConntrackFull',
                	'VnicEgressDropsConntrackFull',
                	'VnicConntrackUtilPercent',
                	['VnicConntrackIsFull', 'last'],
                	'SmartnicBufferDropsFromNetwork',
                	'SmartnicBufferDropsFromHost'
                ];
                buildMql(params['vnic_id'], metrics, 'sum');
                
                var result = {};
                for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
                	result[metrics[i][0]] = oci.extractData('post', oci.executeRequest('post', '/20180401/metrics/actions/summarizeMetricsData', '?compartmentId=' + encodeURIComponent(params['compartment_id']), metrics[i][0] + metrics[i][1] + '()', 'oci_vcn'), 'aggregatedDatapoints');
                }
                return JSON.stringify(result);
              description: |
                Gets virtual network interface card metrics.
                
              timeout: 30s
              parameters:
                - name: api_host
                  value: '{$OCI.API.TELEMETRY.HOST}'
                - name: compartment_id
                  value: '{$OCI.COMPUTE.COMPARTMENT.ID}'
                - name: fingerprint
                  value: '{$OCI.API.FINGERPRINT}'
                - name: http_proxy
                  value: '{$OCI.HTTP.PROXY}'
                - name: http_status_code
                  value: '{$OCI.HTTP.RETURN.CODE.OK}'
                - name: private_key
                  value: '{$OCI.API.PRIVATE.KEY}'
                - name: req_interval
                  value: '1'
                - name: tenancy_ocid
                  value: '{$OCI.API.TENANCY}'
                - name: user_ocid
                  value: '{$OCI.API.USER}'
                - name: vnic_id
                  value: '{#ID}'
              tags:
                - tag: component
                  value: raw
            - uuid: e083fab486984a1d8c0947924e2e6c60
              name: 'VNIC [{#NAME}]: Bytes to network'
              type: DEPENDENT
              key: 'oci.compute.vnic.net.bytes.egr[{#ID}]'
              units: B
              description: |
                Bytes sent from the VNIC to the network, before drops.
                
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.VnicToNetworkBytes
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'oci.compute.vnic.metrics.get[{#ID}]'
              tags:
                - tag: component
                  value: network
                - tag: vnic
                  value: '{#ID}'
            - uuid: 09b608c006b34276b34356802f755ce7
              name: 'VNIC [{#NAME}]: Bytes from network'
              type: DEPENDENT
              key: 'oci.compute.vnic.net.bytes.ingr[{#ID}]'
              units: B
              description: |
                Bytes received at the VNIC from the network, after drops.
                
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.VnicFromNetworkBytes
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'oci.compute.vnic.metrics.get[{#ID}]'
              tags:
                - tag: component
                  value: network
                - tag: vnic
                  value: '{#ID}'
            - uuid: 9e4d0babdaad4f7291974881d88fa991
              name: 'VNIC [{#NAME}]: Connection tracking table full'
              type: DEPENDENT
              key: 'oci.compute.vnic.net.conntrack.full[{#ID}]'
              description: |
                Boolean (0/false, 1/true) that indicates the connection tracking table is full.
                
              valuemap:
                name: 'Generic Bool'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.VnicConntrackIsFull
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'oci.compute.vnic.metrics.get[{#ID}]'
              tags:
                - tag: component
                  value: network
                - tag: vnic
                  value: '{#ID}'
              trigger_prototypes:
                - uuid: 4faafcd1719745749ae1e3b2c58a09d0
                  expression: 'min(/Oracle Cloud Compute by HTTP/oci.compute.vnic.net.conntrack.full[{#ID}],5m) = 1'
                  name: 'VNIC [{#NAME}]: Conntrack table full'
                  priority: HIGH
                  description: 'Virtual network interface card connection tracking table is full.'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 088fc9f8d317402099ed0cda9dffb525
              name: 'VNIC [{#NAME}]: Connection tracking table utilization, in %'
              type: DEPENDENT
              key: 'oci.compute.vnic.net.conntrack.util[{#ID}]'
              units: '%'
              description: |
                Total utilization percentage (0-100%) of the connection tracking table.
                
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.VnicConntrackUtilPercent
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'oci.compute.vnic.metrics.get[{#ID}]'
              tags:
                - tag: component
                  value: network
                - tag: vnic
                  value: '{#ID}'
              trigger_prototypes:
                - uuid: c2fd382491624a74b2956be3dad187ea
                  expression: 'min(/Oracle Cloud Compute by HTTP/oci.compute.vnic.net.conntrack.util[{#ID}],5m) >= {$OCI.COMPUTE.VNIC.CONNTRACK.UTIL.WARN}'
                  name: 'VNIC [{#NAME}]: Current conntrack table utilization is high'
                  event_name: 'VNIC [{#NAME}]: Current conntrack table utilization is high (util >= {$OCI.COMPUTE.VNIC.CONNTRACK.UTIL.WARN}%)'
                  opdata: 'Current: {ITEM.LASTVALUE1}'
                  priority: WARNING
                  description: 'Current conntrack table utilization has exceeded `{$OCI.COMPUTE.VNIC.CONNTRACK.UTIL.WARN}`% of the max available value.'
                  dependencies:
                    - name: 'VNIC [{#NAME}]: Current conntrack table utilization is too high'
                      expression: 'min(/Oracle Cloud Compute by HTTP/oci.compute.vnic.net.conntrack.util[{#ID}],5m) >= {$OCI.COMPUTE.VNIC.CONNTRACK.UTIL.HIGH}'
                  tags:
                    - tag: scope
                      value: capacity
                - uuid: cf98ffe12a2b413c9b1384e9ec167cbd
                  expression: 'min(/Oracle Cloud Compute by HTTP/oci.compute.vnic.net.conntrack.util[{#ID}],5m) >= {$OCI.COMPUTE.VNIC.CONNTRACK.UTIL.HIGH}'
                  name: 'VNIC [{#NAME}]: Current conntrack table utilization is too high'
                  event_name: 'VNIC [{#NAME}]: Current conntrack table utilization is too high (util >= {$OCI.COMPUTE.VNIC.CONNTRACK.UTIL.HIGH}%)'
                  opdata: 'Current: {ITEM.LASTVALUE1}'
                  priority: HIGH
                  description: 'Current conntrack table utilization has exceeded `{$OCI.COMPUTE.VNIC.CONNTRACK.UTIL.HIGH}`% of the max available value.'
                  tags:
                    - tag: scope
                      value: capacity
            - uuid: 23be348ca25948468df11644a5f51d0d
              name: 'VNIC [{#NAME}]: Egress packets dropped by full connection tracking table'
              type: DEPENDENT
              key: 'oci.compute.vnic.net.packets.egr.drop[{#ID}]'
              units: '!packets'
              description: |
                Packets sent from the VNIC, destined for the network, dropped due to the full connection tracking table.
                
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.VnicEgressDropsConntrackFull
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'oci.compute.vnic.metrics.get[{#ID}]'
              tags:
                - tag: component
                  value: network
                - tag: vnic
                  value: '{#ID}'
            - uuid: bfa72f1cfc294d2b819cea22dbe7ddd8
              name: 'VNIC [{#NAME}]: Throttled egress packets'
              type: DEPENDENT
              key: 'oci.compute.vnic.net.packets.egr.throttled[{#ID}]'
              units: '!packets'
              description: |
                Packets sent from the VNIC, destined for the network, dropped due to throttling.
                
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.VnicEgressDropsThrottle
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'oci.compute.vnic.metrics.get[{#ID}]'
              tags:
                - tag: component
                  value: network
                - tag: vnic
                  value: '{#ID}'
            - uuid: 06cee1bacd744926ac61f72cd8ba3ae5
              name: 'VNIC [{#NAME}]: Packets to network'
              type: DEPENDENT
              key: 'oci.compute.vnic.net.packets.egr[{#ID}]'
              units: '!packets'
              description: |
                Packets sent from the VNIC to the network, before drops.
                
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.VnicToNetworkPackets
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'oci.compute.vnic.metrics.get[{#ID}]'
              tags:
                - tag: component
                  value: network
                - tag: vnic
                  value: '{#ID}'
            - uuid: 2564ee2fa8bd4d5f9859506c1486f45f
              name: 'VNIC [{#NAME}]: Ingress packets dropped by full connection tracking table'
              type: DEPENDENT
              key: 'oci.compute.vnic.net.packets.ingr.drop[{#ID}]'
              units: '!packets'
              description: |
                Packets received from the network, destined for the VNIC, dropped due to the full connection tracking table.
                
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.VnicIngressDropsConntrackFull
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'oci.compute.vnic.metrics.get[{#ID}]'
              tags:
                - tag: component
                  value: network
                - tag: vnic
                  value: '{#ID}'
            - uuid: 595654f8255f454fba44abfcfeeb8c14
              name: 'VNIC [{#NAME}]: Throttled ingress packets'
              type: DEPENDENT
              key: 'oci.compute.vnic.net.packets.ingr.throttled[{#ID}]'
              units: '!packets'
              description: |
                Packets received from the network, destined for the VNIC, dropped due to throttling.
                
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.VnicIngressDropsThrottle
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'oci.compute.vnic.metrics.get[{#ID}]'
              tags:
                - tag: component
                  value: network
                - tag: vnic
                  value: '{#ID}'
            - uuid: 9c37d782e3594e199f0c77010853d893
              name: 'VNIC [{#NAME}]: Packets from network'
              type: DEPENDENT
              key: 'oci.compute.vnic.net.packets.ingr[{#ID}]'
              units: '!packets'
              description: |
                Packets received at the VNIC from the network, after drops.
                
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.VnicFromNetworkPackets
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'oci.compute.vnic.metrics.get[{#ID}]'
              tags:
                - tag: component
                  value: network
                - tag: vnic
                  value: '{#ID}'
            - uuid: 400c523fe78b4264948e363f278bbc6d
              name: 'VNIC [{#NAME}]: Smartnic buffer drops from network'
              type: DEPENDENT
              key: 'oci.compute.vnic.net.smartnic.drops[{#ID}]'
              units: '!packets'
              description: |
                Number of packets dropped in SmartNIC from the network due to buffer exhaustion. This metric is available only for Bare Metal Instances. For virtual machines, these metric values are zero.
                
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.SmartnicBufferDropsFromNetwork
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: 'oci.compute.vnic.metrics.get[{#ID}]'
              tags:
                - tag: component
                  value: network
                - tag: vnic
                  value: '{#ID}'
          graph_prototypes:
            - uuid: 7a02ebf104a24f3ebd1631003dc7365c
              name: 'VNIC [{#NAME}]: Network bytes in'
              graph_items:
                - color: 00D936
                  item:
                    host: 'Oracle Cloud Compute by HTTP'
                    key: 'oci.compute.vnic.net.bytes.ingr[{#ID}]'
            - uuid: 50306b25bef24d95acd2d9ae9e0c1f6f
              name: 'VNIC [{#NAME}]: Network bytes out'
              graph_items:
                - color: 2196F3
                  item:
                    host: 'Oracle Cloud Compute by HTTP'
                    key: 'oci.compute.vnic.net.bytes.egr[{#ID}]'
            - uuid: 4f3c1eabc2be43b68c4a76a6bed17761
              name: 'VNIC [{#NAME}]: Network packets dropped by connection tracking table'
              graph_items:
                - color: 199C0D
                  yaxisside: RIGHT
                  item:
                    host: 'Oracle Cloud Compute by HTTP'
                    key: 'oci.compute.vnic.net.conntrack.util[{#ID}]'
                - sortorder: '1'
                  color: 00D936
                  item:
                    host: 'Oracle Cloud Compute by HTTP'
                    key: 'oci.compute.vnic.net.packets.ingr.drop[{#ID}]'
                - sortorder: '2'
                  color: 0208bf
                  item:
                    host: 'Oracle Cloud Compute by HTTP'
                    key: 'oci.compute.vnic.net.packets.egr.drop[{#ID}]'
            - uuid: 3d9f549442ac455eb0e5296594eac004
              name: 'VNIC [{#NAME}]: Network packets dropped by security list'
              graph_items:
                - color: 00D936
                  item:
                    host: 'Oracle Cloud Compute by HTTP'
                    key: 'oci.compute.vnic.net.packets.ingr.drop[{#ID}]'
                - sortorder: '1'
                  color: 0208bf
                  item:
                    host: 'Oracle Cloud Compute by HTTP'
                    key: 'oci.compute.vnic.net.packets.egr.drop[{#ID}]'
            - uuid: 2c4626b63df0468caef94e405e499aaa
              name: 'VNIC [{#NAME}]: Network packets in'
              graph_items:
                - color: 00D936
                  item:
                    host: 'Oracle Cloud Compute by HTTP'
                    key: 'oci.compute.vnic.net.packets.ingr[{#ID}]'
                - sortorder: '1'
                  color: 008C23
                  item:
                    host: 'Oracle Cloud Compute by HTTP'
                    key: 'oci.compute.vnic.net.packets.ingr.throttled[{#ID}]'
            - uuid: 4fe14e23a0414b8787749aababc35ceb
              name: 'VNIC [{#NAME}]: Network packets out'
              graph_items:
                - color: 2196F3
                  item:
                    host: 'Oracle Cloud Compute by HTTP'
                    key: 'oci.compute.vnic.net.packets.egr[{#ID}]'
                - sortorder: '1'
                  color: 0208bf
                  item:
                    host: 'Oracle Cloud Compute by HTTP'
                    key: 'oci.compute.vnic.net.packets.egr.throttled[{#ID}]'
            - uuid: fdaad88126dd486b948348e993217c8f
              name: 'VNIC [{#NAME}]: Smartnic buffer drops'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'Oracle Cloud Compute by HTTP'
                    key: 'oci.compute.vnic.net.smartnic.drops[{#ID}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'Oracle Cloud Compute by HTTP'
                    key: 'oci.compute.vnic.host.smartnic.drops[{#ID}]'
          master_item:
            key: oci.compute.vnic.get
          lld_macro_paths:
            - lld_macro: '{#ID}'
              path: $.id
            - lld_macro: '{#NAME}'
              path: $.name
            - lld_macro: '{#STATE}'
              path: $.state
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
      tags:
        - tag: class
          value: cloud
        - tag: target
          value: oci
        - tag: target
          value: oracle-cloud-infrastructure
      macros:
        - macro: '{$OCI.COMPUTE.CPU.UTIL.HIGH}'
          value: '90'
          description: 'Sets the percentage threshold for creating a "high" severity event about CPU resource utilization.'
        - macro: '{$OCI.COMPUTE.CPU.UTIL.WARN}'
          value: '75'
          description: 'Sets the percentage threshold for creating a "warning" severity event about CPU resource utilization.'
        - macro: '{$OCI.COMPUTE.MEM.UTIL.HIGH}'
          value: '90'
          description: 'Sets the percentage threshold for creating a "high" severity event about memory resource utilization.'
        - macro: '{$OCI.COMPUTE.MEM.UTIL.WARN}'
          value: '75'
          description: 'Sets the percentage threshold for creating a "warning" severity event about memory resource utilization.'
        - macro: '{$OCI.COMPUTE.VNIC.CONNTRACK.UTIL.HIGH}'
          value: '90'
          description: 'Sets the percentage threshold for creating a "high" severity event about VNIC connection tracking table utilization.'
        - macro: '{$OCI.COMPUTE.VNIC.CONNTRACK.UTIL.WARN}'
          value: '75'
          description: 'Sets the percentage threshold for creating a "warning" severity event about VNIC connection tracking table utilization.'
        - macro: '{$OCI.COMPUTE.VNIC.DISCOVERY.NAME.MATCHES}'
          value: '.*'
          description: 'Sets the regex string of VNIC names to allow in discovery.'
        - macro: '{$OCI.COMPUTE.VNIC.DISCOVERY.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the regex string of VNIC names to ignore in discovery.'
        - macro: '{$OCI.COMPUTE.VNIC.DISCOVERY.STATE.MATCHES}'
          value: '.*'
          description: 'Sets the regex string of VNIC states to allow in discovery.'
        - macro: '{$OCI.COMPUTE.VNIC.DISCOVERY.STATE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the regex string of VNIC states to ignore in discovery.'
        - macro: '{$OCI.HTTP.PROXY}'
          description: 'Set an HTTP proxy for OCI API requests if needed.'
        - macro: '{$OCI.HTTP.RETURN.CODE.OK}'
          value: '200'
          description: |
            Set the HTTP return code that represents an OK response from the API. The default is "200",  but can vary, for example, if a proxy is used.
            
      dashboards:
        - uuid: edab80c89bcf43d6ada2e4ed5477d36f
          name: 'OCI Compute: Overview'
          pages:
            - name: Main
              display_period: '60'
              widgets:
                - type: item
                  name: State
                  width: '27'
                  height: '4'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 6C00D9
                    - type: STRING
                      name: description
                      value: 'Current State'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.availability.get
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: INTEGER
                      name: units_show
                      value: '0'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                    - type: INTEGER
                      name: value_size
                      value: '35'
                - type: item
                  name: 'Disk bytes read'
                  'y': '4'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Disk Bytes Read'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.disk.read
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '20'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Disk read I/O'
                  'y': '7'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Disk Read I/O'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.disk.io.read
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '20'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Disk bytes written'
                  x: '15'
                  'y': '4'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Disk Bytes Written'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.disk.written
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '20'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Disk write I/O'
                  x: '15'
                  'y': '7'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Disk Write I/O'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.disk.io.write
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '20'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: Availability
                  x: '27'
                  width: '15'
                  height: '4'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 6C00D9
                    - type: STRING
                      name: description
                      value: Availability
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.availability.get
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: INTEGER
                      name: units_show
                      value: '0'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                    - type: INTEGER
                      name: value_size
                      value: '20'
                - type: item
                  name: 'Net bytes in'
                  x: '30'
                  'y': '4'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FF0000
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Net Bytes In'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.network.in
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Net bytes out'
                  x: '30'
                  'y': '7'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FF0000
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Net Bytes Out'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.network.out
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Load average'
                  x: '42'
                  width: '30'
                  height: '4'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 6C00D9
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Load Average'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.load.avg
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: gauge
                  name: CPU
                  x: '48'
                  'y': '4'
                  width: '12'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: STRING
                      name: description
                      value: CPU
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: STRING
                      name: empty_color
                      value: 145C96
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.cpu.util
                    - type: STRING
                      name: max
                      value: '100'
                    - type: STRING
                      name: min
                      value: '0'
                    - type: INTEGER
                      name: rf_rate
                      value: '30'
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: INTEGER
                      name: show.2
                      value: '5'
                    - type: STRING
                      name: units
                      value: '%'
                    - type: INTEGER
                      name: units_bold
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: STRING
                      name: value_arc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: value_arc_size
                      value: '35'
                    - type: INTEGER
                      name: value_bold
                      value: '1'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Memory allocation stalls'
                  x: '48'
                  'y': '7'
                  width: '24'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FBC02D
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Memory Allocation Stalls'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.mem.stalls
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: gauge
                  name: Memory
                  x: '60'
                  'y': '4'
                  width: '12'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: STRING
                      name: description
                      value: Memory
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: STRING
                      name: empty_color
                      value: 145C96
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.mem.util
                    - type: STRING
                      name: max
                      value: '100'
                    - type: STRING
                      name: min
                      value: '0'
                    - type: INTEGER
                      name: rf_rate
                      value: '30'
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: INTEGER
                      name: show.2
                      value: '5'
                    - type: STRING
                      name: units
                      value: '%'
                    - type: INTEGER
                      name: units_bold
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: STRING
                      name: value_arc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: value_arc_size
                      value: '35'
                    - type: INTEGER
                      name: value_bold
                      value: '1'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
            - name: CPU/Mem
              display_period: '30'
              widgets:
                - type: gauge
                  name: CPU
                  width: '24'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: STRING
                      name: description
                      value: CPU
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: STRING
                      name: empty_color
                      value: 145C96
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.cpu.util
                    - type: STRING
                      name: max
                      value: '100'
                    - type: STRING
                      name: min
                      value: '0'
                    - type: INTEGER
                      name: rf_rate
                      value: '30'
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: INTEGER
                      name: show.2
                      value: '5'
                    - type: STRING
                      name: units
                      value: '%'
                    - type: INTEGER
                      name: units_bold
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: STRING
                      name: value_arc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: value_arc_size
                      value: '35'
                    - type: INTEGER
                      name: value_bold
                      value: '1'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'CPU utilization'
                  'y': '3'
                  width: '24'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'OCI Compute: Cpu utilization'
                    - type: STRING
                      name: reference
                      value: ABAAA
                - type: gauge
                  name: Memory
                  x: '24'
                  width: '48'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: STRING
                      name: description
                      value: Memory
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: STRING
                      name: empty_color
                      value: 145C96
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.mem.util
                    - type: STRING
                      name: max
                      value: '100'
                    - type: STRING
                      name: min
                      value: '0'
                    - type: INTEGER
                      name: rf_rate
                      value: '30'
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: INTEGER
                      name: show.2
                      value: '5'
                    - type: STRING
                      name: units
                      value: '%'
                    - type: INTEGER
                      name: units_bold
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: STRING
                      name: value_arc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: value_arc_size
                      value: '35'
                    - type: INTEGER
                      name: value_bold
                      value: '1'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Memory utilization'
                  x: '24'
                  'y': '3'
                  width: '24'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'OCI Compute: Memory utilization'
                    - type: STRING
                      name: reference
                      value: ABAAB
                - type: graph
                  name: 'Memory allocation stalls'
                  x: '48'
                  'y': '3'
                  width: '24'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'OCI Compute: Memory allocation stalls'
                    - type: STRING
                      name: reference
                      value: ABAAC
            - name: 'Net In/Out'
              display_period: '30'
              widgets:
                - type: item
                  name: 'Net bytes in'
                  width: '36'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FF0000
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Net Bytes In'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.network.in
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Network bytes in'
                  'y': '3'
                  width: '36'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'OCI Compute: Network bytes in'
                    - type: STRING
                      name: reference
                      value: ACAAA
                - type: item
                  name: 'Net bytes out'
                  x: '36'
                  width: '36'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FF0000
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Net Bytes Out'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.network.out
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Network bytes out'
                  x: '36'
                  'y': '3'
                  width: '36'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'OCI Compute: Network bytes out'
                    - type: STRING
                      name: reference
                      value: ACAAC
            - name: Disk
              display_period: '30'
              widgets:
                - type: item
                  name: 'Disk bytes read'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Disk Bytes Read'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.disk.read
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Disk bytes read'
                  'y': '3'
                  width: '18'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'OCI Compute: Disk bytes read'
                    - type: STRING
                      name: reference
                      value: ADAAA
                - type: item
                  name: 'Disk bytes written'
                  x: '18'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Disk Bytes Written'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.disk.written
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Disk bytes written'
                  x: '18'
                  'y': '3'
                  width: '18'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'OCI Compute: Disk bytes written'
                    - type: STRING
                      name: reference
                      value: ADAAB
                - type: item
                  name: 'Disk read i/o'
                  x: '36'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Disk Read I/O'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.disk.io.read
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Disk read i/o'
                  x: '36'
                  'y': '3'
                  width: '18'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'OCI Compute: Disk bytes read I/O'
                    - type: STRING
                      name: reference
                      value: ADAAC
                - type: item
                  name: 'Disk write i/o'
                  x: '54'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Disk Write I/O'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.disk.io.write
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Disk write i/o'
                  x: '54'
                  'y': '3'
                  width: '18'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'OCI Compute: Disk bytes write I/O'
                    - type: STRING
                      name: reference
                      value: ADAAD
            - name: 'VNIC In/Out'
              display_period: '30'
              widgets:
                - type: item
                  name: 'Total bytes in'
                  width: '6'
                  height: '11'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FF0000
                    - type: INTEGER
                      name: decimal_places
                      value: '1'
                    - type: INTEGER
                      name: decimal_size
                      value: '4'
                    - type: STRING
                      name: description
                      value: Ingress
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_size
                      value: '3'
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.network.in
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '2'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                    - type: INTEGER
                      name: value_size
                      value: '4'
                - type: graph
                  name: 'Network bytes in'
                  x: '6'
                  width: '30'
                  height: '3'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'OCI Compute: Network bytes in'
                    - type: STRING
                      name: reference
                      value: AEAAA
                    - type: INTEGER
                      name: show_legend
                      value: '0'
                - type: graphprototype
                  name: 'VNIC bytes in'
                  x: '6'
                  'y': '3'
                  width: '30'
                  height: '4'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'VNIC [{#NAME}]: Network bytes in'
                    - type: STRING
                      name: reference
                      value: AEAAB
                - type: graphprototype
                  name: 'VNIC packets in'
                  x: '6'
                  'y': '7'
                  width: '30'
                  height: '4'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'VNIC [{#NAME}]: Network packets in'
                    - type: STRING
                      name: reference
                      value: AEAAC
                - type: item
                  name: 'Total bytes out'
                  x: '36'
                  width: '6'
                  height: '11'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FF0000
                    - type: INTEGER
                      name: decimal_places
                      value: '1'
                    - type: INTEGER
                      name: decimal_size
                      value: '4'
                    - type: STRING
                      name: description
                      value: Egress
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_size
                      value: '3'
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        key: oci.compute.network.out
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '2'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                    - type: INTEGER
                      name: value_size
                      value: '4'
                - type: graph
                  name: 'Network bytes out'
                  x: '42'
                  width: '30'
                  height: '3'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'OCI Compute: Network bytes out'
                    - type: STRING
                      name: reference
                      value: AEAAD
                    - type: INTEGER
                      name: show_legend
                      value: '0'
                - type: graphprototype
                  name: 'VNIC bytes out'
                  x: '42'
                  'y': '3'
                  width: '30'
                  height: '4'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'VNIC [{#NAME}]: Network bytes out'
                    - type: STRING
                      name: reference
                      value: AEAAE
                - type: graphprototype
                  name: 'VNIC packets out'
                  x: '42'
                  'y': '7'
                  width: '30'
                  height: '4'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'VNIC [{#NAME}]: Network packets out'
                    - type: STRING
                      name: reference
                      value: AEAAF
            - name: 'VNIC Detailed'
              display_period: '30'
              widgets:
                - type: graphprototype
                  name: 'Connection tracking table'
                  width: '24'
                  height: '11'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'VNIC [{#NAME}]: Network packets dropped by connection tracking table'
                    - type: STRING
                      name: reference
                      value: AFAAA
                - type: graphprototype
                  name: 'Security list'
                  x: '24'
                  width: '24'
                  height: '11'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'VNIC [{#NAME}]: Network packets dropped by security list'
                    - type: STRING
                      name: reference
                      value: AFAAB
                - type: graphprototype
                  name: Smartnic
                  x: '48'
                  width: '24'
                  height: '11'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Compute by HTTP'
                        name: 'VNIC [{#NAME}]: Smartnic buffer drops'
                    - type: STRING
                      name: reference
                      value: AFAAC
      valuemaps:
        - uuid: 9e238671edca4ed7b58eefacc861a77d
          name: 'Compute instance availability'
          mappings:
            - value: '0'
              newvalue: Available
            - value: '1'
              newvalue: Unavailable
        - uuid: c336821eced54261afb0d10a0de6601d
          name: 'Compute instance state'
          mappings:
            - value: '0'
              newvalue: Unknown
            - value: '1'
              newvalue: Moving
            - value: '2'
              newvalue: Provisioning
            - value: '3'
              newvalue: Running
            - value: '4'
              newvalue: Starting
            - value: '5'
              newvalue: Stopping
            - value: '6'
              newvalue: Stopped
            - value: '7'
              newvalue: 'Creating image'
            - value: '8'
              newvalue: Terminating
            - value: '9'
              newvalue: Terminated
        - uuid: dce0b4413ede4dbca55f89cbc86736b3
          name: 'Generic Bool'
          mappings:
            - value: '0'
              newvalue: 'False'
            - value: '1'
              newvalue: 'True'
        - uuid: 8fdcb86d1dde4d2489239dd61fbd8b08
          name: 'VNIC attachment state'
          mappings:
            - value: '0'
              newvalue: Unknown
            - value: '1'
              newvalue: Attaching
            - value: '2'
              newvalue: Attached
            - value: '3'
              newvalue: Detaching
            - value: '4'
              newvalue: Detached
    - uuid: 62d99b55585e41dd89736f5f46074dcb
      template: 'Oracle Cloud Networking by HTTP'
      name: 'Oracle Cloud Networking by HTTP'
      description: |
        This template monitors Oracle Cloud Infrastructure (OCI) single virtual network card availability and discovers
        attached subnets and monitors their availability.
        
        This template is not meant to be used independently, but together with Oracle Cloud by HTTP as a template for 
        LLD host prototypes.
        
        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.0-0
      groups:
        - name: Templates/Cloud
      items:
        - uuid: 7b2fdfb034ba4657a731ab11ffa175f6
          name: 'Get VCN state'
          type: SCRIPT
          key: oci.vcn.state.get
          delay: 5m
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'vcn_id', 'http_status_code'], params);
            var oci = new OCI('VCN', 'Get VCN status', params);
            
            return JSON.stringify(oci.extractData('get', oci.executeRequest('get', '/20160918/vcns/' + encodeURIComponent(params['vcn_id']), ''), 'lifecycleState'));
          description: |
            State of the virtual cloud network.
            
          valuemap:
            name: 'Lifecycle state'
          preprocessing:
            - type: STR_REPLACE
              parameters:
                - '"'
                - ''
            - type: JAVASCRIPT
              parameters:
                - |
                  const idx = {
                  	'PROVISIONING': 1,
                  	'AVAILABLE': 2,
                  	'TERMINATING': 3,
                  	'TERMINATED': 4,
                  	'UPDATING': 5
                  };
                  
                  return typeof idx[value] === 'undefined' ? 0 : idx[value];
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          timeout: 10s
          parameters:
            - name: api_host
              value: '{$OCI.API.CORE.HOST}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
            - name: vcn_id
              value: '{$OCI.VCN.ID}'
          tags:
            - tag: component
              value: network
          triggers:
            - uuid: 8a5a94ea28db43df93e85d26703f9e7c
              expression: 'min(/Oracle Cloud Networking by HTTP/oci.vcn.state.get,5m) = 3 or min(/Oracle Cloud Networking by HTTP/oci.vcn.state.get,5m) = 4'
              name: 'VCN state terminated'
              priority: HIGH
              description: 'Virtual cloud network state is "terminated" or "terminating".'
              tags:
                - tag: scope
                  value: availability
            - uuid: 80c3f4d6696c40a78ddb2c00378eeae1
              expression: 'min(/Oracle Cloud Networking by HTTP/oci.vcn.state.get,5m) = 0'
              name: 'VCN state unknown'
              priority: WARNING
              description: 'Virtual cloud network state is unknown.'
              tags:
                - tag: scope
                  value: availability
        - uuid: 83236aeedf5e4ba39f0425c21f745690
          name: 'Get subnets'
          type: SCRIPT
          key: oci.vcn.subnets.get
          delay: 5m
          history: '0'
          value_type: TEXT
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'vcn_id', 'http_status_code', 'compartment_id'], params);
            var oci = new OCI('VCN', 'Get subnets', params);
            
            return JSON.stringify(oci.extractData('get', oci.executeRequest('get', '/20160918/subnets', '?compartmentId=' + encodeURIComponent(params['compartment_id']) + '&vcnId=' + encodeURIComponent(params['vcn_id'])), ['id', 'displayName', 'lifecycleState', 'freeformTags']));
          description: |
            Get data about subnets linked to the particular VCN.
            
          timeout: 30s
          parameters:
            - name: api_host
              value: '{$OCI.API.CORE.HOST}'
            - name: compartment_id
              value: '{$OCI.VCN.COMPARTMENT.ID}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
            - name: vcn_id
              value: '{$OCI.VCN.ID}'
          tags:
            - tag: component
              value: raw
      discovery_rules:
        - uuid: 6aca3a2d8b9a4231ae9364611ed4df82
          name: 'Subnet discovery'
          type: DEPENDENT
          key: oci.vcn.subnet.discovery
          filter:
            evaltype: AND
            conditions:
              - macro: '{#NAME}'
                value: '{$OCI.VCN.SUBNET.DISCOVERY.NAME.MATCHES}'
              - macro: '{#NAME}'
                value: '{$OCI.VCN.SUBNET.DISCOVERY.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
              - macro: '{#STATE}'
                value: '{$OCI.VCN.SUBNET.DISCOVERY.STATE.MATCHES}'
              - macro: '{#STATE}'
                value: '{$OCI.VCN.SUBNET.DISCOVERY.STATE.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
          description: |
            Discover subnets linked to the particular VCN.
            
          item_prototypes:
            - uuid: 759c6bff98fb4cb3bc8c9269513339bf
              name: 'Subnet [{#NAME}]: Get subnet state'
              type: DEPENDENT
              key: 'oci.vcn.subnet.state[{#ID}]'
              description: |
                Current state of subnet.
                
              valuemap:
                name: 'Lifecycle state'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$..[?(@.id == ''{#ID}'')].state.first()'
                - type: JAVASCRIPT
                  parameters:
                    - |
                      const idx = {
                      	'PROVISIONING': 1,
                      	'AVAILABLE': 2,
                      	'TERMINATING': 3,
                      	'TERMINATED': 4
                      };
                      
                      return typeof idx[value] === 'undefined' ? 0 : idx[value];
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 1h
              master_item:
                key: oci.vcn.subnets.get
              tags:
                - tag: component
                  value: network
                - tag: subnet
                  value: '{#ID}'
              trigger_prototypes:
                - uuid: f048db860c0c4134acdbcbf19ea554eb
                  expression: 'min(/Oracle Cloud Networking by HTTP/oci.vcn.subnet.state[{#ID}],5m) = 3 or min(/Oracle Cloud Networking by HTTP/oci.vcn.subnet.state[{#ID}],5m) = 4'
                  name: 'Subnet [{#NAME}]: Subnet state terminated'
                  priority: HIGH
                  description: 'Virtual cloud network subnet state is "terminated" or "terminating".'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: d34e5b8c571b41f9ba5dc11453431860
                  expression: 'min(/Oracle Cloud Networking by HTTP/oci.vcn.subnet.state[{#ID}],5m) = 0'
                  name: 'Subnet [{#NAME}]: Subnet state unknown'
                  priority: WARNING
                  description: 'Virtual cloud network subnet state is unknown.'
                  tags:
                    - tag: scope
                      value: availability
          master_item:
            key: oci.vcn.subnets.get
          lld_macro_paths:
            - lld_macro: '{#ID}'
              path: $.id
            - lld_macro: '{#NAME}'
              path: $.name
            - lld_macro: '{#STATE}'
              path: $.state
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
      tags:
        - tag: class
          value: cloud
        - tag: target
          value: oci
        - tag: target
          value: oracle-cloud-infrastructure
      macros:
        - macro: '{$OCI.HTTP.PROXY}'
          description: 'Set an HTTP proxy for OCI API requests if needed.'
        - macro: '{$OCI.HTTP.RETURN.CODE.OK}'
          value: '200'
          description: |
            Set the HTTP return code that represents an OK response from the API. The default is "200",  but can vary, for example, if a proxy is used.
            
        - macro: '{$OCI.VCN.SUBNET.DISCOVERY.NAME.MATCHES}'
          value: '.*'
          description: 'Sets the regex string of VCN subnet names to allow in discovery.'
        - macro: '{$OCI.VCN.SUBNET.DISCOVERY.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the regex string of VCN subnet names to ignore in discovery.'
        - macro: '{$OCI.VCN.SUBNET.DISCOVERY.STATE.MATCHES}'
          value: '.*'
          description: 'Sets the regex string of VCN subnet states to allow in discovery.'
        - macro: '{$OCI.VCN.SUBNET.DISCOVERY.STATE.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Sets the regex string of VCN subnet states to ignore in discovery.'
      valuemaps:
        - uuid: abf7b45647ee4a339df92bf06b12f0df
          name: 'Lifecycle state'
          mappings:
            - value: '0'
              newvalue: Unknown
            - value: '1'
              newvalue: Provisioning
            - value: '2'
              newvalue: Available
            - value: '3'
              newvalue: Terminating
            - value: '4'
              newvalue: Terminated
            - value: '5'
              newvalue: Updating
    - uuid: e8f89476695848e99ba900a5664d290b
      template: 'Oracle Cloud Object Storage by HTTP'
      name: 'Oracle Cloud Object Storage by HTTP'
      description: |
        This template monitors Oracle Cloud Infrastructure (OCI) object storage resources.
        
        This template is not meant to be used independently, but together with Oracle Cloud by HTTP as a template for
        LLD host prototypes.
        
        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.0-0
      groups:
        - name: Templates/Cloud
      items:
        - uuid: 8a216ff99ea84e169ba24305a5501b45
          name: 'Client-side error count'
          type: DEPENDENT
          key: oci.obj.storage.client.errors
          value_type: FLOAT
          description: |
            The total number of 4xx errors for requests made in a bucket.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.ClientErrors
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.obj.storage.metrics.frequent.get
          tags:
            - tag: component
              value: storage
        - uuid: 3d41eed5ab23438d9f2a87c48bb3def4
          name: 'First byte latency time'
          type: DEPENDENT
          key: oci.obj.storage.latency.byte
          value_type: FLOAT
          units: s
          description: |
            The per-request time measured from the time Object Storage receives the complete request to when Object Storage returns the first byte of the response.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.FirstByteLatency
            - type: MULTIPLIER
              parameters:
                - '0.001'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.obj.storage.metrics.frequent.get
          tags:
            - tag: component
              value: storage
        - uuid: a47bb44ccb35489e965432c332bd8892
          name: 'Overall latency time'
          type: DEPENDENT
          key: oci.obj.storage.latency.overall
          value_type: FLOAT
          units: s
          description: |
            The per-request time from the first byte received by Object Storage to the last byte sent from Object Storage.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.TotalRequestLatency
            - type: MULTIPLIER
              parameters:
                - '0.001'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.obj.storage.metrics.frequent.get
          tags:
            - tag: component
              value: storage
        - uuid: 5463c35f2c48408997532001025989fa
          name: 'Get frequent metrics'
          type: SCRIPT
          key: oci.obj.storage.metrics.frequent.get
          history: '0'
          value_type: TEXT
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            function buildMql(id, metrics, defaultStatistic, resourceType) {
            	resourceType = resourceType === '' || resourceType === undefined ? 'resourceId' : resourceType;
            	this.query = '[' + params['req_interval'] + 'm]{' + resourceType + '=' + id + '}.';
            
            	for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
            		const metric = ((Array.isArray(metrics[i]) ? metrics[i] : [metrics[i], defaultStatistic]));
            		metrics[i] = [metric[0], this.query + metric[1]];
            	}
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'bucket_name', 'http_status_code', 'req_interval', 'compartment_id'], params);
            var oci = new OCI('Object storage', 'Get metrics ' + params['req_interval'] + 'm', params);
            
            const metrics = [
            	'AllRequests',
            	'ClientErrors',
            	'FirstByteLatency',
            	'PostRequests',
            	'PutRequests',
            	'TotalRequestLatency'
            ];
            buildMql(params['bucket_name'], metrics, 'mean', 'resourceDisplayName');
            
            var result = {};
            for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
            	result[metrics[i][0]] = oci.extractData('post', oci.executeRequest('post', '/20180401/metrics/actions/summarizeMetricsData', '?compartmentId=' + encodeURIComponent(params['compartment_id']), metrics[i][0] + metrics[i][1] + '()', 'oci_objectstorage'), 'aggregatedDatapoints');
            }
            return JSON.stringify(result);
            
          description: |
            Gets all metrics related to a specific bucket that have frequent update time (100 milliseconds).
            
          timeout: 30s
          parameters:
            - name: api_host
              value: '{$OCI.API.TELEMETRY.HOST}'
            - name: bucket_name
              value: '{$OCI.OBJECT.STORAGE.BUCKET}'
            - name: compartment_id
              value: '{$OCI.OBJECT.STORAGE.COMPARTMENT.ID}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: req_interval
              value: '1'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          tags:
            - tag: component
              value: raw
        - uuid: 4a12f1c73e8f40be9136a095ad147775
          name: 'Get hourly metrics'
          type: SCRIPT
          key: oci.obj.storage.metrics.hourly.get
          delay: 1h
          history: '0'
          value_type: TEXT
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            function buildMql(id, metrics, defaultStatistic, resourceType) {
            	resourceType = resourceType === '' || resourceType === undefined ? 'resourceId' : resourceType;
            	this.query = '[' + params['req_interval'] + 'm]{' + resourceType + '=' + id + '}.';
            
            	for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
            		const metric = ((Array.isArray(metrics[i]) ? metrics[i] : [metrics[i], defaultStatistic]));
            		metrics[i] = [metric[0], this.query + metric[1]];
            	}
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'bucket_name', 'http_status_code', 'req_interval', 'compartment_id'], params);
            var oci = new OCI('Object storage', 'Get metrics ' + params['req_interval'] + 'm', params);
            
            const metrics = [
            	'ObjectCount',
            	'StoredBytes',
            	'UncommittedParts'
            ];
            buildMql(params['bucket_name'], metrics, 'mean', 'resourceDisplayName')
            
            var result = {};
            for (var i = 0, metricsLength = metrics.length; i < metricsLength; i++) {
            	result[metrics[i][0]] = oci.extractData('post', oci.executeRequest('post', '/20180401/metrics/actions/summarizeMetricsData', '?compartmentId=' + encodeURIComponent(params['compartment_id']), metrics[i][0] + metrics[i][1] + '()', 'oci_objectstorage'), 'aggregatedDatapoints');
            }
            return JSON.stringify(result);
            
          description: |
            Gets all metrics related to specific bucket that have update time of 1 hour.
            
          timeout: 30s
          parameters:
            - name: api_host
              value: '{$OCI.API.TELEMETRY.HOST}'
            - name: bucket_name
              value: '{$OCI.OBJECT.STORAGE.BUCKET}'
            - name: compartment_id
              value: '{$OCI.OBJECT.STORAGE.COMPARTMENT.ID}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: req_interval
              value: '60'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          tags:
            - tag: component
              value: raw
        - uuid: 5bb5ba3011e94e43bb1fdc79668c9537
          name: 'Get enabled object lifecycle management'
          type: SCRIPT
          key: oci.obj.storage.metrics.olm.get
          delay: 3h
          params: |
            function validateZabbixParams(requiredParams, allParams) {
            	requiredParams.forEach(function (field) {
            		if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
            			throw 'Required param is not set: ' + field + '.';
            		}
            	});
            }
            
            function OCI(service, action, params) {
            	this.zabbixLogPrefix = '[ OCI ] [ ' + service + ' ] [ ' + action + ' ]';
            	this.request = new HttpRequest();
            
            	this.hash = function (string) {
            		return sha256(string);
            	};
            
            	this.sign = function (string) {
            		return sign('sha256', params['private_key'], string);
            	};
            
            	this.encode = function (hash) {
            		const hexArr = hash.match(/.{1,2}/g);
            		var uInt8Array = new Uint8Array(hexArr.length);
            		hexArr.forEach(function (hex, idx) {
            			uInt8Array[idx] = parseInt(hex, 16);
            		});
            		return btoa(uInt8Array);
            	};
            
            	this.getDate = function () {
            		const weekdayShortList = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
            		const monthShortList = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
            		const today = new Date();
            		return weekdayShortList[today.getUTCDay()] + ', ' + today.getUTCDate() + ' ' + monthShortList[today.getUTCMonth()] + ' ' + today.getUTCFullYear() + ' ' + today.getUTCHours() + ':' + today.getUTCMinutes() + ':' + today.getUTCSeconds() + ' GMT';
            	};
            
            	this.executeRequest = function (httpMethod, apiPath, apiParams, mql, namespace) {
            		var headers = '(request-target) date host';
            		const contentTypeHeader = 'content-type: application/json';
            		const dateHeader = 'date: ' + this.getDate();
            		const hostHeader = 'host: ' + params['api_host'];
            		const requestTarget = '(request-target): ' + httpMethod + ' ' + apiPath + apiParams;
            		var signingString = requestTarget + '\n' + dateHeader + '\n' + hostHeader;
            		var reqHeaders = [contentTypeHeader, dateHeader];
            
            		if (httpMethod === 'post') {
            			var body = JSON.stringify({
            				'namespace': namespace,
            				'query': mql
            			});
            			headers = headers + ' x-content-sha256 content-type content-length';
            			const bodyHeader = 'x-content-sha256: ' + this.encode(this.hash(body));
            			const bodyLengthHeader = 'content-length: ' + body.length;
            			signingString = signingString + '\n' + bodyHeader + '\n' + contentTypeHeader + '\n' + bodyLengthHeader;
            			reqHeaders.push(bodyHeader, bodyLengthHeader);
            		}
            
            		const signature = this.encode(this.sign(signingString));
            
            		reqHeaders.push('Authorization: Signature version="1",keyId="' + params['tenancy_ocid'] + '/' + params['user_ocid'] + '/' + params['fingerprint'] + '",algorithm="rsa-sha256",headers="' + headers + '",signature="' + signature + '"');
            		for (var header = 0, headerLength = reqHeaders.length; header < headerLength; header++) {
            			this.request.addHeader(reqHeaders[header]);
            		}
            
            		if (params['http_proxy']) {
            			this.request.setProxy(params['http_proxy']);
            			Zabbix.log(4, this.zabbixLogPrefix + ' Using http proxy: ' + params['http_proxy']);
            		}
            
            		if (httpMethod === 'post') {
            			var apiRateLimitExceeded = false;
            			do {
            				const response = this.request.post('https://' + params['api_host'] + apiPath + apiParams, body);
            
            				try {
            					if (JSON.parse(response)['code'] === 'TooManyRequests') {
            
            						apiRateLimitExceeded = true;
            						Zabbix.sleep(1000);
            					} else {
            						apiRateLimitExceeded = false;
            					}
            				} catch (error) {
            					Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the response: ' + JSON.stringify(response));
            					throw 'Could not parse the response. See logs for more information.';
            				}
            			} while (apiRateLimitExceeded);
            		} else {
            			const response = this.request.get('https://' + params['api_host'] + apiPath + apiParams);
            		}
            
            		this.request.clearHeader();
            
            		if (this.request.getStatus() === parseInt(params['http_status_code'])) {
            			return response;
            		} else {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Unexpected HTTP response code: ' + this.request.getStatus());
            			throw 'Unexpected HTTP response code: ' + this.request.getStatus();
            		}
            	};
            
            	this.extractData = function (httpMethod, data, keys, compartment) {
            		try {
            			data = JSON.parse(data);
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not parse the received JSON object: ' + data);
            			throw 'Could not parse received JSON object. See logs for more information.';
            		}
            
            		if (typeof keys == 'object') {
            			var returnBuffer = [];
            			for (var dataObj = 0, dataLength = data.length; dataObj < dataLength; dataObj++) {
            
            				var objectBuffer = {};
            				for (var key = 0, keysLength = keys.length; key < keysLength; key++) {
            					if (data[dataObj][keys[key]] || data[dataObj][keys[key]] == null) {
            						objectBuffer[keys[key].match(/^[a-z]+$|[A-Z][a-z]+$/)[0].toLowerCase()] = data[dataObj][keys[key]];
            					} else {
            						Zabbix.log(3, this.zabbixLogPrefix + ' Received an unexpected JSON object. Could not get value for key "' + keys[key] + '" in JSON: ' + JSON.stringify(data[dataObj]));
            						throw 'Received an unexpected JSON object. See logs for more information.';
            					}
            				}
            				if (typeof compartment != 'undefined' && compartment != '') objectBuffer['compartment'] = compartment;
            				returnBuffer.push(objectBuffer);
            			}
            			return returnBuffer;
            		}
            
            		try {
            			if (httpMethod === 'get') {
            				return data[keys];
            			} else {
            				if (data.length === 0) {
            					return 0;
            				}
            				data = data[0][keys];
            				return data[data.length - 1]['value'];
            			}
            		} catch (error) {
            			Zabbix.log(3, this.zabbixLogPrefix + ' Could not find key "' + keys + '" in JSON: ' + JSON.stringify(data));
            			throw 'Could not find required key in JSON object. See logs for more information.';
            		}
            	};
            }
            
            
            const params = JSON.parse(value);
            validateZabbixParams(['tenancy_ocid', 'user_ocid', 'private_key', 'fingerprint', 'api_host', 'bucket_name', 'http_status_code', 'req_interval', 'compartment_id'], params);
            var oci = new OCI('Object storage', 'Get metrics ' + params['req_interval'] + 'm', params);
            const mql = 'EnabledOLM[' + params['req_interval'] + 'm]{resourceDisplayName=' + params['bucket_name'] + '}.mean()';
            
            return JSON.stringify(oci.extractData('post', oci.executeRequest('post', '/20180401/metrics/actions/summarizeMetricsData', '?compartmentId=' + encodeURIComponent(params['compartment_id']), mql, 'oci_objectstorage'), 'aggregatedDatapoints'));
          description: |
            Indicates whether a bucket has any executable Object Lifecycle Management policies configured. `EnabledOLM` emits:
            
                1 - if policies are configured
                0 - if no policies are configured
            
          preprocessing:
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          timeout: 10s
          parameters:
            - name: api_host
              value: '{$OCI.API.TELEMETRY.HOST}'
            - name: bucket_name
              value: '{$OCI.OBJECT.STORAGE.BUCKET}'
            - name: compartment_id
              value: '{$OCI.OBJECT.STORAGE.COMPARTMENT.ID}'
            - name: fingerprint
              value: '{$OCI.API.FINGERPRINT}'
            - name: http_proxy
              value: '{$OCI.HTTP.PROXY}'
            - name: http_status_code
              value: '{$OCI.HTTP.RETURN.CODE.OK}'
            - name: private_key
              value: '{$OCI.API.PRIVATE.KEY}'
            - name: req_interval
              value: '180'
            - name: tenancy_ocid
              value: '{$OCI.API.TENANCY}'
            - name: user_ocid
              value: '{$OCI.API.USER}'
          tags:
            - tag: component
              value: storage
          triggers:
            - uuid: 5d9652a8736247c2bcac15cf02012824
              expression: 'last(/Oracle Cloud Object Storage by HTTP/oci.obj.storage.metrics.olm.get,#1)<>last(/Oracle Cloud Object Storage by HTTP/oci.obj.storage.metrics.olm.get,#2) and length(last(/Oracle Cloud Object Storage by HTTP/oci.obj.storage.metrics.olm.get))>0'
              name: 'Object lifecycle management policy has changed'
              priority: INFO
              description: 'The object lifecycle management policy configuration has changed.'
              tags:
                - tag: scope
                  value: notice
        - uuid: 867aa1736d4c40a18a4f660023d117f4
          name: 'Number of objects'
          type: DEPENDENT
          key: oci.obj.storage.objects
          value_type: FLOAT
          description: |
            The count of objects in the bucket, excluding any multipart upload parts that have not been discarded (aborted) or committed.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.ObjectCount
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 12h
          master_item:
            key: oci.obj.storage.metrics.hourly.get
          tags:
            - tag: component
              value: storage
        - uuid: a3d83de1735d4c409192d187d793f7b2
          name: 'All requests count'
          type: DEPENDENT
          key: oci.obj.storage.requests
          value_type: FLOAT
          description: |
            The total number of all HTTP requests made in a bucket.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.AllRequests
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.obj.storage.metrics.frequent.get
          tags:
            - tag: component
              value: storage
        - uuid: 2baef7eb0b1348499eda8fb9fd11e0c8
          name: 'Post object request count'
          type: DEPENDENT
          key: oci.obj.storage.requests.post
          value_type: FLOAT
          description: |
            The total number of HTTP `POST` requests made in a bucket.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.PostRequests
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.obj.storage.metrics.frequent.get
          tags:
            - tag: component
              value: storage
        - uuid: 1853b681b5e64a0f9c172e6166a430ae
          name: 'Put object request count'
          type: DEPENDENT
          key: oci.obj.storage.requests.put
          value_type: FLOAT
          description: |
            The total number of `PutObject` requests made in a bucket.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.PutRequests
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: oci.obj.storage.metrics.frequent.get
          tags:
            - tag: component
              value: storage
        - uuid: 61901f89399c413186c9df957760c2d5
          name: 'Bucket size'
          type: DEPENDENT
          key: oci.obj.storage.size
          value_type: FLOAT
          units: B
          description: |
            The size of the bucket, excluding any multipart upload parts that have not been discarded (aborted) or committed.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.StoredBytes
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 12h
          master_item:
            key: oci.obj.storage.metrics.hourly.get
          tags:
            - tag: component
              value: storage
        - uuid: a4dc04db6b294aef865d137e5fdd0dc2
          name: 'Incomplete multipart upload size'
          type: DEPENDENT
          key: oci.obj.storage.size.incomplete
          value_type: FLOAT
          units: B
          description: |
            The size of any multipart upload parts that have not been discarded (aborted) or committed.
            
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.UncommittedParts
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 12h
          master_item:
            key: oci.obj.storage.metrics.hourly.get
          tags:
            - tag: component
              value: storage
      tags:
        - tag: class
          value: cloud
        - tag: target
          value: oci
        - tag: target
          value: oracle-cloud-infrastructure
      macros:
        - macro: '{$OCI.HTTP.PROXY}'
          description: 'Set an HTTP proxy for OCI API requests if needed.'
        - macro: '{$OCI.HTTP.RETURN.CODE.OK}'
          value: '200'
          description: |
            Set the HTTP return code that represents an OK response from the API. The default is "200",  but can vary, for example, if a proxy is used.
            
      dashboards:
        - uuid: 6dd3714db62046249cf3ff50a09091e2
          name: 'OCI Object Storage: Overview'
          pages:
            - name: Overview
              display_period: '30'
              widgets:
                - type: item
                  name: 'Overall latency time'
                  width: '30'
                  height: '5'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 6C00D9
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Overall Latency Time'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Object Storage by HTTP'
                        key: oci.obj.storage.latency.overall
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Bucket Size'
                  'y': '5'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Bucket Size'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Object Storage by HTTP'
                        key: oci.obj.storage.size
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Client-side error count'
                  'y': '8'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FF0000
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Client-side Error Count'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Object Storage by HTTP'
                        key: oci.obj.storage.client.errors
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Number of objects'
                  x: '15'
                  'y': '5'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 00D936
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Number of Objects'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Object Storage by HTTP'
                        key: oci.obj.storage.objects
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Incomplete multipart upload size'
                  x: '15'
                  'y': '8'
                  width: '15'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: FF0000
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Incomplete Multipart Upload Size'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Object Storage by HTTP'
                        key: oci.obj.storage.size.incomplete
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'First byte latency time'
                  x: '30'
                  width: '30'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 6C00D9
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'First Byte Latency Time'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Object Storage by HTTP'
                        key: oci.obj.storage.latency.byte
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'All requests'
                  x: '30'
                  'y': '3'
                  width: '18'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'All Requests'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Object Storage by HTTP'
                        key: oci.obj.storage.requests
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: Requests
                  x: '30'
                  'y': '6'
                  width: '42'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Object Storage by HTTP'
                        name: 'OCI Object Storage: Requests'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: item
                  name: 'Post object requests'
                  x: '48'
                  'y': '3'
                  width: '12'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Post Object Requests'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Object Storage by HTTP'
                        key: oci.obj.storage.requests.post
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'OLM status'
                  x: '60'
                  width: '12'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 6C00D9
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'OLM Status'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Object Storage by HTTP'
                        key: oci.obj.storage.metrics.olm.get
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: item
                  name: 'Put object requests'
                  x: '60'
                  'y': '3'
                  width: '12'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 2196F3
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Post Object Requests'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Object Storage by HTTP'
                        key: oci.obj.storage.requests.post
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
            - name: Latency
              display_period: '30'
              widgets:
                - type: item
                  name: 'Overall latency time'
                  width: '36'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 6C00D9
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'Overall Latency Time'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Object Storage by HTTP'
                        key: oci.obj.storage.latency.overall
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'Overall latency'
                  'y': '3'
                  width: '36'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Object Storage by HTTP'
                        name: 'OCI Object Storage: Overall latency'
                    - type: STRING
                      name: reference
                      value: ABAAA
                - type: item
                  name: 'First byte latency time'
                  x: '36'
                  width: '36'
                  height: '3'
                  hide_header: 'YES'
                  fields:
                    - type: STRING
                      name: bg_color
                      value: 6C00D9
                    - type: INTEGER
                      name: decimal_size
                      value: '45'
                    - type: STRING
                      name: description
                      value: 'First Byte Latency Time'
                    - type: STRING
                      name: desc_color
                      value: FFFFFF
                    - type: INTEGER
                      name: desc_v_pos
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Oracle Cloud Object Storage by HTTP'
                        key: oci.obj.storage.latency.byte
                    - type: INTEGER
                      name: show.0
                      value: '2'
                    - type: INTEGER
                      name: show.1
                      value: '1'
                    - type: STRING
                      name: units_color
                      value: FFFFFF
                    - type: INTEGER
                      name: units_size
                      value: '25'
                    - type: STRING
                      name: value_color
                      value: FFFFFF
                - type: graph
                  name: 'First byte latency'
                  x: '36'
                  'y': '3'
                  width: '36'
                  height: '8'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Oracle Cloud Object Storage by HTTP'
                        name: 'OCI Object Storage: First byte latency'
                    - type: STRING
                      name: reference
                      value: ABAAB
  graphs:
    - uuid: 97956d8f4b084cf38c8e46c842e806f5
      name: 'OCI Autonomous DB: Connection latency'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.latency.conn
    - uuid: adcd338dbf2746c980929932575ed953
      name: 'OCI Autonomous DB: CPU time'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.cpu.time
    - uuid: 1324dac0566447fa9ae3808fb79a65e1
      name: 'OCI Autonomous DB: CPU utilization'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.cpu.util
    - uuid: 14ffe3b6eb084fdeac6cbdefdb356a3b
      name: 'OCI Autonomous DB: DB time'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.time
    - uuid: 464902ef122a438bba519071f29df0c8
      name: 'OCI Autonomous DB: Execute count'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.exec.count
    - uuid: a23cf1625b5d4f6c848a6f7236dbeb6b
      name: 'OCI Autonomous DB: Parse count failures'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.parse.count.failed
    - uuid: e13b6b26310d4954a2df15244a7b2de9
      name: 'OCI Autonomous DB: Parse count hard'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.parse.count.hard
    - uuid: 75997227333c46de87199c0247d5bdb5
      name: 'OCI Autonomous DB: Parse count total'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.parse.count.total
    - uuid: e160cc5a9e22404a91e2bdcc33e22108
      name: 'OCI Autonomous DB: Physical read/write total bytes'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.physical.read.bytes
        - sortorder: '1'
          color: F63100
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.physical.write.bytes
    - uuid: 2def3ab2a81a4b6abfb2b209f134c1af
      name: 'OCI Autonomous DB: Physical reads/writes'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.physical.reads
        - sortorder: '1'
          color: F63100
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.physical.writes
    - uuid: fd5d001fb93a409db9ebfdc66d0a8861
      name: 'OCI Autonomous DB: Query latency'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.latency.query
    - uuid: 71a7e76a9bc34cc58abd77ef76d9ed4a
      name: 'OCI Autonomous DB: Session logical reads'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.logical.reads.session
    - uuid: c03100979bbf485dbd5c36900ec73469
      name: 'OCI Autonomous DB: Session stats'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.sessions
        - sortorder: '1'
          color: F63100
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.conn.failed
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.logons
        - sortorder: '3'
          color: F7941D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.logons.failed
    - uuid: e8f1cdda63e44ca9a5b73bbd8c55ffa0
      name: 'OCI Autonomous DB: SQL*Net client bytes'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.sqlnet.bytes.recv.client
        - sortorder: '1'
          color: F63100
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.sqlnet.bytes.sent.client
    - uuid: c485b41073d341a98e5aa239fc7afd21
      name: 'OCI Autonomous DB: SQL*Net DBLink bytes'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.sqlnet.bytes.recv.dblink
        - sortorder: '1'
          color: F63100
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.sqlnet.bytes.sent.dblink
    - uuid: 8adb6f1a0b3242be8142fc62370db900
      name: 'OCI Autonomous DB: Statements'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.statements.running
        - sortorder: '1'
          color: F63100
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.queued.statements
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.transaction.count
    - uuid: 2579982f4501490283fe2cbcf90330f0
      name: 'OCI Autonomous DB: Storage stats'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.storage.space.max
        - sortorder: '1'
          color: F63100
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.storage.space.alloc
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.storage.space.used
    - uuid: d96a821b6e6e4557a40e87246d2ffdfe
      name: 'OCI Autonomous DB: Storage utilization'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.storage.space.util
    - uuid: 3040bdaf0f8c49a68b80dbe60f8f9c9a
      name: 'OCI Autonomous DB: User calls'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.user.calls
    - uuid: 2620ae19fd7243d2ac37daabf9dbce46
      name: 'OCI Autonomous DB: User commits'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.user.commits
    - uuid: 1e5d6a326c7e45cb83f7689c9a4bfce1
      name: 'OCI Autonomous DB: User rollbacks'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.user.rollbacks
    - uuid: 3d55d19a57b34764a5f5cdc364204849
      name: 'OCI Autonomous DB: Wait time'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Autonomous Database by HTTP'
            key: oci.aut.db.wait.time
    - uuid: 68f6c72e67f947b29f879b89a205d59c
      name: 'OCI Block Volume: Operations'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Block Volume by HTTP'
            key: oci.block.volume.read.ops
        - sortorder: '1'
          color: F63100
          item:
            host: 'Oracle Cloud Block Volume by HTTP'
            key: oci.block.volume.write.ops
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Oracle Cloud Block Volume by HTTP'
            key: oci.block.volume.throttled.ops
        - sortorder: '3'
          color: F7941D
          yaxisside: RIGHT
          item:
            host: 'Oracle Cloud Block Volume by HTTP'
            key: oci.block.volume.iops
    - uuid: 16076dfa25244b5093e8985ca2e3f18c
      name: 'OCI Block Volume: Throughput'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Block Volume by HTTP'
            key: oci.block.volume.read
        - sortorder: '1'
          color: F63100
          item:
            host: 'Oracle Cloud Block Volume by HTTP'
            key: oci.block.volume.write
        - sortorder: '2'
          color: 00611C
          yaxisside: RIGHT
          item:
            host: 'Oracle Cloud Block Volume by HTTP'
            key: oci.block.volume.throughput
    - uuid: 6078da9c1eb249548536663e57e7743c
      name: 'OCI Block Volume: VPUs/GB'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Block Volume by HTTP'
            key: oci.block.volume.vpu
    - uuid: 265e1b5e20084bfb9ab272996915b45d
      name: 'OCI Boot Volume: Operations'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Boot Volume by HTTP'
            key: oci.boot.volume.read.ops
        - sortorder: '1'
          color: F63100
          item:
            host: 'Oracle Cloud Boot Volume by HTTP'
            key: oci.boot.volume.write.ops
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Oracle Cloud Boot Volume by HTTP'
            key: oci.boot.volume.throttled.ops
        - sortorder: '3'
          color: F7941D
          yaxisside: RIGHT
          item:
            host: 'Oracle Cloud Boot Volume by HTTP'
            key: oci.boot.volume.iops
    - uuid: 7e8aa92414d5431f80fdb1d1981d25f9
      name: 'OCI Boot Volume: Throughput'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Boot Volume by HTTP'
            key: oci.boot.volume.read
        - sortorder: '1'
          color: F63100
          item:
            host: 'Oracle Cloud Boot Volume by HTTP'
            key: oci.boot.volume.write
        - sortorder: '2'
          color: 00611C
          yaxisside: RIGHT
          item:
            host: 'Oracle Cloud Boot Volume by HTTP'
            key: oci.boot.volume.throughput
    - uuid: fdfb060d0823480abe77581503f82a96
      name: 'OCI Boot Volume: VPUs/GB'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Boot Volume by HTTP'
            key: oci.boot.volume.vpu
    - uuid: 70f0b43207cd4e28bf93e0b41ad45a10
      name: 'OCI Compute: Cpu utilization'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Compute by HTTP'
            key: oci.compute.cpu.util
    - uuid: 944bf71570b549ce8682d3f1beea5c57
      name: 'OCI Compute: Disk bytes read'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Compute by HTTP'
            key: oci.compute.disk.read
    - uuid: 39ece65d2b2b402abee59432cc3a3cea
      name: 'OCI Compute: Disk bytes read I/O'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Compute by HTTP'
            key: oci.compute.disk.io.read
    - uuid: f073ce71549946509fe9f021b3c2d2e9
      name: 'OCI Compute: Disk bytes write I/O'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Compute by HTTP'
            key: oci.compute.disk.io.write
    - uuid: 784735022c1e40fc9cf7d065e95124f3
      name: 'OCI Compute: Disk bytes written'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Compute by HTTP'
            key: oci.compute.disk.written
    - uuid: 9f4a1426c49f47bfade03875a6af0a60
      name: 'OCI Compute: Memory allocation stalls'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Compute by HTTP'
            key: oci.compute.mem.stalls
    - uuid: db9ad56d9e334de0a3ba7f6c3862fb76
      name: 'OCI Compute: Memory utilization'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Compute by HTTP'
            key: oci.compute.mem.util
    - uuid: 609ba54782934bb8b60696588bf57038
      name: 'OCI Compute: Network bytes in'
      graph_items:
        - color: 00D936
          item:
            host: 'Oracle Cloud Compute by HTTP'
            key: oci.compute.network.in
    - uuid: 807729ba0afb4710a33307286d5c027a
      name: 'OCI Compute: Network bytes out'
      graph_items:
        - color: 2196F3
          item:
            host: 'Oracle Cloud Compute by HTTP'
            key: oci.compute.network.out
    - uuid: fa3fab6874614a3cbea45dee87660253
      name: 'OCI Object Storage: Bucket size'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Object Storage by HTTP'
            key: oci.obj.storage.size
        - sortorder: '1'
          color: F63100
          yaxisside: RIGHT
          item:
            host: 'Oracle Cloud Object Storage by HTTP'
            key: oci.obj.storage.objects
    - uuid: 2c32d269e0274b26a40b0b5069abda7c
      name: 'OCI Object Storage: Client-side error count'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Object Storage by HTTP'
            key: oci.obj.storage.client.errors
    - uuid: 445af3dbf17e4046b5350fd1b4b3734b
      name: 'OCI Object Storage: First byte latency'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Object Storage by HTTP'
            key: oci.obj.storage.latency.byte
    - uuid: 15fb3f080d6244a48d1a7c98f69a2793
      name: 'OCI Object Storage: Incomplete multipart upload size'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Object Storage by HTTP'
            key: oci.obj.storage.size.incomplete
    - uuid: 0f71c9aa038d437fa28312c58d417ad1
      name: 'OCI Object Storage: Overall latency'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Object Storage by HTTP'
            key: oci.obj.storage.latency.overall
    - uuid: 49c9abb27e194d1788ee1c62688ff57b
      name: 'OCI Object Storage: Requests'
      graph_items:
        - color: 199C0D
          item:
            host: 'Oracle Cloud Object Storage by HTTP'
            key: oci.obj.storage.requests
        - sortorder: '1'
          color: F63100
          item:
            host: 'Oracle Cloud Object Storage by HTTP'
            key: oci.obj.storage.requests.post
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Oracle Cloud Object Storage by HTTP'
            key: oci.obj.storage.requests.put
