zabbix_export: version: '6.0' date: '2021-11-21T22:00:17Z' groups: - uuid: 7df96b18c230490a9a0a9e2307226338 name: Templates templates: - uuid: 3985b39f03254e5ba71d29280a9cf79a template: 1wire-temperature-probe name: '1wire Temperature Probe' description: | ## Description Automatically finds all 1wire devices and assumes them to be temperature probes. Specifically made for DS18B20 sensor probes in combination with Raspberry Pis. Useful macros: You can assign a friendly name for the probes using the following syntax: {$PROBE:"1wire-ID"} 1wire-ID being the devices name, found under /sys/bus/w1/devices/. The set value will represent the friendly name. You also have the option to assign sensors to three different groups: 0, 1 and 2. This will modify the trigger behaviour for specific sensors. 0 is using a normal temperature range calculated for server rooms, 1 is using an extended range and 2 is disabling triggers completly. You can see the specific values in the trigger section. The macro syntax for this is similar to the friendly name: {$GROUP:"1wire-ID"} ## Overview *Specifically made for DS18B20 sensor probes in combination with Raspberry Pis. Could & should work on other systems aswell (eventually with small modifications) however it has only been tested on RPIs and DS18B20s.* --- This template will automatically find all 1wire devices and assume them to be temperature probes. It'll create items for every 1wire device it found under "/sys/bus/w1/devices/", convert the output to Celsius (in the correct fashion for DS18B20 probes) and create six threshold triggers aswell as a "no data"-trigger for each one. To better differentiate between the sensors you can assign a friendly name for probes using the following syntax: {$PROBE:"1wire-ID"} 1wire-ID being the devices name, found under /sys/bus/w1/devices/. The set value will represent the friendly name. You also have the option to assign sensors to three different groups: 0, 1 and 2. This will modify the trigger behaviour for specific sensors. 0 is using a normal temperature range calculated for server rooms, 1 is using an extended range and 2 is disabling triggers completly. The macro syntax for this is similar to the friendly name: {$GROUP:"1wire-ID"} The space limit unfortunatly doesn't allow me to tell you the thresholds here, however you can quickly see them in the trigger sections. ## Author Leonard Winck groups: - name: Templates discovery_rules: - uuid: 6e4974a60b314d0887866c508636bcc7 name: '1wire devices' key: 'system.run[find /sys/bus/w1/devices/28* -maxdepth 1 -type l -printf ''%f\n'' 2> /dev/null]' delay: 15m item_prototypes: - uuid: 573bf8c2315a47b3935d7f030e7a7bec name: 'Temperature reading of probe "{#DEVICE}" ({$PROBE:"{#DEVICE}"})' key: 'system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-]' delay: 15s value_type: FLOAT units: °C preprocessing: - type: MULTIPLIER parameters: - '0.001' tags: - tag: Application value: 'Temperature Probe' trigger_prototypes: - uuid: fe239abfa8374938825b988cf4564e93 expression: 'nodata(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)=1' name: 'No data received (>3m) from probe "{$PROBE:"{#DEVICE}"}"' - uuid: 83e4d26cb1e74d9d91b390e774ca36ae expression: '(avg(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)>=30 and avg(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)<33 and {$GROUP:"{#DEVICE}"}=0) or (avg(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)>=35 and avg(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)<38 and {$GROUP:"{#DEVICE}"}=1)' name: 'Temperature critically high on probe "{$PROBE:"{#DEVICE}"}"' priority: AVERAGE - uuid: c29b3fe3eb4e49ad9f07fb365a8c3028 expression: '(avg(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)>=14 and avg(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)<17 and {$GROUP:"{#DEVICE}"}=0) or (avg(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)>=6 and avg(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)<10 and {$GROUP:"{#DEVICE}"}=1)' name: 'Temperature critically low on probe "{$PROBE:"{#DEVICE}"}"' priority: AVERAGE - uuid: 3af1138a53ca415f9bba8f77e3a7f4ad expression: '(last(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-])>=33 and {$GROUP:"{#DEVICE}"}=0) or (last(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-])>=38 and {$GROUP:"{#DEVICE}"}=1)' name: 'Temperature disastrously high on probe "{$PROBE:"{#DEVICE}"}"' priority: DISASTER - uuid: 110f921df8694b97bb5590ebc534fa97 expression: '(last(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-])<14 and nodata(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],35s)=0 and {$GROUP:"{#DEVICE}"}=0) or (last(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-])<6 and nodata(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],35s)=0 and {$GROUP:"{#DEVICE}"}=1)' name: 'Temperature disastrously low on probe "{$PROBE:"{#DEVICE}"}"' priority: DISASTER dependencies: - name: 'No data received (>3m) from probe "{$PROBE:"{#DEVICE}"}"' expression: 'nodata(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)=1' - uuid: 7645d7545f6a4756b6e66dd55fcf8298 expression: '(avg(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)>=27 and avg(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)<30 and {$GROUP:"{#DEVICE}"}=0) or (avg(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)>=32 and avg(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)<35 and {$GROUP:"{#DEVICE}"}=1)' name: 'Temperature high on probe "{$PROBE:"{#DEVICE}"}"' priority: WARNING - uuid: e03fc9a4b2134e0f95058be2c85ca8aa expression: '(avg(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)>=17 and avg(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)<20 and {$GROUP:"{#DEVICE}"}=0) or (avg(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)>=10 and avg(/1wire-temperature-probe/system.run[cat /sys/bus/w1/devices/{#DEVICE}/w1_slave | tail -n +2 | cut -d= -f2-],180s)<14 and {$GROUP:"{#DEVICE}"}=1)' name: 'Temperature low on probe "{$PROBE:"{#DEVICE}"}"' priority: WARNING preprocessing: - type: JAVASCRIPT parameters: - | var lld = []; var lines = value.split("\n"); var lines_num = lines.length; for (i = 0; i < lines_num; i++) { var row = {}; row["{#DEVICE}"] = lines[i] lld.push(row); } return JSON.stringify(lld); macros: - macro: '{$GROUP}' value: '0' description: 'Default Group'