This is an old revision of the document!
Table of Contents
Certainly! Here's a concise summary of the steps to monitor CPU temperature with Zabbix using lm-sensors:
Install lm-sensors
Make sure lm-sensors is installed on the system where you want to monitor CPU temperature. You can typically install it using your system's package manager.
Create sensors.conf
Create a `sensors.conf` file with the necessary `UserParameter` configuration to fetch CPU temperature data. Place this file in a location where Zabbix Agent can access it. For example, /etc/zabbix/zabbix_agent2.d/sensors.conf :
UserParameter=Temperature.CPU1,/usr/share/zabbix-agent/getCPUTemp.sh
Create the .sh Script
Create a shell script (e.g., `getCPUTemp.sh`) with the following content to extract and format the CPU temperature:
#!/bin/bash
sensors | grep -i package | awk -F'[+|°]' '{print $2}' | awk '{printf "%.1f", $1}'
Make the Script Executable
Ensure the script is executable by running:
chmod +x /usr/share/zabbix-agent/getCPUTemp.sh
Restart Zabbix Agent
Restart the Zabbix Agent to apply the changes:
service zabbix-agent restart
Configure Zabbix Item
In the Zabbix web interface, create a new item for CPU temperature monitoring:
- Name: Give it a descriptive name, e.g., “CPU Temperature.”
- Key: Use the `Temperature.CPU1` key.
- Type: Select “Zabbix Agent.”
- Data type: Choose “Numeric (float).”
Monitor CPU Temperature
After configuring the item, Zabbix will start collecting CPU temperature data, which you can view and use for monitoring within the Zabbix interface.
By following these steps, you can successfully monitor CPU temperature using Zabbix and lm-sensors.
