Troubleshoot S.M.A.R.T monitoring

Starting with cagent 1.1.4 S.M.A.R.T monitoring of hard disk is supported

Preface

Starting with cagent 1.1.4 S.M.A.R.T monitoring of hard disk is supported. It's disabled by default and you must enable it manually. Cagent relies on the external tool smartctl wich is part of the smartmontools. To use smart monitoring with cagent and cloudradar you must install the smartmontools manually before enabling it. Smartmontools version 7 are required. None of the Linux distributions provide it yet, but installing them manually is easy. See below.

Install Smartmon on Windows

Download the most recent version from here https://sourceforge.net/projects/smartmontools/files/smartmontools/7.0/

Even if the download is called smartmontools-7.X.X.win32-setup.exe it contains a 64bit version for Windows.

If you don't plan to use the smartmontools outside of cagent and the cloudradar monitoring, you can skip the installation of smartd and the documentation.

Minimal installation of smartmontools on windows

It's recommended to update the drive database after the installation.

cd C:\Program Files\smartmontools\bin>
cd C:\Program Files\smartmontools\bin>update-smart-drivedb.exe

Now open the cagent configuration file C:\Program Files\cagent\cagent.conf with an editor and change the existing lines to

C:\Program Files\cagent\cagent.conf
# Enable S.M.A.R.T monitoring of hard disks
smart_monitoring = true
# Path to a smartctl binary (smartctl.exe on windows) version >= 7
# See https://docs.cloudradar.io/configuring-hosts/installing-agents/troubleshoot-s.m.a.r.t-monitoring
# smartctl = "/usr/local/bin/smartctl"
smartctl = "C:\\Program Files\\smartmontools\\bin\\smartctl.exe"

The comment sign # before smartctl needs to be removed.

Note the escaping of slashes on Windows to specify the path to smartctl.exe.

Resolve dependencies on CentOS 7.X

The included version of smartmontools 6.X is outdated and cagent cannot use it do enable SMART monitoring. You need at least smartmontools 7. RPMs for CentOS and RedHat are available but they are not included it any repository yet.

Download the latest version of smartmontools from the CentOS Community Build System or follow these instructions.

curl -L -O https://cbs.centos.org/kojifiles/packages/smartmontools/7.0/3.el7/x86_64/smartmontools-7.0-3.el7.x86_64.rpm
rpm -U smartmontools-7.0-3.el7.x86_64.rpm

This installs /sbin/smartctl and you can use it with cagent by adding the following lines to /etc/cagent/cagent.conf

/etc/cagent/cagent.conf
# Enable S.M.A.R.T monitoring of hard disks
smart_monitoring = true
smartctl = "/sbin/smartctl"

Restart the agent with systemctl restart cagent after any change to the config file.

Using pre-compiles static binaries on Ubuntu, Debian, and CentOS6

Unfortunately even the most recent versions of Ubuntu and Debian don't ship smatmontools 7. Smartmontools 6.5 are not compatible with cagent.

The developers of the smartmontools provide up to date pre-compiled static binaries which can be installed easily.

curl -L -sS https://647-105252244-gh.circle-artifacts.com/0/builds/smartmontools-linux-x86_64-static-7.0-r4883.tar.gz|\
tar xzfv - -C /
update-smart-drivedb

You now have smartctl installed under /usr/local/sbin which does not interfere or conflict with a version you might have installed with the package manager.

Open the cagent config file /etc/cagent/cagent.conf and change the already present lines for smart monitoring to

/etc/cagent/cagent.conf
# Enable S.M.A.R.T monitoring of hard disks
smart_monitoring = true
# Path to a smartctl binary (smartctl.exe on windows) version >= 7
# See https://docs.cloudradar.io/configuring-hosts/installing-agents/troubleshoot-s.m.a.r.t-monitoring
smartctl = "/usr/local/sbin/smartctl"
# smartctl = "C:\\Program Files\\smartmontools\\bin\\smartctl.exe"

Install smartmontools on Mac

A recent version is available via homebrew.

brew install smartmontools

Install smartmontools from the sources

Installing the smartmontools from the sources should the last measure if you really need SMART monitoring and you cannot use pre-build packages for your distribution.

curl -sS -L https://sourceforge.net/projects/smartmontools/files/smartmontools/7.0/smartmontools-7.0.tar.gz/download > smartmontools-7.0.tar.gz
tar xzf smartmontools-7.0.tar.gz
yum install gcc-c++ make
./configure --without-cxx11-option
ln -s /usr/local/sbin/smartctl /usr/sbin/