Contact

[email protected]
1 855 796 6269

Support

If you are an existing customer and in need of support, please reach us through our Ticket System available from your Client Area.

Documentation


Warning: count(): Parameter must be an array or an object that implements Countable in /home/symmcom1/public_html/v02/components/com_k2/models/item.php on line 763
Wednesday, 08 August 2018 18:06

How To Configure Zabbix Agent To Monitor Disk Drives In Linux

Written by | Read 458 times
Rate this item
(0 votes)

By default, Zabbix Agent does not monitor HDD health nor it comes with a pre-built template. However there is some community shared templates and scripts through which we can pull disk drive information such as drive temperature, error counts, serial numbers etc. In this HOW-TO guide we are going to use a template named zbx-smartctl, which is downloadable through the following link:

https://github.com/v-zhuravlev/zbx-smartctl

Step 1

Download necessary files from the URL above. There are Zabbix templates for the different version, choose the appropriate one for your environment.

Step 2

Zabbix agent commands must be able to run without needing root password. We can achieve this by adding the following permissions into /etc/sudoers:

zabbix ALL= (ALL) NOPASSWD: /usr/sbin/smartctl,/etc/zabbix/scripts/smartctl-disks-discovery.pl

Step 3

Add the following lines at the end of /etc/zabbix/zabbix_agentd.conf:

#############SMARTMONTOOLS
###DEPRECATED. USE for 2.x-3.2 templates
UserParameter=uHDD[*],sudo smartctl -A $1 | awk '$$0 ~ /$2/ { print $$10 }'
UserParameter=uHDD.value[*],sudo smartctl -A $1 | awk '$$0 ~ /$2/ { print $$4 }'
UserParameter=uHDD.raw_value[*],sudo smartctl -A $1 | awk '$$0 ~ /$2/ { print $$10 }'
UserParameter=uHDD.model.[*],sudo smartctl -i $1 | awk -F ': +' '$$0 ~ /Device Model/ { print $$2 }'
UserParameter=uHDD.sn.[*],sudo smartctl -i $1 | awk -F ': +' '$$0 ~ /Serial Number/ { print $$2 }'
UserParameter=uHDD.health.[*],sudo smartctl -H $1 | awk -F ': +' '$$0 ~ /test/ { print $$2 }'
UserParameter=uHDD.errorlog.[*],sudo smartctl -l error $1 |grep -i "ATA Error Count"| cut -f2 -d: |tr -d " " || true
#### 3.4
UserParameter=uHDD.A[*],sudo smartctl -A $1
UserParameter=uHDD.i[*],sudo smartctl -i $1
UserParameter=uHDD.health[*],sudo smartctl -H $1 || true
### Discovery
UserParameter=uHDD.discovery,sudo /etc/zabbix/scripts/smartctl-disks-discovery.pl

Step 4

Restart Zabbix agent using the following command:

# systemctl restart zabbix_agent

Step 5

Import appropriate template into Zabbix server. Wait several minutes for the discovery script to find all the drives and start pulling data into Zabbix server.


Warning: count(): Parameter must be an array or an object that implements Countable in /home/symmcom1/public_html/v02/components/com_k2/templates/howto/item.php on line 251
Last modified on Sunday, 13 January 2019 23:26

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.