Setting up Zabbix Agent to monitor CPU and HDD Temperatures

First turn off the firewall and disable selinux:
systemctl disable firewalld
vi /etc/selinux/config

Install the Zabbix 3.4 source repo and install zabbix and lm_sensros and smartmontools:
rpm -ivh
yum install -y zabbix-agent lm_sensors smartmontools

Edit /etc/zabbix/zabbix_agentd.conf and set the Server and ServerActive to the hostname of your zabbix server.

Create a sudoers.d file for zabbix in /etc/sudoers.d/zabbix:
zabbix ALL=NOPASSWD:/usr/sbin/smartctl
zabbix ALL=NOPASSWD:/bin/sensors

Create a new files in /etc/zabbix/zabbix_agentd.d called hdd_temps.conf and enter information like so:

Create the /usr/share/zabbix-agent directory and add hdd1, hdd2 and cpu1 shell scripts:
sudo smartctl -a /dev/sdb | grep Temperature_Celsius | awk {'print $10'}

sudo smartctl -a /dev/sdc | grep Temperature_Celsius | awk {'print $10'}

sudo sensors | grep Core | awk -F'[+|.]' {'print $2'}

In zabbix you need to add the items for HDD1, HDD2 and CPU1 to the configuration of the host. Once it is added zabbix will collect the date periodically.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: