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 https://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
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:
UserParameter=Temperature.HDD2,/usr/share/zabbix-agent/hdd2.sh
UserParameter=Temperature.HDD1,/usr/share/zabbix-agent/hdd1.sh
UserParameter=Temperature.CPU1,/usr/share/zabbix-agent/cpu1.sh

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

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

#!/bin/bash
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.

Advertisement
Posted in Uncategorized

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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.