From a7ccc5e183bfb2591dd202aa324c1a828fcfe60a Mon Sep 17 00:00:00 2001 From: Kanagaraj M Date: Wed, 30 Apr 2014 18:34:38 +0530 Subject: vol-status: change volume status based on brick status Currently the brick description will have only brick path. Changed the code to query based on volume name,cluster name. Volume status will be decided based on state of the bricks in nagios. Change-Id: If1e4f85f5643cf2b747ae8837b905f0d5b8d9b22 Signed-off-by: Kanagaraj M Reviewed-on: http://review.gluster.org/7611 Reviewed-by: Ramesh N Reviewed-by: Sahina Bose --- plugins/livestatus.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'plugins/livestatus.py') diff --git a/plugins/livestatus.py b/plugins/livestatus.py index 9fc2ad7..4145c70 100644 --- a/plugins/livestatus.py +++ b/plugins/livestatus.py @@ -41,13 +41,31 @@ def readLiveStatus(cmd): s.shutdown(socket.SHUT_WR) # Read the answer - answer = s.recv(1000) + answer = s.recv(8192) # Parse the answer into a table table = [line.split('|') for line in answer.split('\n')[:-1]] return table +def readLiveStatusAsJSON(cmd): + cmd += "OutputFormat: json\n" + s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + s.connect(_socketPath) + + # Write command to socket + s.send(cmd) + + # Close socket + s.shutdown(socket.SHUT_WR) + + # Read the answer + answer = s.recv(8192) + + # return the result + return answer + + def checkLiveStatus(cmd): s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) s.connect(_socketPath) -- cgit