Tag Archives: smart

Monitor S.M.A.R.T. stats in Zabbix

Need to track disk SMART stats in Zabbix? I found a fairly simple method that does not rely on external scripts (other than the Zabbix agent).

1) Edit your Zabbix Agent config to permit remote commands if you have not already done so. It’s usually /etc/zabbix/zabbix_agentd.conf

EnableRemoteCommands=1

2) Near the bottom of your agent config there should be several “UserParamerter=…” lines, add a new one:

UserParameter=hdd.smart[*],sudo smartctl -A /dev/$1 | grep -E -i '^[ ]*($2)[ ]' | cut -c88-

In short, this command spits out a full SmartMonTools report for your drive ($1), greps it for a single specific line ($2), then removes the first 88 characters, leaving only the raw value behind.

Make sure that smartctl is in your suroers file for any user to run without a password prompt. I detail that process in a previous post.

Read more »

Allow any user on linux to run smartctl without password

Need to have a script or external application run smartctl without being prompted for a password? Simply add it to the sudoers file. Under Ubuntu/Debian use “visudo” to edit it (DO NOT EDIT IT WITHOUT USING THIS COMMAND!) and add the following line:

ALL ALL=(ALL)NOPASSWD: /usr/sbin/smartctl

This allows any user, from any source (local or remote) to run the smartctl command without being prompted for a password. Note, your script or user will still need to preface the smartctl command with sudo.