From 3b7cc051a97dfb57454bf71e0aca68acdfc95e4e Mon Sep 17 00:00:00 2001 From: Nishanth Thomas Date: Thu, 20 Mar 2014 13:08:42 +0530 Subject: Added files for volume Utilization - Nagios server side Change-Id: Idaa995d504e2278fb5a2b67ca4bcbc157307b7d7 Signed-off-by: Nishanth Thomas Reviewed-on: https://cuckoo.blr.redhat.com:8443/50 Reviewed-by: Sahina Bose Tested-by: Sahina Bose --- plugins/livestatus.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'plugins/livestatus.py') diff --git a/plugins/livestatus.py b/plugins/livestatus.py index ce546ce..e2f4f03 100644 --- a/plugins/livestatus.py +++ b/plugins/livestatus.py @@ -46,3 +46,20 @@ def readLiveStatus(cmd): table = [line.split('|') for line in answer.split('\n')[:-1]] return table + + +def checkLiveStatus(cmd): + 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(1000000) + + # return the result + return answer -- cgit