From 9f572a260da19cb6ae6f2f3ee5c1a58ba6c48de7 Mon Sep 17 00:00:00 2001 From: Timothy Asir Date: Fri, 14 Nov 2014 12:52:33 +0530 Subject: Fix bug:1119273 - invalid ctdb status message on ctdb service stop This patch check for if CTDB process is not running and ctdb chkconfig status is on: then it will return "CTDB is not running", CRITICAL level and if the CTDB process is not running and the chkconfig status is off: then it will return "CTDB not configured", Unknown Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1119273 Change-Id: I13c586ceefc86978acd154f9c641a9cc0ffb443b Signed-off-by: Timothy Asir Reviewed-on: http://review.gluster.org/9124 Reviewed-by: Ramesh N Tested-by: Timothy Asir Reviewed-by: Sahina Bose --- plugins/check_proc_util.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/check_proc_util.py b/plugins/check_proc_util.py index af0b0e5..2fe4aac 100755 --- a/plugins/check_proc_util.py +++ b/plugins/check_proc_util.py @@ -28,6 +28,9 @@ from glusternagios import storage _checkProc = utils.CommandPath('check_proc', '/usr/lib64/nagios/plugins/check_procs') +_chkConfig = utils.CommandPath('chkconfig', + '/sbin/chkconfig', '/usr/sbin/chkconfig') + _glusterVolPath = "/var/lib/glusterd/vols" _checkNfsCmd = [_checkProc.cmd, "-c", "1:", "-C", "glusterfs", "-a", "nfs"] _checkShdCmd = [_checkProc.cmd, "-c", "1:", "-C", "glusterfs", "-a", @@ -38,6 +41,7 @@ _checkQuotaCmd = [_checkProc.cmd, "-c", "1:", "-C", "glusterfs", "-a", _checkBrickCmd = [_checkProc.cmd, "-C", "glusterfsd"] _checkGlusterdCmd = [_checkProc.cmd, "-c", "1:", "-w", "1:1", "-C", "glusterd"] _checkCtdbCmd = [_checkProc.cmd, "-c", "1:", "-C", "ctdbd"] +_chkConfigCtdb = [_chkConfig.cmd, "ctdb"] checkIdeSmartCmdPath = utils.CommandPath( 'check_ide_smart', '/usr/lib64/nagios/plugins/check_ide_smart') @@ -126,6 +130,10 @@ def getCtdbStatus(smbStatus, nfsStatus): status, msg, error = utils.execCmd(_checkCtdbCmd) if status != utils.PluginStatusCode.OK: + status, msg, error = utils.execCmd(_chkConfigCtdb) + if status == utils.PluginStatusCode.OK: + return (utils.PluginStatusCode.CRITICAL, + "CTDB process is not running") return utils.PluginStatusCode.UNKNOWN, "CTDB not configured" # 'cdtb nodestatus' command will return the output in following format -- cgit