root / plugins / other / murmur-stats @ 31412baa
Historique | Voir | Annoter | Télécharger (1,69 ko)
| 1 |
#!/usr/bin/env python |
|---|---|
| 2 |
# -*- coding: utf-8 |
| 3 |
# Python Plugin for Munin |
| 4 |
# Copyright (C) 2010 Natenom (Natenom@googlemail.com) |
| 5 |
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. |
| 6 |
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 7 |
# You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 8 |
#Version: 0.0.1 |
| 9 |
#2010-02-09 |
| 10 |
|
| 11 |
#Path to Murmur.ice |
| 12 |
iceslice='/usr/share/slice/Murmur.ice' |
| 13 |
|
| 14 |
#Murmur-Port (not needed to work, only for display purposes) |
| 15 |
serverport=64738 |
| 16 |
|
| 17 |
#Port where ice listen |
| 18 |
iceport=6502 |
| 19 |
|
| 20 |
|
| 21 |
import Ice, sys |
| 22 |
Ice.loadSlice('', ['-I' + Ice.getSliceDir(), iceslice])
|
| 23 |
ice = Ice.initialize() |
| 24 |
import Murmur |
| 25 |
|
| 26 |
if (sys.argv[1:]): |
| 27 |
if (sys.argv[1] == "config"): |
| 28 |
print 'graph_title Murmur (Port %s)' % (serverport) |
| 29 |
print 'graph_vlabel Count' |
| 30 |
print 'users.label Users' |
| 31 |
print 'uptime.label Uptime in days' |
| 32 |
print 'chancount.label Channelcount/10' |
| 33 |
print 'bancount.label Bans on server' |
| 34 |
sys.exit(0) |
| 35 |
|
| 36 |
meta = Murmur.MetaPrx.checkedCast(ice.stringToProxy("Meta:tcp -h 127.0.0.1 -p %s" % (iceport)))
|
| 37 |
server=meta.getServer(1) |
| 38 |
print "users.value %i" % (len(server.getUsers())) |
| 39 |
print "uptime.value %.2f" % (float(meta.getUptime())/60/60/24) |
| 40 |
print "chancount.value %.1f" % (len(server.getChannels())/10) |
| 41 |
print "bancount.value %i" % (len(server.getBans())) |
| 42 |
|
| 43 |
ice.shutdown() |
