1
0
mirror of https://github.com/cmur2/munin-mumble.git synced 2024-12-22 02:54:27 +01:00

Changes needed for Python 3.7 and Ice 3.7

This commit is contained in:
Christian Nicolai 2021-06-18 20:44:03 +02:00 committed by GitHub
parent dee21c42d9
commit d9ae8629e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

34
mumble
View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8
#
# munin-murmur.py - "murmur stats (User/Bans/Uptime/Channels)" script for munin.
@ -10,7 +10,7 @@ import os
iceslice = os.environ.get('iceslice', '/usr/share/slice/Murmur.ice')
# Includepath for Ice, this is default for Debian
iceincludepath = os.environ.get('iceincludepath', '/usr/share/Ice/slice')
iceincludepath = os.environ.get('iceincludepath', '/usr/share/ice/slice')
# Murmur-Port (not needed to work, only for display purposes)
serverport = int(os.environ.get('serverport', '64738'))
@ -44,21 +44,21 @@ import Murmur
if (sys.argv[1:]):
if (sys.argv[1] == "config"):
print 'graph_title Murmur (Port %s)' % (serverport)
print 'graph_vlabel Count'
print 'users.label Users (All)'
print 'usersauth.label Users (Authenticated)'
print 'usersnotauth.label Users (Not authenticated)'
print 'uptime.label Uptime in days'
print 'channelcount.label Number of channels'
print 'bancount.label Number of bans'
print('graph_title Murmur (Port %s)' % (serverport))
print('graph_vlabel Count')
print('users.label Users (All)')
print('usersauth.label Users (Authenticated)')
print('usersnotauth.label Users (Not authenticated)')
print('uptime.label Uptime in days')
print('channelcount.label Number of channels')
print('bancount.label Number of bans')
sys.exit(0)
meta = Murmur.MetaPrx.checkedCast(ice.stringToProxy("Meta:tcp -h 127.0.0.1 -p %s" % (iceport)))
try:
server = meta.getServer(1)
except Murmur.InvalidSecretException:
print 'Given icesecret password is wrong.'
print('Given icesecret password is wrong.')
ice.shutdown()
sys.exit(1)
@ -72,11 +72,11 @@ for key in users.keys():
else:
usersauth += 1
print "users.value %i" % (len(users))
print "usersauth.value %i" % (usersauth)
print "usersnotauth.value %i" % (usersnotauth)
print "uptime.value %.2f" % (float(meta.getUptime())/60/60/24)
print "channelcount.value %i" % (len(server.getChannels()))
print "bancount.value %i" % (len(server.getBans()))
print("users.value %i" % (len(users)))
print("usersauth.value %i" % (usersauth))
print("usersnotauth.value %i" % (usersnotauth))
print("uptime.value %.2f" % (float(meta.getUptime())/60/60/24))
print("channelcount.value %i" % (len(server.getChannels())))
print("bancount.value %i" % (len(server.getBans())))
ice.shutdown()