summaryrefslogtreecommitdiffstats
path: root/plugins/livestatus.py
diff options
context:
space:
mode:
authorKanagaraj M <kmayilsa@redhat.com>2014-04-30 18:34:38 +0530
committerSahina Bose <sabose@redhat.com>2014-05-02 05:04:38 -0700
commita7ccc5e183bfb2591dd202aa324c1a828fcfe60a (patch)
tree2858a7f4f0d36d9b6c346d7c0eda7300af0eb5ff /plugins/livestatus.py
parentef5d02a650fa50698a6ddd157250591619e89be6 (diff)
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 <kmayilsa@redhat.com> Reviewed-on: http://review.gluster.org/7611 Reviewed-by: Ramesh N <rnachimu@redhat.com> Reviewed-by: Sahina Bose <sabose@redhat.com>
Diffstat (limited to 'plugins/livestatus.py')
-rw-r--r--plugins/livestatus.py20
1 files changed, 19 insertions, 1 deletions
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)