summaryrefslogtreecommitdiffstats
path: root/src/ceph.in
diff options
context:
space:
mode:
authorJoao Eduardo Luis <joao.luis@inktank.com>2013-10-23 04:04:23 +0200
committerJoao Eduardo Luis <joao.luis@inktank.com>2013-10-23 04:04:23 +0200
commit7ba4bc4ab751eb11fd57bb500cb484995e485c23 (patch)
tree19357d5d3dce7012a931a2beedd02ec725a619f6 /src/ceph.in
parentpybind: rados: ping a monitor via librados (diff)
downloadceph-7ba4bc4ab751eb11fd57bb500cb484995e485c23.tar.xz
ceph-7ba4bc4ab751eb11fd57bb500cb484995e485c23.zip
cli: ceph: add support to ping monitors
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
Diffstat (limited to 'src/ceph.in')
-rwxr-xr-xsrc/ceph.in20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/ceph.in b/src/ceph.in
index 56422f6ed82..72c58541b0f 100755
--- a/src/ceph.in
+++ b/src/ceph.in
@@ -476,6 +476,19 @@ def complete(sigdict, args, target):
return 0
###
+# ping a monitor
+###
+def ping_monitor(cluster_handle, name):
+ if 'mon.' not in name:
+ print >> sys.stderr, '"ping" expects a monitor to ping; try "ping mon.<id>"'
+ return 1
+
+ mon_id = name[len('mon.'):]
+ s = cluster_handle.ping_monitor(mon_id)
+ print s
+ return 0
+
+###
# main
###
@@ -603,7 +616,14 @@ def main():
hdr('Monitor commands:')
print '[Contacting monitor, timeout after %d seconds]' % timeout
+ if childargs[0] == 'ping':
+ if len(childargs) < 2:
+ print >> sys.stderr, '"ping" requires a monitor name as argument: "ping mon.<id>"'
+ return 1
+
try:
+ if childargs[0] == 'ping':
+ return ping_monitor(cluster_handle, childargs[1])
cluster_handle.connect(timeout=timeout)
except KeyboardInterrupt:
print >> sys.stderr, 'Cluster connection aborted'