Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_smartmon
194781
File | Description |
---|---|
check_smartmon.txt | Plugin file |
LICENSE.txt | License |
README.txt | Readme |
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
Use smartmontools (http://smartmontools.sourceforge.net/) to check disk health status and temperature.
Reviews (5)
byNihlaeth, January 19, 2016
1 of 1 people found this review helpful
I needed to run this as an unprivileged user, so I added a c wrapper that can use setuid root.
I also applied the patch below, fixed a few minor bugs and attempted to improve readability.
The result can be found here: https://github.com/nihlaeth/Nagios_check_smartmon
I also applied the patch below, fixed a few minor bugs and attempted to improve readability.
The result can be found here: https://github.com/nihlaeth/Nagios_check_smartmon
byxrated, December 22, 2013
As disks with defective sectors are still reported as a healthy disk by Smart, i added checking the Smart IDs 5,196,197,198. An critical error will be reported if any > 0. I have not much clue about python but the patch is working:
http://pastebin.com/yB0w0Px9
http://pastebin.com/yB0w0Px9
bykohly, March 30, 2011
if temperature > criticalThreshold:
return (2, "CRITICAL: device temperature (%d) exceeds critical temperature threshold (%s)|temperature= %d;%s;%s;" % (temperature, criticalThreshold, temperature, warningThreshold, criticalThreshold))
elif temperature > warningThreshold:
return (1, "WARNING: device temperature (%d) exceeds warning temperature threshold (%s)|temperature= %d;%s;%s;" % (temperature, warningThreshold, temperature, warningThreshold, criticalThreshold))
else:
return (0, "OK: device is functional and stable (temperature: %d)|temperature= %d;%s;%s;" % (temperature, temperature, warningThreshold, criticalThreshold))
return (2, "CRITICAL: device temperature (%d) exceeds critical temperature threshold (%s)|temperature= %d;%s;%s;" % (temperature, criticalThreshold, temperature, warningThreshold, criticalThreshold))
elif temperature > warningThreshold:
return (1, "WARNING: device temperature (%d) exceeds warning temperature threshold (%s)|temperature= %d;%s;%s;" % (temperature, warningThreshold, temperature, warningThreshold, criticalThreshold))
else:
return (0, "OK: device is functional and stable (temperature: %d)|temperature= %d;%s;%s;" % (temperature, temperature, warningThreshold, criticalThreshold))
To get rid of the deprecation warnings:
--- check_smartmon.py.orig 2011-03-15 15:28:50.000000000 +0200
+++ check_smartmon.py 2011-03-15 15:40:48.000000000 +0200
@@ -28,6 +28,7 @@
import os.path
import sys
+import warnings
from optparse import OptionParser
@@ -111,6 +112,8 @@
# get health status
cmd = "%s -H %s" % (path, device)
vprint(3, "Get device health status: %s" % cmd)
+ # filter out deprecation warnings
+ warnings.filterwarnings('ignore', category=DeprecationWarning, message=r'os\.popen3')
(child_stdin, child_stdout, child_stderr) = os.popen3(cmd)
line = child_stderr.readline()
if len(line):
--- check_smartmon.py.orig 2011-03-15 15:28:50.000000000 +0200
+++ check_smartmon.py 2011-03-15 15:40:48.000000000 +0200
@@ -28,6 +28,7 @@
import os.path
import sys
+import warnings
from optparse import OptionParser
@@ -111,6 +112,8 @@
# get health status
cmd = "%s -H %s" % (path, device)
vprint(3, "Get device health status: %s" % cmd)
+ # filter out deprecation warnings
+ warnings.filterwarnings('ignore', category=DeprecationWarning, message=r'os\.popen3')
(child_stdin, child_stdout, child_stderr) = os.popen3(cmd)
line = child_stderr.readline()
if len(line):
Running Ubuntu 10.10 64-bit and I receive the following Python errors:
/usr/local/nagios/libexec/check_smartmon:114: DeprecationWarning: os.popen3 is deprecated. Use the subprocess module.
(child_stdin, child_stdout, child_stderr) = os.popen3(cmd)
/usr/local/nagios/libexec/check_smartmon:127: DeprecationWarning: os.popen3 is deprecated. Use the subprocess module.
(child_stdin, child_stdout, child_stderr) = os.popen3(cmd)
OK: device is functional and stable (temperature: 40)
Probably needs to check for what version of Python is being used at top of script and apply commands accordingly later in script.
/usr/local/nagios/libexec/check_smartmon:114: DeprecationWarning: os.popen3 is deprecated. Use the subprocess module.
(child_stdin, child_stdout, child_stderr) = os.popen3(cmd)
/usr/local/nagios/libexec/check_smartmon:127: DeprecationWarning: os.popen3 is deprecated. Use the subprocess module.
(child_stdin, child_stdout, child_stderr) = os.popen3(cmd)
OK: device is functional and stable (temperature: 40)
Probably needs to check for what version of Python is being used at top of script and apply commands accordingly later in script.