Add usersauth and refactor labels

This commit is contained in:
cn 2013-09-16 16:49:31 +02:00
parent cf631a4652
commit c18aa7f813
1 changed files with 15 additions and 11 deletions

26
mumble
View File

@ -45,32 +45,36 @@ if (sys.argv[1:]):
print 'graph_title Murmur (Port %s)' % (serverport) print 'graph_title Murmur (Port %s)' % (serverport)
print 'graph_vlabel Count' print 'graph_vlabel Count'
print 'users.label Users (All)' print 'users.label Users (All)'
print 'usersauth.label Users (Authenticated)'
print 'usersnotauth.label Users (Not authenticated)' print 'usersnotauth.label Users (Not authenticated)'
print 'uptime.label Uptime in days' print 'uptime.label Uptime in days'
print 'chancount.label Channelcount/10' print 'channelcount.label Number of channels'
print 'bancount.label Bans on server' print 'bancount.label Number of bans'
sys.exit(0) sys.exit(0)
meta = Murmur.MetaPrx.checkedCast(ice.stringToProxy("Meta:tcp -h 127.0.0.1 -p %s" % (iceport))) meta = Murmur.MetaPrx.checkedCast(ice.stringToProxy("Meta:tcp -h 127.0.0.1 -p %s" % (iceport)))
try: try:
server=meta.getServer(1) server = meta.getServer(1)
except Murmur.InvalidSecretException: except Murmur.InvalidSecretException:
print 'Given icesecret password is wrong.' print 'Given icesecret password is wrong.'
ice.shutdown() ice.shutdown()
sys.exit(1) sys.exit(1)
#count users # count users
usersnotauth=0 usersnotauth = 0
users=server.getUsers() usersauth = 0
users = server.getUsers()
for key in users.keys(): for key in users.keys():
if (users[key].userid == -1): if (users[key].userid == -1):
usersnotauth+=1 usersnotauth += 1
else:
usersauth += 1
print "users.value %i" % (len(users)) print "users.value %i" % (len(users))
print "uptime.value %.2f" % (float(meta.getUptime())/60/60/24) print "usersauth.value %i" % (usersauth)
print "chancount.value %.1f" % (len(server.getChannels())/10)
print "bancount.value %i" % (len(server.getBans()))
print "usersnotauth.value %i" % (usersnotauth) 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() ice.shutdown()