diff options
author | charleszlu <c4planted@gmail.com> | 2014-08-09 08:59:38 +0400 |
---|---|---|
committer | charleszlu <c4planted@gmail.com> | 2014-08-09 08:59:38 +0400 |
commit | 676e0a12bdcf9fa8f6290ceab293e8c3ab0b9c9d (patch) | |
tree | 6165219e503d2deb9f8bbd6748229f56f55a4626 | |
parent | 9555d061dc0842aa8b4927b623664cd18b70acd9 (diff) |
Better exception handling
Improve exception handling for the case when the mumble server is not running
-rw-r--r-- | murmur-munin.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/murmur-munin.py b/murmur-munin.py index 0406b97..d627dc8 100644 --- a/murmur-munin.py +++ b/murmur-munin.py @@ -83,7 +83,17 @@ if (sys.argv[1:]): sys.exit(0) -meta = Murmur.MetaPrx.checkedCast(ice.stringToProxy("Meta:tcp -h 127.0.0.1 -p %s" % (iceport))) +try: + meta = Murmur.MetaPrx.checkedCast(ice.stringToProxy("Meta:tcp -h 127.0.0.1 -p %s" % (iceport))) +except Ice.ConnectionRefusedException: + print "users.value 0" + print "uptime.value 0" + print "chancount.value 0" + print "bancount.value 0" + print "usersnotauth.value 0" + ice.shutdown() + sys.exit(1) + try: server=meta.getServer(1) except Murmur.InvalidSecretException: |