When setting up SMART monitoring via Nagios on Ubuntu servers, I've found these plugins to be the most reliable and feature-rich:
# Example command to check all drives using check_smart.pl:
/usr/lib/nagios/plugins/check_smart.pl -d /dev/sda -i
Plugin | SMART Attributes | Temperatures | Self-Tests | Multi-Drive |
---|---|---|---|---|
check_smart.pl | ✓ | ✓ | ✓ | ✓ |
check_smartmon | ✓ | ✓ | ✗ | ✓ |
check_smart_attributes | ✓ | ✗ | ✗ | ✗ |
Here's my working configuration that monitors both attributes and scheduled tests:
# /etc/nagios-plugins/config/smart.cfg
define command {
command_name check_smart
command_line /usr/lib/nagios/plugins/check_smart.pl -d $ARG1$ -i -w $ARG2$ -c $ARG3$
}
# /etc/nagios3/conf.d/host-smart.cfg
define service {
use generic-service
host_name storage-server
service_description SMART Health /dev/sda
check_command check_smart!/dev/sda!5,10!10,20
notification_options w,c,r
}
The best plugins allow setting custom thresholds for specific attributes:
# Monitoring reallocated sector count with custom thresholds
define service {
host_name storage-server
service_description SMART Reallocated Sectors /dev/sdb
check_command check_smart!/dev/sdb!5:5,10:10!10:10,20:20
}
Before using any SMART monitoring plugins, ensure these packages are installed:
sudo apt-get install smartmontools libmonitoring-plugin-perl \
nagios-plugins-basic nagios-plugins-extra
If you encounter permission problems when running checks, add the nagios user to the disk group:
sudo usermod -a -G disk nagios
sudo systemctl restart nagios
For more detailed monitoring, consider combining multiple plugins to cover all aspects of disk health monitoring.
When integrating SMARTd/smartmontools with Nagios on Ubuntu servers, four primary plugin options emerge from Monitoring Exchange:
1. check_smart.pl (Perl-based)
2. check_smartmon (Python implementation)
3. check_smart_attributes (Bash script)
4. check_ide_smart (C-based solution)
Plugin | Language | SSH Required | NRPE Support | Attribute Thresholds |
---|---|---|---|---|
check_smart.pl | Perl | No | Yes | Configurable |
check_smartmon | Python | Optional | Yes | Predefined |
check_smart_attributes | Bash | Yes | No | None |
check_ide_smart | C | No | Yes | Customizable |
For Ubuntu environments, check_ide_smart offers the most robust solution with direct hardware access and NRPE compatibility. Installation requires:
wget http://www.monitoringexchange.org/p/download/check_ide_smart.tar.gz
tar xvf check_ide_smart.tar.gz
cd check_ide_smart/
./configure
make
sudo make install
Sample NRPE configuration for /etc/nagios/nrpe.cfg:
command[check_smart]=/usr/local/nagios/libexec/check_ide_smart -d /dev/sda -i
command[check_smart_threshold]=/usr/local/nagios/libexec/check_ide_smart -d /dev/sda -a -w 5 -c 10
For comprehensive monitoring across multiple drives:
#!/bin/bash
for drive in /dev/sd[a-z]; do
/usr/local/nagios/libexec/check_ide_smart -d $drive -a -w 5 -c 10
done
For environments requiring Python:
sudo apt install python3-smartmontools
wget https://raw.githubusercontent.com/prometheus-community/node-exporter-textfile-collector-scripts/master/smartmon.sh
chmod +x smartmon.sh