diff options
author | Sahina Bose <sabose@redhat.com> | 2014-06-09 16:02:51 +0530 |
---|---|---|
committer | Sahina Bose <sabose@redhat.com> | 2015-05-31 23:55:44 -0700 |
commit | d040cb45469d64fa7534247f9568b48b28114c3f (patch) | |
tree | 2d082dfbc0e6261668ef6e18e4acfca67bc8714c /plugins | |
parent | 48ad0ab08d4762bade7fb91d2260ae5e7019851d (diff) |
server-plugin: To check if any vol has server side quorumv1.1.0
Added a server side plugin to change status from Pending
to OK/UNKNOWN depending on if volumes have server side
quorum turned on
Renamed service to ensure service definition gets
updated on upgrades.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1106421
Change-Id: I1f1ca1dcf56872342ec8e25396a89163d22aedeb
Signed-off-by: Sahina Bose <sabose@redhat.com>
Reviewed-on: http://review.gluster.org/8023
Reviewed-by: darshan n <dnarayan@redhat.com>
Reviewed-by: Ramesh N <rnachimu@redhat.com>
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/check_vol_server.py | 28 | ||||
-rw-r--r-- | plugins/config_generator.py | 5 |
2 files changed, 30 insertions, 3 deletions
diff --git a/plugins/check_vol_server.py b/plugins/check_vol_server.py index e7dd150..a45a24d 100755 --- a/plugins/check_vol_server.py +++ b/plugins/check_vol_server.py @@ -62,6 +62,10 @@ def _getVolGeoRepStatusNRPECommand(volume): return ("check_vol_status -a %s %s" % (volume, 'geo-rep')) +def _getQuorumStatusNRPECommand(): + return ("check_quorum_status") + + # This function gets the replica pairs # bricks - list of bricks in the volume # pair_index - nth pair of replica's needs to be returned @@ -199,6 +203,25 @@ def _getVolumeQuotaStatusOutput(hostgroup, volume): return _executeRandomHost(hostgroup, _getVolQuotaStatusNRPECommand(volume)) +def _getQuorumStatusOutput(hostgroup): + # get current volume quorum status + table = livestatus.readLiveStatus("GET services\n" + "Columns: state,plugin_output\n" + "Filter: description = " + "Cluster - Quorum\n" + "Filter: host_name = %s\n" % hostgroup) + servicestatus = utils.PluginStatusCode.UNKNOWN + pluginoutput = '' + if len(table) > 0: + servicetab = table[0] + servicestatus = servicetab[0] + pluginoutput = servicetab[1] + if (int(servicestatus) != utils.PluginStatusCode.CRITICAL): + return _executeRandomHost(hostgroup, _getQuorumStatusNRPECommand()) + else: + return servicestatus, pluginoutput + + def execNRPECommand(command): status, output, err = utils.execCmd(command.split(), raw=True) return status, output @@ -255,6 +278,8 @@ def showVolumeOutput(args): command = _getVolSelfHealStatusNRPECommand(args.volume) elif args.option == 'geo-rep': command = _getVolGeoRepStatusNRPECommand(args.volume) + elif args.option == 'quorum': + return _getQuorumStatusOutput(args.hostgroup) return _executeRandomHost(args.hostgroup, command) @@ -290,7 +315,8 @@ def parse_input(): 'status', 'quota', 'self-heal', - 'geo-rep']) + 'geo-rep', + 'quorum']) parser.add_argument('-t', '--timeout', action='store', help='NRPE timeout') diff --git a/plugins/config_generator.py b/plugins/config_generator.py index 62c39ce..64b093a 100644 --- a/plugins/config_generator.py +++ b/plugins/config_generator.py @@ -144,8 +144,9 @@ class GlusterNagiosConfManager: def createClusterQuorumService(self, clusterName): service = {} service['host_name'] = clusterName - service['use'] = 'gluster-passive-service' - service['service_description'] = 'Cluster - Quorum' + service['use'] = 'gluster-passive-freshness-service' + service['service_description'] = 'Cluster - Quorum Status' + service['check_command'] = 'check_quorum_status' return service def createClusterAutoConfigService(self, clusterName, hostIp): |