From 10c9f0bca8afa33810cc30873efeb1f82d3bea4e Mon Sep 17 00:00:00 2001 From: Nishanth Thomas Date: Thu, 1 May 2014 20:28:54 +0530 Subject: gluster-nagios-addons: check disk status along with brick status Modifed the check_proc_status plugin to check the disk status as well for the brick and accordingly report the status to brick service in nagios server. Change-Id: Ie9c59382e5926682254eff1c89e3a992deda6a38 Signed-off-by: Nishanth Thomas Reviewed-on: http://review.gluster.org/7634 Reviewed-by: Kanagaraj M Tested-by: Nishanth Thomas Reviewed-by: Timothy Asir --- plugins/check_proc_status.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/check_proc_status.py b/plugins/check_proc_status.py index b331006..a899d0f 100755 --- a/plugins/check_proc_status.py +++ b/plugins/check_proc_status.py @@ -29,6 +29,7 @@ import glusternagios from glusternagios import utils from glusternagios import glustercli +from glusternagios import storage _checkProc = utils.CommandPath('check_proc', @@ -51,6 +52,8 @@ _brickService = "Brick - " _glusterdService = "Gluster Management" _quotadService = "Quota" _ctdbdService = "CTDB" +checkIdeSmartCmdPath = utils.CommandPath( + 'check_ide_smart', '/usr/lib64/nagios/plugins/check_ide_smart') def getBrickStatus(volInfo): @@ -72,6 +75,18 @@ def getBrickStatus(volInfo): _glusterVolPath, volumeName, pidFile)) as f: if psutil.pid_exists(int(f.read().strip())): status = utils.PluginStatusCode.OK + #Now check the status of the underlying physical disk + brickDevice = storage.getBrickDeviceName( + brick['name'].split(":")[1]) + disk = storage.getDisksForBrick( + brickDevice) + cmd = [checkIdeSmartCmdPath.cmd, "-d", disk, "-n"] + rc, out, err = utils.execCmd(cmd) + if rc == utils.PluginStatusCode.CRITICAL and \ + "tests failed" in out[0]: + status = utils.PluginStatusCode.WARNING + msg = "WARNING: Brick %s: %s" % ( + brick['name'], out[0]) else: status = utils.PluginStatusCode.CRITICAL except IOError, e: -- cgit