zabbix_export:
  version: '7.0'
  template_groups:
    - uuid: e960332b3f6c46a1956486d4f3f99fce
      name: 'Templates/Server hardware'
  templates:
    - uuid: 9643f22821104f809e2486be83e1816e
      template: 'DELL PowerEdge R720 by HTTP'
      name: 'DELL PowerEdge R720 by HTTP'
      description: |
        Template for DELL PowerEdge R720 servers with iDRAC 8/9 firmware 4.32 and later and Redfish API enabled.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/426752-discussion-thread-for-official-zabbix-dell-templates
        
        Generated by official Zabbix template tool "Templator"
      vendor:
        name: Zabbix
        version: 7.0-0
      groups:
        - name: 'Templates/Server hardware'
      items:
        - uuid: 55124354a9944934acb01c8d2f8d43a6
          name: 'Firmware version'
          type: DEPENDENT
          key: dell.server.hw.firmware
          value_type: CHAR
          description: 'This attribute defines the firmware version of a remote access card.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.firmware
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          master_item:
            key: dell.server.system.get
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: c7c3d5301c8843528929123e1473af5f
              expression: 'last(/DELL PowerEdge R720 by HTTP/dell.server.hw.firmware,#1)<>last(/DELL PowerEdge R720 by HTTP/dell.server.hw.firmware,#2) and length(last(/DELL PowerEdge R720 by HTTP/dell.server.hw.firmware))>0'
              name: 'Firmware has changed'
              opdata: 'Current value: {ITEM.LASTVALUE1}'
              priority: INFO
              description: 'Firmware version has changed. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: 6ef767b8b0a94ebc822c81abd9ee5a8b
          name: 'Hardware model name'
          type: DEPENDENT
          key: dell.server.hw.model
          value_type: CHAR
          description: 'This attribute defines the model name of the system.'
          inventory_link: MODEL
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.model
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          master_item:
            key: dell.server.system.get
          tags:
            - tag: component
              value: system
        - uuid: 114dd17f872c491eb739f708ae86b340
          name: 'Hardware serial number'
          type: DEPENDENT
          key: dell.server.hw.serialnumber
          value_type: CHAR
          description: 'This attribute defines the service tag of the system.'
          inventory_link: SERIALNO_A
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.serialnumber
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          master_item:
            key: dell.server.system.get
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: 53caaec2a0664e879f85c263a43715c3
              expression: 'last(/DELL PowerEdge R720 by HTTP/dell.server.hw.serialnumber,#1)<>last(/DELL PowerEdge R720 by HTTP/dell.server.hw.serialnumber,#2) and length(last(/DELL PowerEdge R720 by HTTP/dell.server.hw.serialnumber))>0'
              name: 'Device has been replaced'
              event_name: 'Device has been replaced (new serial number received)'
              priority: INFO
              description: 'Device serial number has changed. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: 3cce4b6aff674b29a80aa5369268d99d
          name: 'Overall system health status'
          type: DEPENDENT
          key: dell.server.status
          value_type: CHAR
          description: 'This attribute defines the overall rollup status of all components in the system being monitored by the remote access card. Includes system, storage, IO devices, iDRAC, CPU, memory, etc.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.status
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
          master_item:
            key: dell.server.system.get
          tags:
            - tag: component
              value: system
          triggers:
            - uuid: da2b7ee5a60948d582327e8a5a9169b9
              expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.status,,"like","Critical")=1'
              name: 'Server is in a critical state'
              opdata: 'Current state: {ITEM.LASTVALUE1}'
              priority: HIGH
              description: 'Please check the device for faults.'
              tags:
                - tag: scope
                  value: availability
            - uuid: b8294b60044c4549baa7c930ce8acc48
              expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.status,,"like","Warning")=1'
              name: 'Server is in warning state'
              opdata: 'Current state: {ITEM.LASTVALUE1}'
              priority: WARNING
              description: 'Please check the device for warnings.'
              dependencies:
                - name: 'Server is in a critical state'
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.status,,"like","Critical")=1'
              tags:
                - tag: scope
                  value: availability
        - uuid: 05403c3757624072be7919dbd8864871
          name: 'Get system'
          type: HTTP_AGENT
          key: dell.server.system.get
          history: '0'
          value_type: TEXT
          authtype: BASIC
          username: '{$API.USER}'
          password: '{$API.PASSWORD}'
          description: 'Returns the metrics of a system.'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  function request(url) {
                  	api_request = new HttpRequest();
                  	api_request.addHeader('Authorization: Basic ' + btoa(params.user + ':' + params.password));
                  	Zabbix.log(4, '[ DELL ] Sending request: ' + url);
                  
                  	try {
                  		response = api_request.get(url);
                  	} catch (error) {
                  		Zabbix.log(4, '[ DELL ] Get request returned error ' + error);
                  		throw 'Get request returned error ' + error + '. Check debug log for more information.';
                  	}
                  
                  	Zabbix.log(4, '[ DELL ] Received response with status code ' +
                  		api_request.getStatus() + '\n' + response);
                  
                  	if (api_request.getStatus() !== 200) {
                  		var message = 'Request failed with status code ' + api_request.getStatus();
                  		if (response !== null) {
                  			if (typeof response.message === 'string') {
                  				message += ': ' + response.message;
                  			}
                  		}
                  
                  		throw message + ' Check debug log for more information.';
                  	}
                  
                  	if (response !== null) {
                  		try {
                  			response = JSON.parse(response);
                  		}
                  		catch (error) {
                  			Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  			response = null;
                  		}
                  	}
                  
                  	return {
                  		status: api_request.getStatus(),
                  		body: response
                  	};
                  }
                  
                  function getField(object, field, def) {
                  	var names = field.split('.');
                  	var name = names.shift();
                  
                  	while (typeof name !== 'undefined') {
                  		if (typeof object === undefined || typeof object[name] === 'undefined') {
                  			return def;
                  		}
                  
                  		object = object[name];
                  		name = names.shift();
                  	}
                  
                  	return object;
                  }
                  
                  try {
                  	system = JSON.parse(value);
                  }
                  catch (error) {
                  	Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  	system = null;
                  }
                  
                  var params = {
                  	url: '{$API.URL}',
                  	user: '{$API.USER}',
                  	password: '{$API.PASSWORD}'
                  };
                  var result = {
                  	model: '',
                  	serialnumber: '',
                  	status: '',
                  	firmware: ''
                  };
                  
                  var index = params.url.indexOf('://');
                  index = params.url.indexOf('/', (index !== -1) ? (index + 3) : 0);
                  if (index !== -1) {
                  	params.url = params.url.substring(0, index);
                  }
                  
                  result.model = getField(system, 'Model', '');
                  result.serialnumber = getField(system, 'Oem.Dell.DellSystem.ChassisServiceTag', '');
                  result.status = getField(system, 'Status.Health', '');
                  
                  response = request(params.url + '/redfish/v1/Managers/iDRAC.Embedded.1');
                  result.firmware = getField(response.body, 'FirmwareVersion', '');
                  
                  return JSON.stringify(result);
          url: '{$API.URL}/redfish/v1/Systems/System.Embedded.1'
          tags:
            - tag: component
              value: system
        - uuid: f71cb6b0b93945ccbb20dc660c73e15c
          name: 'Redfish API'
          type: SIMPLE
          key: 'net.tcp.service[https]'
          description: |
            The availability of Redfish API on the server.
            Possible values:
              0 unavailable
              1 available
          valuemap:
            name: zabbix.host.available
          tags:
            - tag: component
              value: health
            - tag: component
              value: system
          triggers:
            - uuid: 24004d9971ea4686b2941ecf8135b421
              expression: 'last(/DELL PowerEdge R720 by HTTP/net.tcp.service[https])=0'
              name: 'Redfish API service is unavailable'
              priority: HIGH
              description: 'The service is unavailable or does not accept TCP connections.'
              tags:
                - tag: scope
                  value: availability
      discovery_rules:
        - uuid: acf63330ee40478aa81fa73c156ee6c8
          name: 'Array controller cache discovery'
          type: HTTP_AGENT
          key: array.cache.discovery
          delay: 1h
          authtype: BASIC
          username: '{$API.USER}'
          password: '{$API.PASSWORD}'
          description: 'Discovery of a cache of disk array controllers.'
          item_prototypes:
            - uuid: a13e5b801b034e0eab55bee72afe2c06
              name: '{#BATTERY_NAME} Status'
              type: HTTP_AGENT
              key: 'dell.server.hw.diskarray.cache.battery.status[{#BATTERY_NAME}]'
              value_type: CHAR
              authtype: BASIC
              username: '{$API.USER}'
              password: '{$API.PASSWORD}'
              description: 'The status of the job. Possible values: OK, Warning, Critical.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Oem.Dell.DellControllerBattery.PrimaryStatus
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              url: '{$API.URL}{#ODATA}'
              tags:
                - tag: component
                  value: battery
                - tag: component
                  value: diskarray
              trigger_prototypes:
                - uuid: e4549547cb7747318895e6f237fc52b8
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.hw.diskarray.cache.battery.status[{#BATTERY_NAME}],,"like","Critical")=1'
                  name: '{#BATTERY_NAME} is in a critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: HIGH
                  description: 'Please check the device for faults.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 3788759c5f91471da7cac5560593be2b
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.hw.diskarray.cache.battery.status[{#BATTERY_NAME}],,"like","Warning")=1'
                  name: '{#BATTERY_NAME} is in warning state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: WARNING
                  description: 'Please check the device for warnings.'
                  dependencies:
                    - name: '{#BATTERY_NAME} is in a critical state'
                      expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.hw.diskarray.cache.battery.status[{#BATTERY_NAME}],,"like","Critical")=1'
                  tags:
                    - tag: scope
                      value: availability
          url: '{$API.URL}/redfish/v1/Systems/System.Embedded.1/Storage'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  function request(url) {
                  	api_request = new HttpRequest();
                  	api_request.addHeader('Authorization: Basic ' + btoa(params.user + ':' + params.password));
                  	Zabbix.log(4, '[ DELL ] Sending request: ' + url);
                  
                  	try {
                  		response = api_request.get(url);
                  	} catch (error) {
                  		Zabbix.log(4, '[ DELL ] Get request returned error ' + error);
                  		throw 'Get request returned error ' + error + '. Check debug log for more information.';
                  	}
                  
                  	Zabbix.log(4, '[ DELL ] Received response with status code ' +
                  		api_request.getStatus() + '\n' + response);
                  
                  	if (api_request.getStatus() !== 200) {
                  		var message = 'Request failed with status code ' + api_request.getStatus();
                  		if (response !== null) {
                  			if (typeof response.message === 'string') {
                  				message += ': ' + response.message;
                  			}
                  		}
                  
                  		throw message + ' Check debug log for more information.';
                  	}
                  
                  	if (response !== null) {
                  		try {
                  			response = JSON.parse(response);
                  		}
                  		catch (error) {
                  			Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  			response = null;
                  		}
                  	}
                  
                  	return {
                  		status: api_request.getStatus(),
                  		body: response
                  	};
                  }
                  
                  function getField(object, field, def) {
                  	var names = field.split('.');
                  	var name = names.shift();
                  
                  	while (typeof name !== 'undefined') {
                  		if (typeof object === undefined || typeof object[name] === 'undefined') {
                  			return def;
                  		}
                  
                  		object = object[name];
                  		name = names.shift();
                  	}
                  
                  	return object;
                  }
                  
                  try {
                  	storages = JSON.parse(value);
                  }
                  catch (error) {
                  	Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  	storages = null;
                  }
                  
                  var params = {
                  	url: '{$API.URL}',
                  	user: '{$API.USER}',
                  	password: '{$API.PASSWORD}'
                  };
                  var result = [];
                  
                  var index = params.url.indexOf('://');
                  index = params.url.indexOf('/', (index !== -1) ? (index + 3) : 0);
                  if (index !== -1) {
                  	params.url = params.url.substring(0, index);
                  }
                  
                  if (storages.Members instanceof Array) {
                  	storages.Members.forEach(function (storage) {
                  		if (typeof storage["@odata.id"] === 'string') {
                  			response = request(params.url + storage["@odata.id"]);
                  			controller = response.body;
                  			if (getField(controller, 'Id', '').search('RAID') > -1) {
                  				result.push({
                  					'{#BATTERY_NAME}': getField(response.body, 'Oem.Dell.DellControllerBattery.Name', ''),
                  					'{#ODATA}': controller["@odata.id"]
                  				});
                  			}
                  		}
                  	});
                  }
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 3ef57728fdca4c2791f57a993474cd98
          name: 'Array controller discovery'
          type: HTTP_AGENT
          key: array.discovery
          delay: 1h
          authtype: BASIC
          username: '{$API.USER}'
          password: '{$API.PASSWORD}'
          description: 'Discovery of disk array controllers.'
          item_prototypes:
            - uuid: 3d61cc1d4b044428b17ad9af11f90652
              name: '{#CNTLR_NAME} in slot {#SLOT} Status'
              type: HTTP_AGENT
              key: 'dell.server.hw.diskarray.status[{#CNTLR_NAME}{#SLOT}]'
              value_type: CHAR
              authtype: BASIC
              username: '{$API.USER}'
              password: '{$API.PASSWORD}'
              description: 'The status of the job. Possible values: OK, Warning, Critical.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Status.Health
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              url: '{$API.URL}{#ODATA}'
              tags:
                - tag: component
                  value: diskarray
                - tag: component
                  value: storage
              trigger_prototypes:
                - uuid: d8139731126649a8825550863b9ea832
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.hw.diskarray.status[{#CNTLR_NAME}{#SLOT}],,"like","Critical")=1'
                  name: '{#CNTLR_NAME} in slot {#SLOT} is in a critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: HIGH
                  description: 'Please check the device for faults.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 6764e247bd64411692e09fe6618c5411
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.hw.diskarray.status[{#CNTLR_NAME}{#SLOT}],,"like","Warning")=1'
                  name: '{#CNTLR_NAME} in slot {#SLOT} is in warning state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: WARNING
                  description: 'Please check the device for warnings.'
                  dependencies:
                    - name: '{#CNTLR_NAME} in slot {#SLOT} is in a critical state'
                      expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.hw.diskarray.status[{#CNTLR_NAME}{#SLOT}],,"like","Critical")=1'
                  tags:
                    - tag: scope
                      value: availability
          url: '{$API.URL}/redfish/v1/Systems/System.Embedded.1/Storage'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  function request(url) {
                  	api_request = new HttpRequest();
                  	api_request.addHeader('Authorization: Basic ' + btoa(params.user + ':' + params.password));
                  	Zabbix.log(4, '[ DELL ] Sending request: ' + url);
                  
                  	try {
                  		response = api_request.get(url);
                  	} catch (error) {
                  		Zabbix.log(4, '[ DELL ] Get request returned error ' + error);
                  		throw 'Get request returned error ' + error + '. Check debug log for more information.';
                  	}
                  
                  	Zabbix.log(4, '[ DELL ] Received response with status code ' +
                  		api_request.getStatus() + '\n' + response);
                  
                  	if (api_request.getStatus() !== 200) {
                  		var message = 'Request failed with status code ' + api_request.getStatus();
                  		if (response !== null) {
                  			if (typeof response.message === 'string') {
                  				message += ': ' + response.message;
                  			}
                  		}
                  
                  		throw message + ' Check debug log for more information.';
                  	}
                  
                  	if (response !== null) {
                  		try {
                  			response = JSON.parse(response);
                  		}
                  		catch (error) {
                  			Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  			response = null;
                  		}
                  	}
                  
                  	return {
                  		status: api_request.getStatus(),
                  		body: response
                  	};
                  }
                  
                  function getField(object, field, def) {
                  	var names = field.split('.');
                  	var name = names.shift();
                  
                  	while (typeof name !== 'undefined') {
                  		if (typeof object === undefined || typeof object[name] === 'undefined') {
                  			return def;
                  		}
                  
                  		object = object[name];
                  		name = names.shift();
                  	}
                  
                  	return object;
                  }
                  
                  try {
                  	storages = JSON.parse(value);
                  }
                  catch (error) {
                  	Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  	storages = null;
                  }
                  
                  var params = {
                  	url: '{$API.URL}',
                  	user: '{$API.USER}',
                  	password: '{$API.PASSWORD}'
                  };
                  var result = [];
                  
                  var index = params.url.indexOf('://');
                  index = params.url.indexOf('/', (index !== -1) ? (index + 3) : 0);
                  if (index !== -1) {
                  	params.url = params.url.substring(0, index);
                  }
                  
                  if (storages.Members instanceof Array) {
                  	storages.Members.forEach(function (storage) {
                  		if (typeof storage["@odata.id"] === 'string') {
                  			response = request(params.url + storage["@odata.id"]);
                  			controller = response.body;
                  			if (getField(controller, 'Id', '').search('RAID') > -1) {
                  				result.push({
                  					'{#CNTLR_NAME}': getField(response.body, 'Name', ''),
                  					'{#SLOT}': getField(response.body, 'Oem.Dell.DellController.PCISlot', ''),
                  					'{#ODATA}': controller["@odata.id"]
                  				});
                  			}
                  		}
                  	});
                  }
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 38908736806c44bdbd519f770e6dc91e
          name: 'FAN discovery'
          type: HTTP_AGENT
          key: fan.discovery
          delay: 1h
          authtype: BASIC
          username: '{$API.USER}'
          password: '{$API.PASSWORD}'
          description: 'Discovery of FAN sensors.'
          item_prototypes:
            - uuid: 2112e99b197044258693bd7c23376a08
              name: '{#SENSOR_NAME} Get sensor'
              type: HTTP_AGENT
              key: 'dell.server.sensor.fan.get[{#SENSOR_NAME}]'
              history: '0'
              value_type: TEXT
              authtype: BASIC
              username: '{$API.USER}'
              password: '{$API.PASSWORD}'
              description: 'Returns the metrics of a sensor.'
              url: '{$API.URL}{#ODATA}'
              tags:
                - tag: component
                  value: fan
                - tag: component
                  value: raw
            - uuid: 32c00337c3a24ce1bd76622b8203141f
              name: '{#SENSOR_NAME} Speed'
              type: DEPENDENT
              key: 'dell.server.sensor.fan.speed[{#SENSOR_NAME}]'
              units: rpm
              description: 'The sensor value.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Reading
              master_item:
                key: 'dell.server.sensor.fan.get[{#SENSOR_NAME}]'
              tags:
                - tag: component
                  value: fan
            - uuid: b9167957cb1a42749afcecbfd1062f7c
              name: '{#SENSOR_NAME} Status'
              type: DEPENDENT
              key: 'dell.server.sensor.fan.status[{#SENSOR_NAME}]'
              value_type: CHAR
              description: 'The status of the job. Possible values: OK, Warning, Critical.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Status.Health
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.sensor.fan.get[{#SENSOR_NAME}]'
              tags:
                - tag: component
                  value: fan
              trigger_prototypes:
                - uuid: c856499a11124210811fec617dbdd8a8
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.sensor.fan.status[{#SENSOR_NAME}],,"like","Critical")=1'
                  name: '{#SENSOR_NAME} is in a critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: HIGH
                  description: 'Please check the device for faults.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: d97e44aad2e743759dcf486e73b6e141
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.sensor.fan.status[{#SENSOR_NAME}],,"like","Warning")=1'
                  name: '{#SENSOR_NAME} is in warning state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: WARNING
                  description: 'Please check the device for warnings.'
                  dependencies:
                    - name: '{#SENSOR_NAME} is in a critical state'
                      expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.sensor.fan.status[{#SENSOR_NAME}],,"like","Critical")=1'
                  tags:
                    - tag: scope
                      value: availability
          url: '{$API.URL}/redfish/v1/Chassis/System.Embedded.1/Sensors'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  function request(url) {
                  	api_request = new HttpRequest();
                  	api_request.addHeader('Authorization: Basic ' + btoa(params.user + ':' + params.password));
                  	Zabbix.log(4, '[ DELL ] Sending request: ' + url);
                  
                  	try {
                  		response = api_request.get(url);
                  	} catch (error) {
                  		Zabbix.log(4, '[ DELL ] Get request returned error ' + error);
                  		throw 'Get request returned error ' + error + '. Check debug log for more information.';
                  	}
                  
                  	Zabbix.log(4, '[ DELL ] Received response with status code ' +
                  		api_request.getStatus() + '\n' + response);
                  
                  	if (api_request.getStatus() !== 200) {
                  		var message = 'Request failed with status code ' + api_request.getStatus();
                  		if (response !== null) {
                  			if (typeof response.message === 'string') {
                  				message += ': ' + response.message;
                  			}
                  		}
                  
                  		throw message + ' Check debug log for more information.';
                  	}
                  
                  	if (response !== null) {
                  		try {
                  			response = JSON.parse(response);
                  		}
                  		catch (error) {
                  			Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  			response = null;
                  		}
                  	}
                  
                  	return {
                  		status: api_request.getStatus(),
                  		body: response
                  	};
                  }
                  
                  try {
                  	sensors = JSON.parse(value);
                  }
                  catch (error) {
                  	Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  	sensors = null;
                  }
                  
                  var params = {
                  	url: '{$API.URL}',
                  	user: '{$API.USER}',
                  	password: '{$API.PASSWORD}'
                  };
                  var result = [];
                  
                  var index = params.url.indexOf('://');
                  index = params.url.indexOf('/', (index !== -1) ? (index + 3) : 0);
                  if (index !== -1) {
                  	params.url = params.url.substring(0, index);
                  }
                  
                  if (sensors.Members instanceof Array) {
                  	sensors.Members.forEach(function (sensor) {
                  		if (typeof sensor["@odata.id"] === 'string') {
                  			response = request(params.url + sensor["@odata.id"]);
                  			if (response.body.ReadingType === 'Rotational') {
                  				if (typeof response.body.Name === 'string') {
                  					result.push({ '{#SENSOR_NAME}': response.body.Name, '{#ODATA}': sensor["@odata.id"] });
                  				}
                  			}
                  		}
                  	});
                  }
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 677239d906704f1ca4be041b209e7aa3
          name: 'Network interface discovery'
          type: HTTP_AGENT
          key: net.if.discovery
          delay: 1h
          authtype: BASIC
          username: '{$API.USER}'
          password: '{$API.PASSWORD}'
          description: 'The NetworkInterface schema describes links to the NetworkAdapter and represents the functionality available to the containing system.'
          item_prototypes:
            - uuid: 13f09a8a9ffd4724b783f6f6ffca4237
              name: '{#IFNAME} Get interface'
              type: HTTP_AGENT
              key: 'dell.server.net.if.get[{#IFNAME}]'
              history: '0'
              value_type: TEXT
              authtype: BASIC
              username: '{$API.USER}'
              password: '{$API.PASSWORD}'
              description: 'Returns the metrics of a network interface.'
              url: '{$API.URL}{#ODATA}'
              tags:
                - tag: component
                  value: network
                - tag: component
                  value: raw
            - uuid: 5a29abc9a33c498498ede924953e506e
              name: '{#IFNAME} Status'
              type: DEPENDENT
              key: 'dell.server.net.if.health[{#IFNAME}]'
              value_type: CHAR
              description: 'The status of the job. Possible values: OK, Warning, Critical.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Status.Health
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.net.if.get[{#IFNAME}]'
              tags:
                - tag: component
                  value: network
              trigger_prototypes:
                - uuid: c83b9b49f9bd4ddd9fb19033b5ad581c
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.net.if.health[{#IFNAME}],,"like","Critical")=1'
                  name: '{#IFNAME} is in a critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: HIGH
                  description: 'Please check the device for faults.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: db482b43f586470c9cf46e711954f148
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.net.if.health[{#IFNAME}],,"like","Warning")=1'
                  name: '{#IFNAME} is in warning state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: WARNING
                  description: 'Please check the device for warnings.'
                  dependencies:
                    - name: '{#IFNAME} is in a critical state'
                      expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.net.if.health[{#IFNAME}],,"like","Critical")=1'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 03a1c99b946b470393bf59a1025dfad4
              name: '{#IFNAME} Speed'
              type: DEPENDENT
              key: 'dell.server.net.if.speed[{#IFNAME}]'
              units: '!Mbps'
              description: 'Network port current link speed.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.CurrentLinkSpeedMbps
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.net.if.get[{#IFNAME}]'
              tags:
                - tag: component
                  value: network
            - uuid: bbfc1c324a92402381adf94fee5c4ca0
              name: '{#IFNAME} State'
              type: DEPENDENT
              key: 'dell.server.net.if.state[{#IFNAME}]'
              value_type: CHAR
              description: 'The known state of the Resource, for example, enabled. Possible values: Enabled, Disabled, StandbyOffline, StandbySpare, InTest, Starting, Absent, UnavailableOffline, Deferring, Quiesced, Updating, Qualified.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Status.State
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.net.if.get[{#IFNAME}]'
              tags:
                - tag: component
                  value: network
            - uuid: a68c98640efc4c5eb146409339261f51
              name: '{#IFNAME} Link status'
              type: DEPENDENT
              key: 'dell.server.net.if.status[{#IFNAME}]'
              value_type: CHAR
              description: 'The status of the link between this port and its link partner. Possible values: Down, Up, null.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.LinkStatus
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.net.if.get[{#IFNAME}]'
              tags:
                - tag: component
                  value: network
              trigger_prototypes:
                - uuid: bf30aa7ff82e4d08b3b48ded248c4d46
                  expression: '{$IFCONTROL:"{#IFNAME}"}=1 and (find(/DELL PowerEdge R720 by HTTP/dell.server.net.if.status[{#IFNAME}],,"like")="Down" and last(/DELL PowerEdge R720 by HTTP/dell.server.net.if.status[{#IFNAME}],#1)<>last(/DELL PowerEdge R720 by HTTP/dell.server.net.if.status[{#IFNAME}],#2))'
                  recovery_mode: RECOVERY_EXPRESSION
                  recovery_expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.net.if.status[{#IFNAME}],,"like")<>"Down" or {$IFCONTROL:"{#IFNAME}"}=0'
                  name: '{#IFNAME} Link down'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: AVERAGE
                  description: |
                    This trigger expression works as follows:
                    1. It can be triggered if the operations status is down.
                    2. `{$IFCONTROL:"{#IFNAME}"}=1` - a user can redefine context macro to value - 0. That marks this interface as not important. No new trigger will be fired if this interface is down.
                    3. `{TEMPLATE_NAME:METRIC.diff()}=1` - the trigger fires only if the operational status was up to (1) sometime before (so, do not fire for the 'eternal off' interfaces.)
                    
                    WARNING: if closed manually - it will not fire again on the next poll, because of .diff.
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: availability
          url: '{$API.URL}/redfish/v1/Chassis/System.Embedded.1/NetworkAdapters'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  function request(url) {
                  	api_request = new HttpRequest();
                  	api_request.addHeader('Authorization: Basic ' + btoa(params.user + ':' + params.password));
                  	Zabbix.log(4, '[ DELL ] Sending request: ' + url);
                  
                  	try {
                  		response = api_request.get(url);
                  	} catch (error) {
                  		Zabbix.log(4, '[ DELL ] Get request returned error ' + error);
                  		throw 'Get request returned error ' + error + '. Check debug log for more information.';
                  	}
                  
                  	Zabbix.log(4, '[ DELL ] Received response with status code ' +
                  		api_request.getStatus() + '\n' + response);
                  
                  	if (api_request.getStatus() !== 200) {
                  		var message = 'Request failed with status code ' + api_request.getStatus();
                  		if (response !== null) {
                  			if (typeof response.message === 'string') {
                  				message += ': ' + response.message;
                  			}
                  		}
                  
                  		throw message + ' Check debug log for more information.';
                  	}
                  
                  	if (response !== null) {
                  		try {
                  			response = JSON.parse(response);
                  		}
                  		catch (error) {
                  			Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  			response = null;
                  		}
                  	}
                  
                  	return {
                  		status: api_request.getStatus(),
                  		body: response
                  	};
                  }
                  
                  function getField(object, field, def) {
                  	var names = field.split('.');
                  	var name = names.shift();
                  
                  	while (typeof name !== 'undefined') {
                  		if (typeof object === undefined || typeof object[name] === 'undefined') {
                  			return def;
                  		}
                  
                  		object = object[name];
                  		name = names.shift();
                  	}
                  
                  	return object;
                  }
                  
                  try {
                  	adapters = JSON.parse(value);
                  }
                  catch (error) {
                  	Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  	adapters = null;
                  }
                  
                  var params = {
                  	url: '{$API.URL}',
                  	user: '{$API.USER}',
                  	password: '{$API.PASSWORD}'
                  };
                  var result = [];
                  
                  var index = params.url.indexOf('://');
                  index = params.url.indexOf('/', (index !== -1) ? (index + 3) : 0);
                  if (index !== -1) {
                  	params.url = params.url.substring(0, index);
                  }
                  
                  if (adapters.Members instanceof Array) {
                  	adapters.Members.forEach(function (adapter) {
                  		if (typeof adapter["@odata.id"] === 'string') {
                  			response = request(params.url + adapter["@odata.id"] + "/NetworkPorts");
                  			ports = response.body;
                  			if (ports.Members instanceof Array) {
                  				ports.Members.forEach(function (port) {
                  					if (typeof port["@odata.id"] === 'string') {
                  						response = request(params.url + port["@odata.id"]);
                  						result.push({ '{#IFNAME}': getField(response.body, 'Id', ''), '{#ODATA}': port["@odata.id"] });
                  					}
                  				});
                  			}
                  		}
                  	});
                  }
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: f40fb375a0ba441ea9942822471be1cf
          name: 'Physical disk discovery'
          type: HTTP_AGENT
          key: physicaldisk.discovery
          delay: 1h
          authtype: BASIC
          username: '{$API.USER}'
          password: '{$API.PASSWORD}'
          description: 'Discovery of physical disks.'
          item_prototypes:
            - uuid: f4b115b9975e44e388b077eb884d92f4
              name: '{#DISK_NAME} Get disk'
              type: HTTP_AGENT
              key: 'dell.server.hw.physicaldisk.get[{#DISK_NAME}]'
              history: '0'
              value_type: TEXT
              authtype: BASIC
              username: '{$API.USER}'
              password: '{$API.PASSWORD}'
              description: 'Returns the metrics of a physical disk.'
              url: '{$API.URL}{#ODATA}'
              tags:
                - tag: component
                  value: physicaldisk
                - tag: component
                  value: raw
                - tag: component
                  value: storage
            - uuid: e3ae47c99fb44bcba8037c71852d7bf6
              name: '{#DISK_NAME} Media type'
              type: DEPENDENT
              key: 'dell.server.hw.physicaldisk.media_type[{#DISK_NAME}]'
              value_type: CHAR
              description: 'The type of media contained in this drive. Possible values: HDD, SSD, SMR, null.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.MediaType
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.hw.physicaldisk.get[{#DISK_NAME}]'
              tags:
                - tag: component
                  value: physicaldisk
                - tag: component
                  value: storage
            - uuid: 3aab8fb330dc49d885afb31d972299fc
              name: '{#DISK_NAME} Model name'
              type: DEPENDENT
              key: 'dell.server.hw.physicaldisk.model[{#DISK_NAME}]'
              value_type: CHAR
              description: 'The model number of the drive.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Model
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.hw.physicaldisk.get[{#DISK_NAME}]'
              tags:
                - tag: component
                  value: physicaldisk
                - tag: component
                  value: storage
            - uuid: cc0f3d4b18a24cd5a98ce6d85e69a374
              name: '{#DISK_NAME} Serial number'
              type: DEPENDENT
              key: 'dell.server.hw.physicaldisk.serialnumber[{#DISK_NAME}]'
              value_type: CHAR
              description: 'The serial number of this drive.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.SerialNumber
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.hw.physicaldisk.get[{#DISK_NAME}]'
              tags:
                - tag: component
                  value: physicaldisk
                - tag: component
                  value: storage
              trigger_prototypes:
                - uuid: efaef650ead54921b101e0fe4bb4381a
                  expression: 'last(/DELL PowerEdge R720 by HTTP/dell.server.hw.physicaldisk.serialnumber[{#DISK_NAME}],#1)<>last(/DELL PowerEdge R720 by HTTP/dell.server.hw.physicaldisk.serialnumber[{#DISK_NAME}],#2) and length(last(/DELL PowerEdge R720 by HTTP/dell.server.hw.physicaldisk.serialnumber[{#DISK_NAME}]))>0'
                  name: '{#DISK_NAME} has been replaced'
                  event_name: '{#DISK_NAME} has been replaced (new serial number received)'
                  priority: INFO
                  description: '{#DISK_NAME} serial number has changed. Acknowledge to close the problem manually.'
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: notice
            - uuid: 9a72ed848c574f5aaaca432f0548272f
              name: '{#DISK_NAME} Size'
              type: DEPENDENT
              key: 'dell.server.hw.physicaldisk.size[{#DISK_NAME}]'
              trends: '0'
              units: B
              description: 'The size, in bytes, of this drive.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.CapacityBytes
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.hw.physicaldisk.get[{#DISK_NAME}]'
              tags:
                - tag: component
                  value: physicaldisk
                - tag: component
                  value: storage
            - uuid: 0db3af82611c4f49899e54c09d600aef
              name: '{#DISK_NAME} Status'
              type: DEPENDENT
              key: 'dell.server.hw.physicaldisk.status[{#DISK_NAME}]'
              value_type: CHAR
              description: 'The status of the job. Possible values: OK, Warning, Critical.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Status.Health
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.hw.physicaldisk.get[{#DISK_NAME}]'
              tags:
                - tag: component
                  value: physicaldisk
                - tag: component
                  value: storage
              trigger_prototypes:
                - uuid: 56757be1596c4b0189e5cd6fe0a8fa45
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.hw.physicaldisk.status[{#DISK_NAME}],,"like","Critical")=1'
                  name: '{#DISK_NAME} is in a critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: HIGH
                  description: 'Please check the device for faults.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 0e68f903e424472dac82f3cbd72ef248
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.hw.physicaldisk.status[{#DISK_NAME}],,"like","Warning")=1'
                  name: '{#DISK_NAME} is in warning state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: WARNING
                  description: 'Please check the device for warnings.'
                  dependencies:
                    - name: '{#DISK_NAME} is in a critical state'
                      expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.hw.physicaldisk.status[{#DISK_NAME}],,"like","Critical")=1'
                  tags:
                    - tag: scope
                      value: availability
          url: '{$API.URL}/redfish/v1/Systems/System.Embedded.1/Storage'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  function request(url) {
                  	api_request = new HttpRequest();
                  	api_request.addHeader('Authorization: Basic ' + btoa(params.user + ':' + params.password));
                  	Zabbix.log(4, '[ DELL ] Sending request: ' + url);
                  
                  	try {
                  		response = api_request.get(url);
                  	} catch (error) {
                  		Zabbix.log(4, '[ DELL ] Get request returned error ' + error);
                  		throw 'Get request returned error ' + error + '. Check debug log for more information.';
                  	}
                  
                  	Zabbix.log(4, '[ DELL ] Received response with status code ' +
                  		api_request.getStatus() + '\n' + response);
                  
                  	if (api_request.getStatus() !== 200) {
                  		var message = 'Request failed with status code ' + api_request.getStatus();
                  		if (response !== null) {
                  			if (typeof response.message === 'string') {
                  				message += ': ' + response.message;
                  			}
                  		}
                  
                  		throw message + ' Check debug log for more information.';
                  	}
                  
                  	if (response !== null) {
                  		try {
                  			response = JSON.parse(response);
                  		}
                  		catch (error) {
                  			Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  			response = null;
                  		}
                  	}
                  
                  	return {
                  		status: api_request.getStatus(),
                  		body: response
                  	};
                  }
                  
                  function getField(object, field, def) {
                  	var names = field.split('.');
                  	var name = names.shift();
                  
                  	while (typeof name !== 'undefined') {
                  		if (typeof object === undefined || typeof object[name] === 'undefined') {
                  			return def;
                  		}
                  
                  		object = object[name];
                  		name = names.shift();
                  	}
                  
                  	return object;
                  }
                  
                  try {
                  	storages = JSON.parse(value);
                  }
                  catch (error) {
                  	Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  	storages = null;
                  }
                  
                  var params = {
                  	url: '{$API.URL}',
                  	user: '{$API.USER}',
                  	password: '{$API.PASSWORD}'
                  };
                  var result = [];
                  
                  var index = params.url.indexOf('://');
                  index = params.url.indexOf('/', (index !== -1) ? (index + 3) : 0);
                  if (index !== -1) {
                  	params.url = params.url.substring(0, index);
                  }
                  
                  if (storages.Members instanceof Array) {
                  	storages.Members.forEach(function (storage) {
                  		if (typeof storage["@odata.id"] === 'string') {
                  			response = request(params.url + storage["@odata.id"]);
                  			drives = response.body;
                  			if (drives.Drives instanceof Array) {
                  				drives.Drives.forEach(function (drive) {
                  					if (typeof drive["@odata.id"] === 'string') {
                  						response = request(params.url + drive["@odata.id"]);
                  						result.push({ '{#DISK_NAME}': getField(response.body, 'Name', ''), '{#ODATA}': drive["@odata.id"] });
                  					}
                  				});
                  			}
                  		}
                  	});
                  }
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 1ae5712a1b75459e9f6fe7b3c9334ee9
          name: 'PSU discovery'
          type: HTTP_AGENT
          key: psu.discovery
          delay: 1h
          authtype: BASIC
          username: '{$API.USER}'
          password: '{$API.PASSWORD}'
          description: 'Discovery of PSU sensors.'
          item_prototypes:
            - uuid: ff702455da7748de995238ebe6bd7fbd
              name: '{#SENSOR_NAME} Get sensor'
              type: HTTP_AGENT
              key: 'dell.server.sensor.psu.get[{#SENSOR_NAME}]'
              history: '0'
              value_type: TEXT
              authtype: BASIC
              username: '{$API.USER}'
              password: '{$API.PASSWORD}'
              description: 'Returns the metrics of a sensor.'
              url: '{$API.URL}{#ODATA}'
              tags:
                - tag: component
                  value: psu
                - tag: component
                  value: raw
            - uuid: 6c7f9247ea1f46c2938fcf1cd441dd6f
              name: '{#SENSOR_NAME} Status'
              type: DEPENDENT
              key: 'dell.server.sensor.psu.status[{#SENSOR_NAME}]'
              value_type: CHAR
              description: 'The status of the job. Possible values: OK, Warning, Critical.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Status.Health
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.sensor.psu.get[{#SENSOR_NAME}]'
              tags:
                - tag: component
                  value: psu
              trigger_prototypes:
                - uuid: 1a9a063e006343c0bce9bf21ead9d93f
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.sensor.psu.status[{#SENSOR_NAME}],,"like","Critical")=1'
                  name: '{#SENSOR_NAME} is in a critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: HIGH
                  description: 'Please check the device for faults.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: c9b528eac8844abea4de8a53c0ff8893
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.sensor.psu.status[{#SENSOR_NAME}],,"like","Warning")=1'
                  name: '{#SENSOR_NAME} is in warning state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: WARNING
                  description: 'Please check the device for warnings.'
                  dependencies:
                    - name: '{#SENSOR_NAME} is in a critical state'
                      expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.sensor.psu.status[{#SENSOR_NAME}],,"like","Critical")=1'
                  tags:
                    - tag: scope
                      value: availability
          url: '{$API.URL}/redfish/v1/Chassis/System.Embedded.1/Sensors'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  function request(url) {
                  	api_request = new HttpRequest();
                  	api_request.addHeader('Authorization: Basic ' + btoa(params.user + ':' + params.password));
                  	Zabbix.log(4, '[ DELL ] Sending request: ' + url);
                  
                  	try {
                  		response = api_request.get(url);
                  	} catch (error) {
                  		Zabbix.log(4, '[ DELL ] Get request returned error ' + error);
                  		throw 'Get request returned error ' + error + '. Check debug log for more information.';
                  	}
                  
                  	Zabbix.log(4, '[ DELL ] Received response with status code ' +
                  		api_request.getStatus() + '\n' + response);
                  
                  	if (api_request.getStatus() !== 200) {
                  		var message = 'Request failed with status code ' + api_request.getStatus();
                  		if (response !== null) {
                  			if (typeof response.message === 'string') {
                  				message += ': ' + response.message;
                  			}
                  		}
                  
                  		throw message + ' Check debug log for more information.';
                  	}
                  
                  	if (response !== null) {
                  		try {
                  			response = JSON.parse(response);
                  		}
                  		catch (error) {
                  			Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  			response = null;
                  		}
                  	}
                  
                  	return {
                  		status: api_request.getStatus(),
                  		body: response
                  	};
                  }
                  
                  function getField(object, field, def) {
                  	var names = field.split('.');
                  	var name = names.shift();
                  
                  	while (typeof name !== 'undefined') {
                  		if (typeof object === undefined || typeof object[name] === 'undefined') {
                  			return def;
                  		}
                  
                  		object = object[name];
                  		name = names.shift();
                  	}
                  
                  	return object;
                  }
                  
                  try {
                  	sensors = JSON.parse(value);
                  }
                  catch (error) {
                  	Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  	sensors = null;
                  }
                  
                  var params = {
                  	url: '{$API.URL}',
                  	user: '{$API.USER}',
                  	password: '{$API.PASSWORD}'
                  };
                  var result = [];
                  
                  var index = params.url.indexOf('://');
                  index = params.url.indexOf('/', (index !== -1) ? (index + 3) : 0);
                  if (index !== -1) {
                  	params.url = params.url.substring(0, index);
                  }
                  
                  if (sensors.Members instanceof Array) {
                  	sensors.Members.forEach(function (sensor) {
                  		if (typeof sensor["@odata.id"] === 'string') {
                  			response = request(params.url + sensor["@odata.id"]);
                  			if (getField(response.body, 'ReadingType', '') === 'Voltage') {
                  				result.push({ '{#SENSOR_NAME}': getField(response.body, 'Name', ''), '{#ODATA}': sensor["@odata.id"] });
                  			}
                  		}
                  	});
                  }
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 0c8eea294f9041ca9cb8b27fd32bea80
          name: 'Temperature discovery'
          type: HTTP_AGENT
          key: temp.discovery
          delay: 1h
          authtype: BASIC
          username: '{$API.USER}'
          password: '{$API.PASSWORD}'
          description: 'Discovery of temperature sensors.'
          item_prototypes:
            - uuid: 13eb046f17ae44e3b56a911fa29462b3
              name: '{#SENSOR_NAME} Get sensor'
              type: HTTP_AGENT
              key: 'dell.server.sensor.temp.get[{#SENSOR_NAME}]'
              history: '0'
              value_type: TEXT
              authtype: BASIC
              username: '{$API.USER}'
              password: '{$API.PASSWORD}'
              description: 'Returns the metrics of a sensor.'
              url: '{$API.URL}{#ODATA}'
              tags:
                - tag: component
                  value: raw
                - tag: component
                  value: temperature
            - uuid: 7426672931d045349f7a1048a29fd404
              name: '{#SENSOR_NAME} Status'
              type: DEPENDENT
              key: 'dell.server.sensor.temp.status[{#SENSOR_NAME}]'
              value_type: CHAR
              description: 'The status of the job. Possible values: OK, Warning, Critical.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Status.Health
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.sensor.temp.get[{#SENSOR_NAME}]'
              tags:
                - tag: component
                  value: temperature
              trigger_prototypes:
                - uuid: c909cc04251c4b53bf512128476dc9ba
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.sensor.temp.status[{#SENSOR_NAME}],,"like","Critical")=1'
                  name: '{#SENSOR_NAME} is in a critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: HIGH
                  description: 'Please check the device for faults.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: 9d4bede243904a6aa92f96948d6f9ed7
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.sensor.temp.status[{#SENSOR_NAME}],,"like","Warning")=1'
                  name: '{#SENSOR_NAME} is in warning state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: WARNING
                  description: 'Please check the device for warnings.'
                  dependencies:
                    - name: '{#SENSOR_NAME} is in a critical state'
                      expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.sensor.temp.status[{#SENSOR_NAME}],,"like","Critical")=1'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: 0fb34178623b47609fd59674c01cbc70
              name: '{#SENSOR_NAME} Value'
              type: DEPENDENT
              key: 'dell.server.sensor.temp.value[{#SENSOR_NAME}]'
              value_type: FLOAT
              units: °C
              description: 'The sensor value.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Reading
              master_item:
                key: 'dell.server.sensor.temp.get[{#SENSOR_NAME}]'
              tags:
                - tag: component
                  value: temperature
          url: '{$API.URL}/redfish/v1/Chassis/System.Embedded.1/Sensors'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  function request(url) {
                  	api_request = new HttpRequest();
                  	api_request.addHeader('Authorization: Basic ' + btoa(params.user + ':' + params.password));
                  	Zabbix.log(4, '[ DELL ] Sending request: ' + url);
                  
                  	try {
                  		response = api_request.get(url);
                  	} catch (error) {
                  		Zabbix.log(4, '[ DELL ] Get request returned error ' + error);
                  		throw 'Get request returned error ' + error + '. Check debug log for more information.';
                  	}
                  
                  	Zabbix.log(4, '[ DELL ] Received response with status code ' +
                  		api_request.getStatus() + '\n' + response);
                  
                  	if (api_request.getStatus() !== 200) {
                  		var message = 'Request failed with status code ' + api_request.getStatus();
                  		if (response !== null) {
                  			if (typeof response.message === 'string') {
                  				message += ': ' + response.message;
                  			}
                  		}
                  
                  		throw message + ' Check debug log for more information.';
                  	}
                  
                  	if (response !== null) {
                  		try {
                  			response = JSON.parse(response);
                  		}
                  		catch (error) {
                  			Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  			response = null;
                  		}
                  	}
                  
                  	return {
                  		status: api_request.getStatus(),
                  		body: response
                  	};
                  }
                  
                  function getField(object, field, def) {
                  	var names = field.split('.');
                  	var name = names.shift();
                  
                  	while (typeof name !== 'undefined') {
                  		if (typeof object === undefined || typeof object[name] === 'undefined') {
                  			return def;
                  		}
                  
                  		object = object[name];
                  		name = names.shift();
                  	}
                  
                  	return object;
                  }
                  
                  try {
                  	sensors = JSON.parse(value);
                  }
                  catch (error) {
                  	Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  	sensors = null;
                  }
                  
                  var params = {
                  	url: '{$API.URL}',
                  	user: '{$API.USER}',
                  	password: '{$API.PASSWORD}'
                  };
                  var result = [];
                  
                  var index = params.url.indexOf('://');
                  index = params.url.indexOf('/', (index !== -1) ? (index + 3) : 0);
                  if (index !== -1) {
                  	params.url = params.url.substring(0, index);
                  }
                  
                  if (sensors.Members instanceof Array) {
                  	sensors.Members.forEach(function (sensor) {
                  		if (typeof sensor["@odata.id"] === 'string') {
                  			response = request(params.url + sensor["@odata.id"]);
                  			if (getField(response.body, 'ReadingType', '') === 'Temperature') {
                  				result.push({ '{#SENSOR_NAME}': getField(response.body, 'Name', ''), '{#ODATA}': sensor["@odata.id"] });
                  			}
                  		}
                  	});
                  }
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
        - uuid: 0b5735d173a04cf69422118ac8990ff4
          name: 'Virtual disk discovery'
          type: HTTP_AGENT
          key: virtualdisk.discovery
          delay: 1h
          authtype: BASIC
          username: '{$API.USER}'
          password: '{$API.PASSWORD}'
          description: 'Discovery of virtual disks.'
          item_prototypes:
            - uuid: a5a3da9fd1824fa89d41514deac80619
              name: '{#DISK_NAME} Get disk'
              type: HTTP_AGENT
              key: 'dell.server.hw.virtualdisk.get[{#DISK_NAME}]'
              history: '0'
              value_type: TEXT
              authtype: BASIC
              username: '{$API.USER}'
              password: '{$API.PASSWORD}'
              description: 'Returns the metrics of a virtual disk.'
              url: '{$API.URL}{#ODATA}'
              tags:
                - tag: component
                  value: raw
                - tag: component
                  value: virtualdisk
            - uuid: a6e3cb66270744598ef9d5ad5b99b4a7
              name: '{#DISK_NAME} RAID status'
              type: DEPENDENT
              key: 'dell.server.hw.virtualdisk.raidstatus[{#DISK_NAME}]'
              value_type: CHAR
              description: 'This property represents the RAID specific status. Possible values: Blocked, Degraded, Failed, Foreign, Offline, Online, Ready, Unknown, null.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Oem.Dell.DellVirtualDisk.RaidStatus
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.hw.virtualdisk.get[{#DISK_NAME}]'
              tags:
                - tag: component
                  value: storage
                - tag: component
                  value: virtualdisk
            - uuid: 1f11df437d8544e6b8824f9ab4b36fd1
              name: '{#DISK_NAME} Read policy'
              type: DEPENDENT
              key: 'dell.server.hw.virtualdisk.readpolicy[{#DISK_NAME}]'
              value_type: CHAR
              description: 'Indicates the read cache policy setting for the Volume. Possible values: ReadAhead, AdaptiveReadAhead, Off.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Oem.Dell.DellVirtualDisk.ReadCachePolicy
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.hw.virtualdisk.get[{#DISK_NAME}]'
              tags:
                - tag: component
                  value: storage
                - tag: component
                  value: virtualdisk
            - uuid: b1529c9635904ecbb8ea1168fd006253
              name: '{#DISK_NAME} Size'
              type: DEPENDENT
              key: 'dell.server.hw.virtualdisk.size[{#DISK_NAME}]'
              trends: '0'
              units: B
              description: 'The size in bytes of this Volume.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.CapacityBytes
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.hw.virtualdisk.get[{#DISK_NAME}]'
              tags:
                - tag: component
                  value: storage
                - tag: component
                  value: virtualdisk
            - uuid: aed92b93740a4dc3a0a3db66ebded2d1
              name: '{#DISK_NAME} Current state'
              type: DEPENDENT
              key: 'dell.server.hw.virtualdisk.state[{#DISK_NAME}]'
              value_type: CHAR
              description: 'The known state of the Resource, for example, enabled. Possible values: Enabled, Disabled, StandbyOffline, StandbySpare, InTest, Starting, Absent, UnavailableOffline, Deferring, Quiesced, Updating, Qualified.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Status.State
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.hw.virtualdisk.get[{#DISK_NAME}]'
              tags:
                - tag: component
                  value: storage
                - tag: component
                  value: virtualdisk
            - uuid: d80c7530a7e84a31a0e5013229c7d3fe
              name: '{#DISK_NAME} Status'
              type: DEPENDENT
              key: 'dell.server.hw.virtualdisk.status[{#DISK_NAME}]'
              value_type: CHAR
              description: 'The status of the job. Possible values: OK, Warning, Critical.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Status.Health
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.hw.virtualdisk.get[{#DISK_NAME}]'
              tags:
                - tag: component
                  value: storage
                - tag: component
                  value: virtualdisk
              trigger_prototypes:
                - uuid: 2284cde0da39410396fa7dd3d9151d85
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.hw.virtualdisk.status[{#DISK_NAME}],,"like","Critical")=1'
                  name: '{#DISK_NAME} is in a critical state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: HIGH
                  description: 'Please check the device for faults.'
                  tags:
                    - tag: scope
                      value: availability
                - uuid: ebd49db8ab2f491e9238dd60befe0b20
                  expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.hw.virtualdisk.status[{#DISK_NAME}],,"like","Warning")=1'
                  name: '{#DISK_NAME} is in warning state'
                  opdata: 'Current state: {ITEM.LASTVALUE1}'
                  priority: WARNING
                  description: 'Please check the device for warnings.'
                  dependencies:
                    - name: '{#DISK_NAME} is in a critical state'
                      expression: 'find(/DELL PowerEdge R720 by HTTP/dell.server.hw.virtualdisk.status[{#DISK_NAME}],,"like","Critical")=1'
                  tags:
                    - tag: scope
                      value: availability
            - uuid: b7a38f742f6d46e596e373de673db7aa
              name: '{#DISK_NAME} Write policy'
              type: DEPENDENT
              key: 'dell.server.hw.virtualdisk.writepolicy[{#DISK_NAME}]'
              value_type: CHAR
              description: 'Indicates the write cache policy setting for the Volume. Possible values: WriteThrough, ProtectedWriteBack, UnprotectedWriteBack.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.Oem.Dell.DellVirtualDisk.WriteCachePolicy
                - type: DISCARD_UNCHANGED_HEARTBEAT
                  parameters:
                    - 6h
              master_item:
                key: 'dell.server.hw.virtualdisk.get[{#DISK_NAME}]'
              tags:
                - tag: component
                  value: storage
                - tag: component
                  value: virtualdisk
          url: '{$API.URL}/redfish/v1/Systems/System.Embedded.1/Storage'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  function request(url) {
                  	api_request = new HttpRequest();
                  	api_request.addHeader('Authorization: Basic ' + btoa(params.user + ':' + params.password));
                  	Zabbix.log(4, '[ DELL ] Sending request: ' + url);
                  
                  	try {
                  		response = api_request.get(url);
                  	} catch (error) {
                  		Zabbix.log(4, '[ DELL ] Get request returned error ' + error);
                  		throw 'Get request returned error ' + error + '. Check debug log for more information.';
                  	}
                  
                  	Zabbix.log(4, '[ DELL ] Received response with status code ' +
                  		api_request.getStatus() + '\n' + response);
                  
                  	if (api_request.getStatus() !== 200) {
                  		var message = 'Request failed with status code ' + api_request.getStatus();
                  		if (response !== null) {
                  			if (typeof response.message === 'string') {
                  				message += ': ' + response.message;
                  			}
                  		}
                  
                  		throw message + ' Check debug log for more information.';
                  	}
                  
                  	if (response !== null) {
                  		try {
                  			response = JSON.parse(response);
                  		}
                  		catch (error) {
                  			Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  			response = null;
                  		}
                  	}
                  
                  	return {
                  		status: api_request.getStatus(),
                  		body: response
                  	};
                  }
                  
                  function getField(object, field, def) {
                  	var names = field.split('.');
                  	var name = names.shift();
                  
                  	while (typeof name !== 'undefined') {
                  		if (typeof object === undefined || typeof object[name] === 'undefined') {
                  			return def;
                  		}
                  
                  		object = object[name];
                  		name = names.shift();
                  	}
                  
                  	return object;
                  }
                  
                  try {
                  	storages = JSON.parse(value);
                  }
                  catch (error) {
                  	Zabbix.log(4, '[ DELL ] Failed to parse response.');
                  	storages = null;
                  }
                  
                  var params = {
                  	url: '{$API.URL}',
                  	user: '{$API.USER}',
                  	password: '{$API.PASSWORD}'
                  };
                  var result = [];
                  
                  var index = params.url.indexOf('://');
                  index = params.url.indexOf('/', (index !== -1) ? (index + 3) : 0);
                  if (index !== -1) {
                  	params.url = params.url.substring(0, index);
                  }
                  
                  if (storages.Members instanceof Array) {
                  	storages.Members.forEach(function (storage) {
                  		if (typeof storage["@odata.id"] === 'string') {
                  			response = request(params.url + storage["@odata.id"] + "/Volumes");
                  			volumes = response.body;
                  			if (volumes.Members instanceof Array) {
                  				volumes.Members.forEach(function (volume) {
                  					if (typeof volume["@odata.id"] === 'string') {
                  						response = request(params.url + volume["@odata.id"]);
                  						result.push({ '{#DISK_NAME}': getField(response.body, 'Name', ''), '{#ODATA}': volume["@odata.id"] });
                  					}
                  				});
                  			}
                  		}
                  	});
                  }
                  
                  return JSON.stringify(result);
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 6h
      tags:
        - tag: class
          value: hardware
        - tag: target
          value: dell
        - tag: target
          value: 'dell poweredge'
      macros:
        - macro: '{$API.PASSWORD}'
          value: '<Put your password here>'
          description: 'The Dell iDRAC user password.'
        - macro: '{$API.URL}'
          value: '<Put your URL here>'
          description: 'The Dell iDRAC Redfish API URL in the format `<scheme>://<host>:<port>`.'
        - macro: '{$API.USER}'
          value: '<Put your username here>'
          description: 'The Dell iDRAC username.'
        - macro: '{$IFCONTROL}'
          value: '1'
          description: 'Link status trigger will be fired only for interfaces that have the context macro equaled 1.'
      valuemaps:
        - uuid: 13a9860da38f4727a6f958b5cd3d3468
          name: zabbix.host.available
          mappings:
            - value: '0'
              newvalue: 'not available'
            - value: '1'
              newvalue: available
            - value: '2'
              newvalue: unknown
