zabbix_export:
  version: '7.4'
  template_groups:
    - uuid: c2c162144c2d4c5491c8801193af4945
      name: Templates/Cloud
  templates:
    - uuid: 5175afdf713744d9a81ce53864ccfc1d
      template: 'Azure Microsoft SQL Serverless Database by HTTP'
      name: 'Azure Microsoft SQL Serverless Database by HTTP'
      description: |
        This template is designed to monitor Microsoft SQL serverless databases by HTTP.
        It works without any external scripts and uses the script item.
        
        Setup:
          1. Create an Azure service principal via the Azure command-line interface (Azure CLI) for your subscription.
            `az ad sp create-for-rbac --name zabbix --role reader --scope /subscriptions/<subscription_id>`
            See https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli for more details.
          2. Link the template to a host.
          3. Configure the macros: {$AZURE.APP.ID}, {$AZURE.PASSWORD}, {$AZURE.TENANT.ID}, {$AZURE.SUBSCRIPTION.ID}, and {$AZURE.RESOURCE.ID}.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/
        
        Generated by official Zabbix template tool "Templator"
      wizard_ready: 'YES'
      readme: |
        ## Overview
        
        This template is designed to monitor Microsoft SQL serverless databases by HTTP.
        It works without any external scripts and uses the script item.
        
        ## Setup
        
        1. Create an Azure service principal via the Azure command-line interface (Azure CLI) for your subscription.
        
              `az ad sp create-for-rbac --name zabbix --role reader --scope /subscriptions/<subscription_id>`
        
        > See [Azure documentation](https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli) for more details.
        
        2. Link the template to a host.
        3. Configure the macros: `Azure App ID`, `Azure password`, `Azure tenant ID`, `Azure subscription ID`, and `Azure MSSQL database ID`.
      vendor:
        name: Zabbix
        version: 7.4-1
      groups:
        - name: Templates/Cloud
      items:
        - uuid: 7c11fcc4f4b349f8b98fac93ae5e32be
          name: 'App CPU billed'
          type: DEPENDENT
          key: azure.db.mssql.app.cpu.billed
          value_type: FLOAT
          description: 'App CPU billed. Applies to serverless databases.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.app_cpu_billed.total
              error_handler: DISCARD_VALUE
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: cpu
        - uuid: 6e67a868b2d84838803d3cb464ae9648
          name: 'App CPU percentage'
          type: DEPENDENT
          key: azure.db.mssql.app.cpu.percent
          value_type: FLOAT
          units: '%'
          description: 'App CPU percentage. Applies to serverless databases.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.app_cpu_percent.average
              error_handler: DISCARD_VALUE
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: cpu
        - uuid: a38a887341914e75a01c7527c40b678f
          name: 'App memory percentage'
          type: DEPENDENT
          key: azure.db.mssql.app.memory.percent
          value_type: FLOAT
          units: '%'
          description: 'App memory percentage. Applies to serverless databases.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.app_memory_percent.average
              error_handler: DISCARD_VALUE
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: memory
        - uuid: c2d3bc4ff95b4e05898dccee3d73a349
          name: 'Availability status detailed'
          type: DEPENDENT
          key: azure.db.mssql.availability.details
          value_type: CHAR
          description: 'The summary description of the availability status.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.health.summary
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: health
        - uuid: 9a3f2e99a768492c859c8f368c6a5cd3
          name: 'Availability state'
          type: DEPENDENT
          key: azure.db.mssql.availability.state
          description: 'The availability status of the resource.'
          valuemap:
            name: 'Azure resource health state'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.health.availabilityState
              error_handler: CUSTOM_VALUE
              error_handler_params: '3'
            - type: STR_REPLACE
              parameters:
                - Available
                - '0'
            - type: STR_REPLACE
              parameters:
                - Degraded
                - '1'
            - type: STR_REPLACE
              parameters:
                - Unavailable
                - '2'
            - type: STR_REPLACE
              parameters:
                - Unknown
                - '3'
            - type: IN_RANGE
              parameters:
                - '0'
                - '3'
              error_handler: CUSTOM_VALUE
              error_handler_params: '3'
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: health
          triggers:
            - uuid: 37c52a28908a45378266f68acdf5c308
              expression: 'last(/Azure Microsoft SQL Serverless Database by HTTP/azure.db.mssql.availability.state)=1'
              name: 'Azure MSSQL Serverless: Microsoft SQL database is degraded'
              opdata: '{ITEM.LASTVALUE1}'
              priority: AVERAGE
              description: 'The resource is in a degraded state.'
              tags:
                - tag: scope
                  value: availability
            - uuid: 20bd79f05f3241a9950a83dcd9e325ba
              expression: 'last(/Azure Microsoft SQL Serverless Database by HTTP/azure.db.mssql.availability.state)=3'
              name: 'Azure MSSQL Serverless: Microsoft SQL database is in unknown state'
              opdata: '{ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'The resource state is unknown.'
              tags:
                - tag: scope
                  value: availability
            - uuid: 124813388e9844e8aae5ce474a66a774
              expression: 'last(/Azure Microsoft SQL Serverless Database by HTTP/azure.db.mssql.availability.state)=2'
              name: 'Azure MSSQL Serverless: Microsoft SQL database is unavailable'
              opdata: '{ITEM.LASTVALUE1}'
              priority: HIGH
              description: 'The resource state is unavailable.'
              tags:
                - tag: scope
                  value: availability
        - uuid: 2457708a49d141faa16bd7b4ceb2c0a4
          name: 'Connections failed: System errors'
          type: DEPENDENT
          key: azure.db.mssql.connections.failed.system
          value_type: FLOAT
          description: 'The count of failed connections with system errors.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.connection_failed.total
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: network
        - uuid: 59e028a7323d4222a4efd727314327c1
          name: 'Connections successful'
          type: DEPENDENT
          key: azure.db.mssql.connections.successful
          value_type: FLOAT
          description: 'The count of successful connections.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.connection_successful.total
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: network
        - uuid: 0dc1cf6302574c1fbb51583e03409713
          name: 'CPU limit'
          type: DEPENDENT
          key: azure.db.mssql.cpu.limit
          value_type: FLOAT
          description: 'The CPU limit. Applies to the vCore-based databases.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.cpu_limit.average
              error_handler: DISCARD_VALUE
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: cpu
        - uuid: 53be31ecfd48472c8edfe223107c0b07
          name: 'Percentage CPU'
          type: DEPENDENT
          key: azure.db.mssql.cpu.percentage
          value_type: FLOAT
          units: '%'
          description: 'The CPU percent of a host.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.cpu_percent.average
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: cpu
          triggers:
            - uuid: 933a04a1455b4a89b1527f9ce7848259
              expression: 'min(/Azure Microsoft SQL Serverless Database by HTTP/azure.db.mssql.cpu.percentage,5m)>{$AZURE.DB.CPU.UTIL.CRIT}'
              name: 'Azure MSSQL Serverless: High CPU utilization'
              opdata: 'Current utilization: {ITEM.LASTVALUE1}'
              priority: HIGH
              description: 'The CPU utilization is too high. The system might be slow to respond.'
              tags:
                - tag: scope
                  value: performance
        - uuid: ec0fc85904e149939836c2818a6ca66a
          name: 'CPU used'
          type: DEPENDENT
          key: azure.db.mssql.cpu.used
          value_type: FLOAT
          description: 'The CPU used. Applies to the vCore-based databases.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.cpu_used.average
              error_handler: DISCARD_VALUE
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: cpu
        - uuid: d933dbacb2b94e40a757e15f13d51d2d
          name: 'Get errors'
          type: DEPENDENT
          key: azure.db.mssql.data.errors
          value_type: TEXT
          description: 'A list of errors from API requests.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.errors
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: raw
          triggers:
            - uuid: f56b125a8eff49d2aa002609c7df8b34
              expression: 'length(last(/Azure Microsoft SQL Serverless Database by HTTP/azure.db.mssql.data.errors))>0'
              name: 'Azure MSSQL Serverless: There are errors in requests to API'
              opdata: '{ITEM.LASTVALUE1}'
              priority: AVERAGE
              description: 'Zabbix has received errors in response to API requests.'
              tags:
                - tag: scope
                  value: availability
        - uuid: e1c668773b974deeaf64c0d51d1cb02d
          name: 'Get data'
          type: SCRIPT
          key: azure.db.mssql.data.get
          history: '0'
          value_type: TEXT
          params: |
            var AzureDB = {
            	params: {},
            	token: null,
            
            	setParams: function (params) {
            		['app_id', 'password', 'tenant_id', 'subscription_id', 'resource_id'].forEach(function (field) {
            			if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
            				throw 'Required param is not set: ' + field + '.';
            			}
            		});
            
            		AzureDB.params = params;
            	},
            
            
            	request: function (url, data) {
            		if (typeof data === 'undefined' || data === null) {
            			data = '';
            		}
            		var response, request = new HttpRequest();
            		if (typeof AzureDB.params.proxy !== 'undefined' && AzureDB.params.proxy !== '') {
            			request.setProxy(AzureDB.params.proxy);
            		}
            		if (AzureDB.token) {
            			request.addHeader('Accept: application/json');
            			request.addHeader('Authorization: Bearer ' + AzureDB.token);
            		}
            
            		Zabbix.log(4, '[ Azure ] Sending request: ' + url);
            
            		if (data !== '') {
            			request.addHeader('Content-Type: application/x-www-form-urlencoded');
            			response = request.post(url, data);
            		}
            		else {
            			response = request.get(url);
            		}
            
            		Zabbix.log(4, '[ Azure ] Received response with status code ' + request.getStatus() + ': ' + response);
            
            		if (request.getStatus() !== 200 || response === null) {
            			throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
            		}
            
            		try {
            			return JSON.parse(response);
            		}
            		catch (error) {
            			throw 'Failed to parse response received from API.';
            		}
            	}
            
            };
            
            var metrics = [
            	'cpu_percent',
            	'physical_data_read_percent',
            	'log_write_percent',
            	'storage',
            	'connection_successful',
            	'connection_failed',
            	'blocked_by_firewall',
            	'deadlock',
            	'storage_percent',
            	'xtp_storage_percent',
            	'workers_percent',
            	'sessions_percent',
            	'cpu_limit',
            	'cpu_used',
            	'sqlserver_process_core_percent',
            	'sqlserver_process_memory_percent',
            	'tempdb_data_size',
            	'tempdb_log_size',
            	'tempdb_log_used_percent',
            	'app_cpu_billed',
            	'app_cpu_percent',
            	'app_memory_percent',
            	'allocated_data_storage'
            ],
            	prepared_metrics = [],
            	data = {};
            	data['errors'] = {};
            	data['metrics'] = {};
            
            try {
            	AzureDB.setParams(JSON.parse(value));
            
            	try {
            		result = AzureDB.request(
            			'https://login.microsoftonline.com/' + encodeURIComponent(AzureDB.params.tenant_id) + '/oauth2/token',
            			'grant_type=client_credentials&resource=' + encodeURIComponent('https://management.azure.com/') + '&client_id=' + encodeURIComponent(AzureDB.params.app_id) + '&client_secret=' + encodeURIComponent(AzureDB.params.password)
            		);
            
            		if ('access_token' in result) {
            			AzureDB.token = result['access_token'];
            		} else {
            			throw 'Auth response does not contain access token.';
            		}
            	}
            	catch (error) {
            		data.errors.auth = error.toString();
            	}
            
            	if (!('auth' in data.errors)) {
            		try {
            			health = AzureDB.request('https://management.azure.com' + AzureDB.params.resource_id + '/providers/Microsoft.ResourceHealth/availabilityStatuses?api-version=2020-05-01');
            			if ('value' in health && Array.isArray(health.value) && health.value.length > 0 && 'properties' in health.value[0] && typeof health.value[0].properties === 'object') {
            				data.health = health.value[0].properties;
            			}
            		}
            		catch (error) {
            			data.errors.health = error.toString();
            		}
            
            		for (var i = 0; i < metrics.length; i += 20) {
            			var chunk = metrics.slice(i, i + 20);
            
            			prepared_metrics.push(
            				chunk.map(function (element) {
            					return encodeURIComponent(element);
            				}).join(',')
            			);
            		}
            
            		start_date = new Date((new Date().getTime()) - 300000).toISOString().replace(/\.\d+/, '');
            		end_date = new Date().toISOString().replace(/\.\d+/, '');
            
            		for (var j in prepared_metrics) {
            			try {
            				metrics_data = AzureDB.request('https://management.azure.com' + AzureDB.params.resource_id + '/providers/Microsoft.Insights/metrics?metricnames=' + prepared_metrics[j] + '&timespan=' + encodeURIComponent(start_date) + '/' + encodeURIComponent(end_date) + '&api-version=2021-05-01');
            				if ('value' in metrics_data && Array.isArray(metrics_data.value) && metrics_data.value.length > 0) {
            					for (k in metrics_data.value) {
            						if ('name' in metrics_data.value[k] && typeof metrics_data.value[k].name === 'object' && 'value' in metrics_data.value[k].name && typeof metrics_data.value[k].name.value === 'string' && 'timeseries' in metrics_data.value[k] && Array.isArray(metrics_data.value[k].timeseries) && metrics_data.value[k].timeseries.length > 0 && 'data' in metrics_data.value[k].timeseries[0] && Array.isArray(metrics_data.value[k].timeseries[0].data) && metrics_data.value[k].timeseries[0].data.length > 0) {
            							data.metrics[metrics_data.value[k].name.value.replace(/(\s|\/)+/g, '')] = metrics_data.value[k].timeseries[0].data[metrics_data.value[k].timeseries[0].data.length - 1];
            						}
            					}
            				}
            			}
            			catch (error) {
            				data.errors[prepared_metrics[j]] = error.toString();
            			}
            		}
            	}
            }
            catch (error) {
            	data.errors.params = error.toString();
            }
            
            if (Object.keys(data.errors).length !== 0) {
            	errors = 'Failed to receive data:';
            	for (var error in data.errors) {
            		errors += '\n' + error + ' : ' + data.errors[error];
            	}
            	data.errors = errors;
            }
            else {
            	data.errors = '';
            }
            
            return JSON.stringify(data);
          description: 'The result of API requests is expressed in the JSON.'
          timeout: '{$AZURE.DATA.TIMEOUT}'
          parameters:
            - name: app_id
              value: '{$AZURE.APP.ID}'
            - name: password
              value: '{$AZURE.PASSWORD}'
            - name: proxy
              value: '{$AZURE.PROXY}'
            - name: resource_id
              value: '{$AZURE.RESOURCE.ID}'
            - name: subscription_id
              value: '{$AZURE.SUBSCRIPTION.ID}'
            - name: tenant_id
              value: '{$AZURE.TENANT.ID}'
          tags:
            - tag: component
              value: raw
        - uuid: 40b15dd3d7a943d99f1bbe7fb34a9f48
          name: 'Data IO percentage'
          type: DEPENDENT
          key: azure.db.mssql.data.read.percentage
          value_type: FLOAT
          units: '%'
          description: 'The physical data read percentage.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.physical_data_read_percent.average
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: operations
        - uuid: 25b97b67d87945b48ae5c44b1db20187
          name: Deadlocks
          type: DEPENDENT
          key: azure.db.mssql.deadlocks
          value_type: FLOAT
          description: 'The count of deadlocks. Not applicable to the data warehouses.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.deadlock.total
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: network
        - uuid: de91693b0a3345b4ad2c9aafd2af5325
          name: 'Connections blocked by firewall'
          type: DEPENDENT
          key: azure.db.mssql.firewall.blocked
          value_type: FLOAT
          description: 'The count of connections blocked by firewall.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.blocked_by_firewall.total
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: network
        - uuid: b41292705c284a77847856c2818d7145
          name: 'Log IO percentage'
          type: DEPENDENT
          key: azure.db.mssql.log.write.percentage
          value_type: FLOAT
          units: '%'
          description: 'The percentage of I/O log. Not applicable to the data warehouses.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.log_write_percent.average
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: operations
        - uuid: 7b772170199f41d4ab614dee66176630
          name: 'SQL Server process core percent'
          type: DEPENDENT
          key: azure.db.mssql.server.cpu.percent
          value_type: FLOAT
          units: '%'
          description: 'The CPU usage as a percentage of the SQL DB process. Not applicable to the data warehouses.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.sqlserver_process_core_percent.maximum
              error_handler: DISCARD_VALUE
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: cpu
            - tag: component
              value: server
        - uuid: 5c0a5b745c094475b1e7a0d4f17a5627
          name: 'SQL Server process memory percent'
          type: DEPENDENT
          key: azure.db.mssql.server.memory.percent
          value_type: FLOAT
          units: '%'
          description: 'Memory usage as a percentage of the SQL DB process. Not applicable to the data warehouses.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.sqlserver_process_memory_percent.maximum
              error_handler: DISCARD_VALUE
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: memory
            - tag: component
              value: server
        - uuid: 924d96d212764c3ab18e5c14daa58840
          name: 'Sessions percentage'
          type: DEPENDENT
          key: azure.db.mssql.sessions.percent
          value_type: FLOAT
          units: '%'
          description: 'The percentage of sessions. Not applicable to the data warehouses.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.sessions_percent.average
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: sessions
        - uuid: a87fd8ac96944e57ac58b39a18f6ad41
          name: 'Data space allocated'
          type: DEPENDENT
          key: azure.db.mssql.storage.allocated
          value_type: FLOAT
          units: B
          description: 'The allocated data storage. Not applicable to the data warehouses.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.allocated_data_storage.average
              error_handler: DISCARD_VALUE
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: storage
        - uuid: 2f95fd2dd48c4664afc5cd62d02b0b0a
          name: 'Data space used percent'
          type: DEPENDENT
          key: azure.db.mssql.storage.percent
          value_type: FLOAT
          units: '%'
          description: 'The percentage of used data space. Not applicable to the data warehouses or Hyperscale databases.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.storage_percent.maximum
              error_handler: DISCARD_VALUE
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: storage
          triggers:
            - uuid: 4638130e599243fba3206abc85a7447f
              expression: 'last(/Azure Microsoft SQL Serverless Database by HTTP/azure.db.mssql.storage.percent)>{$AZURE.DB.STORAGE.PUSED.CRIT}'
              name: 'Azure MSSQL Serverless: Storage space is critically low'
              opdata: 'Current utilization: {ITEM.LASTVALUE1}'
              priority: AVERAGE
              description: 'Critical utilization of the storage space.'
              tags:
                - tag: scope
                  value: capacity
            - uuid: 4732eab4aabf439fa0b2d80b63e821e5
              expression: 'last(/Azure Microsoft SQL Serverless Database by HTTP/azure.db.mssql.storage.percent)>{$AZURE.DB.STORAGE.PUSED.WARN}'
              name: 'Azure MSSQL Serverless: Storage space is low'
              opdata: 'Current utilization: {ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'High utilization of the storage space.'
              tags:
                - tag: scope
                  value: capacity
        - uuid: 3b1fb8f993e74795b38abd56eceace0a
          name: 'Data space used'
          type: DEPENDENT
          key: azure.db.mssql.storage.used
          value_type: FLOAT
          units: B
          description: 'Data space used. Not applicable to the data warehouses.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.storage.maximum
              error_handler: DISCARD_VALUE
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: storage
        - uuid: fbd572ca3d3f42eea794ce78a5a27ec1
          name: 'In-Memory OLTP storage percent'
          type: DEPENDENT
          key: azure.db.mssql.storage.xtp.percent
          value_type: FLOAT
          units: '%'
          description: 'In-Memory OLTP storage percent. Not applicable to the data warehouses.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.xtp_storage_percent.average
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: storage
        - uuid: cea8a8ea0eaa4d26a28721882c19d9cd
          name: 'Tempdb data file size'
          type: DEPENDENT
          key: azure.db.mssql.tempdb.data.size
          value_type: FLOAT
          units: B
          description: 'Space used in `tempdb` data files, expressed in bytes. Not applicable to the data warehouses.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.tempdb_data_size.maximum
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '1024'
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: storage
        - uuid: 6c8196751a504b82920b7ffa5314a2fc
          name: 'Tempdb log used percent'
          type: DEPENDENT
          key: azure.db.mssql.tempdb.log.percent
          value_type: FLOAT
          units: '%'
          description: 'The percentage of space used in `tempdb` transaction log files. Not applicable to the data warehouses.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.tempdb_log_used_percent.maximum
              error_handler: DISCARD_VALUE
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: storage
        - uuid: b83992d1001c41b6ad3d13dbb227a733
          name: 'Tempdb log file size'
          type: DEPENDENT
          key: azure.db.mssql.tempdb.log.size
          value_type: FLOAT
          units: B
          description: 'Space used in `tempdb` transaction log files, expressed in bytes. Not applicable to the data warehouses.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.tempdb_log_size.maximum
              error_handler: DISCARD_VALUE
            - type: MULTIPLIER
              parameters:
                - '1024'
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: storage
        - uuid: a4f597ab784a4e31aedc82bfb34feeb7
          name: 'Workers percentage'
          type: DEPENDENT
          key: azure.db.mssql.workers.percent
          value_type: FLOAT
          units: '%'
          description: 'The percentage of workers. Not applicable to the data warehouses.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.metrics.workers_percent.average
          master_item:
            key: azure.db.mssql.data.get
          tags:
            - tag: component
              value: workers
      tags:
        - tag: class
          value: cloud
        - tag: subclass
          value: sql
        - tag: target
          value: azure
        - tag: target
          value: mssql
      macros:
        - macro: '{$AZURE.DATA.TIMEOUT}'
          description: 'API response timeout.'
          config:
            type: TEXT
            label: 'API timeout'
            description: 'API response timeout, in seconds.'
        - macro: '{$AZURE.DB.CPU.UTIL.CRIT}'
          value: '90'
          description: 'The critical threshold of CPU utilization, expressed in %.'
          config:
            type: TEXT
            label: 'CPU utilization critical threshold'
            description: 'The critical threshold of CPU utilization, expressed in %.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$AZURE.DB.MEMORY.UTIL.CRIT}'
          value: '90'
          description: 'The critical threshold of memory utilization, expressed in %.'
          config:
            type: TEXT
            label: 'Memory utilization critical threshold'
            description: 'The critical threshold of memory utilization, expressed in %.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$AZURE.DB.STORAGE.PUSED.CRIT}'
          value: '90'
          description: 'The critical threshold of storage utilization, expressed in %.'
          config:
            type: TEXT
            label: 'Storage utilization critical threshold'
            description: 'The critical threshold of storage utilization, expressed in %.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$AZURE.DB.STORAGE.PUSED.WARN}'
          value: '80'
          description: 'The warning threshold of storage utilization, expressed in %.'
          config:
            type: TEXT
            label: 'Storage utilization warning threshold'
            description: 'The warning threshold of storage utilization, expressed in %.'
            regex: '^-?([0-9]+|(([0-9]+)\.([0-9]+)))$'
        - macro: '{$AZURE.PASSWORD}'
          type: SECRET_TEXT
          description: 'Microsoft Azure password.'
          config:
            type: TEXT
            label: 'Azure password'
            description: 'Microsoft Azure password.'
            required: 'YES'
        - macro: '{$AZURE.PROXY}'
          description: 'Sets the HTTP proxy value. If this macro is empty, then no proxy is used.'
          config:
            type: TEXT
            label: 'HTTP proxy'
            description: 'Set the HTTP proxy value. If this macro is empty, then no proxy is used.'
        - macro: '{$AZURE.RESOURCE.ID}'
          description: 'Microsoft Azure Microsoft SQL database ID.'
          config:
            type: TEXT
            label: 'Azure MSSQL database ID'
            description: 'Microsoft Azure Microsoft SQL database ID.'
            required: 'YES'
        - macro: '{$AZURE.SUBSCRIPTION.ID}'
          description: 'Microsoft Azure subscription ID.'
          config:
            type: TEXT
            label: 'Azure subscription ID'
            description: 'Microsoft Azure subscription ID.'
            required: 'YES'
        - macro: '{$AZURE.TENANT.ID}'
          description: 'Microsoft Azure tenant ID.'
          config:
            type: TEXT
            label: 'Azure tenant ID'
            description: 'Microsoft Azure tenant ID.'
            required: 'YES'
      dashboards:
        - uuid: 7a1b55d933ba4a529f2fccef44e5cff7
          name: 'Overview Azure Microsoft SQL Serverless Database'
          pages:
            - widgets:
                - type: item
                  name: Deadlocks
                  width: '12'
                  height: '3'
                  fields:
                    - type: INTEGER
                      name: decimal_places
                      value: '0'
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        key: azure.db.mssql.deadlocks
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                - type: item
                  name: 'SQL Server process memory percent'
                  'y': '3'
                  width: '12'
                  height: '3'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        key: azure.db.mssql.server.memory.percent
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                    - type: STRING
                      name: units
                      value: '%'
                - type: item
                  name: 'CPU limit'
                  'y': '6'
                  width: '12'
                  height: '3'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        key: azure.db.mssql.cpu.limit
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                - type: item
                  name: 'Data space allocated'
                  'y': '9'
                  width: '12'
                  height: '3'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        key: azure.db.mssql.storage.allocated
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                - type: item
                  name: 'Connections successful'
                  'y': '12'
                  width: '12'
                  height: '3'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        key: azure.db.mssql.connections.successful
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                - type: item
                  name: 'Availability state'
                  x: '12'
                  width: '12'
                  height: '3'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        key: azure.db.mssql.availability.state
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                    - type: STRING
                      name: up_color
                      value: FF0000
                - type: item
                  name: 'SQL Server process core percent'
                  x: '12'
                  'y': '3'
                  width: '12'
                  height: '3'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        key: azure.db.mssql.server.cpu.percent
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                    - type: STRING
                      name: units
                      value: '%'
                - type: item
                  name: 'CPU used'
                  x: '12'
                  'y': '6'
                  width: '12'
                  height: '3'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        key: azure.db.mssql.cpu.used
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                - type: item
                  name: 'Data space used'
                  x: '12'
                  'y': '9'
                  width: '12'
                  height: '3'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        key: azure.db.mssql.storage.used
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                - type: item
                  name: 'Connections failed: System errors'
                  x: '12'
                  'y': '12'
                  width: '12'
                  height: '3'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        key: azure.db.mssql.connections.failed.system
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                - type: itemhistory
                  name: 'Availability status detailed'
                  x: '24'
                  width: '48'
                  height: '3'
                  fields:
                    - type: INTEGER
                      name: columns.0.display
                      value: '4'
                    - type: ITEM
                      name: columns.0.itemid
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        key: azure.db.mssql.availability.details
                    - type: INTEGER
                      name: columns.0.monospace_font
                      value: '1'
                    - type: STRING
                      name: columns.0.name
                      value: 'Azure Microsoft SQL: Availability status detailed'
                    - type: STRING
                      name: reference
                      value: BAAAF
                    - type: INTEGER
                      name: show_timestamp
                      value: '1'
                - type: item
                  name: 'Sessions percentage'
                  x: '24'
                  'y': '3'
                  width: '12'
                  height: '3'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        key: azure.db.mssql.sessions.percent
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                - type: graph
                  name: 'Percentage CPU'
                  x: '24'
                  'y': '6'
                  width: '48'
                  height: '3'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        name: 'Azure Microsoft SQL: CPU usage'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: graph
                  name: 'Storage utilization'
                  x: '24'
                  'y': '9'
                  width: '48'
                  height: '3'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        name: 'Azure Microsoft SQL: Storage utilization'
                    - type: STRING
                      name: reference
                      value: AAAAB
                - type: graph
                  name: Connections
                  x: '24'
                  'y': '12'
                  width: '48'
                  height: '3'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        name: 'Azure Microsoft SQL: Connections'
                    - type: STRING
                      name: reference
                      value: AAAAC
                - type: item
                  name: 'Workers percentage'
                  x: '36'
                  'y': '3'
                  width: '12'
                  height: '3'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        key: azure.db.mssql.workers.percent
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                    - type: STRING
                      name: units
                      value: '%'
                - type: item
                  name: 'App memory percentage'
                  x: '48'
                  'y': '3'
                  width: '12'
                  height: '3'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        key: azure.db.mssql.app.memory.percent
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                    - type: STRING
                      name: units
                      value: '%'
                - type: item
                  name: 'Data IO percentage'
                  x: '60'
                  'y': '3'
                  width: '12'
                  height: '3'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Azure Microsoft SQL Serverless Database by HTTP'
                        key: azure.db.mssql.data.read.percentage
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                    - type: STRING
                      name: units
                      value: '%'
      valuemaps:
        - uuid: c87b2eaeb88c4932ad63c73fcafa5331
          name: 'Azure resource health state'
          mappings:
            - value: '0'
              newvalue: Available
            - value: '1'
              newvalue: Degraded
            - value: '2'
              newvalue: Unavailable
            - value: '3'
              newvalue: Unknown
  graphs:
    - uuid: 62a9a5e1fb044a52a0b534bd4eeea914
      name: 'Azure Microsoft SQL: Connections'
      graph_items:
        - color: 199C0D
          item:
            host: 'Azure Microsoft SQL Serverless Database by HTTP'
            key: azure.db.mssql.connections.successful
        - sortorder: '1'
          color: F63100
          item:
            host: 'Azure Microsoft SQL Serverless Database by HTTP'
            key: azure.db.mssql.connections.failed.system
        - sortorder: '2'
          color: 00611C
          item:
            host: 'Azure Microsoft SQL Serverless Database by HTTP'
            key: azure.db.mssql.firewall.blocked
    - uuid: 083d307db8954fc59e8e5cfccefc16c1
      name: 'Azure Microsoft SQL: CPU usage'
      graph_items:
        - color: 199C0D
          item:
            host: 'Azure Microsoft SQL Serverless Database by HTTP'
            key: azure.db.mssql.cpu.limit
        - sortorder: '1'
          color: F63100
          item:
            host: 'Azure Microsoft SQL Serverless Database by HTTP'
            key: azure.db.mssql.cpu.used
    - uuid: f541b6591683433aba4b3e58a8ad1e5c
      name: 'Azure Microsoft SQL: Storage utilization'
      graph_items:
        - color: 199C0D
          item:
            host: 'Azure Microsoft SQL Serverless Database by HTTP'
            key: azure.db.mssql.storage.used
        - sortorder: '1'
          color: F63100
          item:
            host: 'Azure Microsoft SQL Serverless Database by HTTP'
            key: azure.db.mssql.storage.allocated
