prometheus-mumble/src/status.py
2024-01-24 08:13:20 +00:00

20 lines
633 B
Python

import sys, Ice
import Murmur
with Ice.initialize(sys.argv) as communicator:
base = communicator.stringToProxy("Meta:tcp -h 127.0.0.1 -p 6502")
meta = Murmur.MetaPrx.checkedCast(base)
if not meta:
raise RuntimeError("Invalid proxy")
servers = meta.getAllServers()
if len(servers) == 0:
print("No servers found")
for currentServer in servers:
if currentServer.isRunning():
print("Found server (id=%d):\tOnline since %d seconds" % (currentServer.id(), currentServer.getUptime()))
else:
print("Found server (id=%d):\tOffline" % currentServer.id())