<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://tyk.wiki/index.php?action=history&amp;feed=atom&amp;title=Check_smartmon_-_NRPE_S.M.A.R.T_harddisk_check</id>
	<title>Check smartmon - NRPE S.M.A.R.T harddisk check - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://tyk.wiki/index.php?action=history&amp;feed=atom&amp;title=Check_smartmon_-_NRPE_S.M.A.R.T_harddisk_check"/>
	<link rel="alternate" type="text/html" href="https://tyk.wiki/index.php?title=Check_smartmon_-_NRPE_S.M.A.R.T_harddisk_check&amp;action=history"/>
	<updated>2026-05-10T14:24:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://tyk.wiki/index.php?title=Check_smartmon_-_NRPE_S.M.A.R.T_harddisk_check&amp;diff=241&amp;oldid=prev</id>
		<title>Tykling: Created page with &#039;{{DISPLAYTITLE:check_pgsql - NRPE S.M.A.R.T harddisk check}} category:nagios S.M.A.R.T is a technology used to ask harddisks how they are doing. You can have Nagios monitor t…&#039;</title>
		<link rel="alternate" type="text/html" href="https://tyk.wiki/index.php?title=Check_smartmon_-_NRPE_S.M.A.R.T_harddisk_check&amp;diff=241&amp;oldid=prev"/>
		<updated>2010-04-02T11:04:34Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;{{DISPLAYTITLE:check_pgsql - NRPE S.M.A.R.T harddisk check}} &lt;a href=&quot;/Category:Nagios&quot; title=&quot;Category:Nagios&quot;&gt;category:nagios&lt;/a&gt; S.M.A.R.T is a technology used to ask harddisks how they are doing. You can have Nagios monitor t…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{DISPLAYTITLE:check_pgsql - NRPE S.M.A.R.T harddisk check}}&lt;br /&gt;
[[category:nagios]]&lt;br /&gt;
S.M.A.R.T is a technology used to ask harddisks how they are doing. You can have Nagios monitor the temperature of the harddisks in your servers using this port:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat /usr/ports/net-mgmt/nagios-check_smartmon/pkg-descr&lt;br /&gt;
check_smartmon is a Nagios plug-in written in python that uses&lt;br /&gt;
smartmontools to check disk health status and temperature.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuring Nagios ==&lt;br /&gt;
First I define a few new services on the Nagios server, in &amp;lt;code&amp;gt;/usr/local/etc/nagios/objects/services.cfg&amp;lt;/code&amp;gt;. I define one service per disk name I want to check. If I have three servers with an &amp;lt;code&amp;gt;ad0&amp;lt;/code&amp;gt; drive, and one server (host2 in the example below) with both &amp;lt;code&amp;gt;ad0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ad1&amp;lt;/code&amp;gt; drives, I add service definitions for checking both &amp;lt;code&amp;gt;ad0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ad1&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# SMART ad0&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       host1,host2,host3&lt;br /&gt;
        service_description             nrpe_check_smart_ad0&lt;br /&gt;
        check_command                   check_nrpe2!check_smart_ad0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# SMART ad1&lt;br /&gt;
define service {&lt;br /&gt;
        use                             generic-service&lt;br /&gt;
        host_name                       host2&lt;br /&gt;
        service_description             nrpe_check_smart_ad1&lt;br /&gt;
        check_command                   check_nrpe2!check_smart_ad1&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead of adding the server hostnames to the service definitions directly, I could also have added the servers I want to check to groups called something like &amp;lt;code&amp;gt;smart-ad0-servers&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;smart-ad1-servers&amp;lt;/code&amp;gt; etc., and then added the groups to the services, but for now I did it like this.&lt;br /&gt;
&lt;br /&gt;
== Install the plugin ==&lt;br /&gt;
Install the port:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo portmaster /usr/ports/net-mgmt/nagios-check_smartmon/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Fix sudo permissions ==&lt;br /&gt;
The Nagios user needs permission to run the &amp;lt;code&amp;gt;smartctl&amp;lt;/code&amp;gt; binary with root permissions, I recommend using sudo for this purpose. I add the following to &amp;lt;code&amp;gt;/usr/local/etc/sudoers&amp;lt;/code&amp;gt; on the servers being monitored:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nagios          ALL=(ALL) NOPASSWD: /usr/local/libexec/nagios/check_smartmon -d /dev/ad*&lt;br /&gt;
nagios          ALL=(ALL) NOPASSWD: /usr/local/libexec/nagios/check_smartmon -d /dev/da*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first line is needed if you are checking ide &amp;lt;code&amp;gt;adX&amp;lt;/code&amp;gt; devices, the second line is needed if you are checking scsi or usb &amp;lt;code&amp;gt;daX&amp;lt;/code&amp;gt; devices. I normally just leave both of them in.&lt;br /&gt;
&lt;br /&gt;
To test this, as a user who has sudo access run the following command, substituting &amp;lt;code&amp;gt;ad10&amp;lt;/code&amp;gt; for the device name you want to monitor:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ sudo su -m nagios -c &amp;quot;sudo /usr/local/libexec/nagios/check_smartmon -d /dev/ad10&amp;quot;&lt;br /&gt;
OK: device is functional and stable (temperature: 36)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you get a reply like the one above, everything works as intended.&lt;br /&gt;
&lt;br /&gt;
== Configuring NRPE ==&lt;br /&gt;
On the server being monitored, add the following line to &amp;lt;code&amp;gt;/usr/local/etc/nrpe.cfg&amp;lt;/code&amp;gt; (this example has both an &amp;lt;code&amp;gt;ad0&amp;lt;/code&amp;gt; and an &amp;lt;code&amp;gt;ad1&amp;lt;/code&amp;gt; drive:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
command[check_smart_ad0]=/usr/local/bin/sudo /usr/local/libexec/nagios/check_smartmon -d /dev/ad0&lt;br /&gt;
command[check_smart_ad1]=/usr/local/bin/sudo /usr/local/libexec/nagios/check_smartmon -d /dev/ad1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember to restart NRPE after changing the config:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /usr/local/etc/rc.d/nrpe2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tykling</name></author>
	</entry>
</feed>