zabbix_export: version: '6.0' date: '2021-11-21T21:32:26Z' groups: - uuid: 0835b2a34e4a43d6887f5887b0135acc name: 'Templates/Servers Hardware' templates: - uuid: 39c5a230440e4d748c7f0cd1f8329784 template: 'FreeBSD Core Temp' name: 'FreeBSD Core Temp' description: | ## Description Monitor core temperature of Intel CPUs. The 'coretemp' kernel module must be loaded. ## Overview ### Update: there's an amdtemp module in FreeBSD kernel, similar to coretemp. So this should work on AMD processors, too! 1) load [coretemp kernel module](https://www.freebsd.org/cgi/man.cgi?coretemp): **kldload coretemp** (for Intel CPUs) or [amdtemp kernel module](https://www.freebsd.org/cgi/man.cgi?query=amdtemp): **kldload amdtemp** (for AMD CPUs) 2) add **coretemp\_load="YES"** or **amdtemp\_load="YES"** to **/boot/loader.conf** 3) create **userparameter\_coretemp.conf** file in zabbix\_agentd.conf.d, *** make sure you have bash installed and the Include directive is present and valid in zabbix\_agentd.conf to include individual files *** ``` UserParameter=coretemp.cpu.discovery, /usr/local/bin/bash -c 'echo -n "{\"data\":["; for i in `sysctl -a | grep "dev.cpu.*.temperature" | awk -F "." '\''{print $3}'\'' | sort -n` ; do echo -n "{\"{#CPUCORE}\":\""$i"\"}," ; done | sed "s/.$//"; echo -n "]}"' ``` ``` UserParameter=coretemp.cpu[*], sysctl dev.cpu.$1.temperature | sed 's/.$//' | awk '{print $NF}' ``` 4) restart zabbix\_agentd, import & apply the template 5) also make sure zabbix\_agentd has all the paths needed: in **/etc/rc.conf** ``` zabbix\_agentd\_paths="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" ``` ## Author Felicián Hoppál groups: - name: 'Templates/Servers Hardware' discovery_rules: - uuid: cf9e07f626b94d21b3e0dd82b71287ef name: 'CPU core discovery' key: coretemp.cpu.discovery delay: 1h lifetime: 7d item_prototypes: - uuid: e4d5ee33cd2c4c7ca4863ce11ecffb23 name: 'CPU Core {#CPUCORE} Temp' key: 'coretemp.cpu[{#CPUCORE}]' history: 7d units: C tags: - tag: Application value: Temperature trigger_prototypes: - uuid: 8631b12575ee4d92b1564a5d0e467437 expression: 'avg(/FreeBSD Core Temp/coretemp.cpu[{#CPUCORE}],#3)>85' name: 'CPU Core {#CPUCORE} temperature is above 85C on {HOST.NAME}' priority: HIGH