Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / mumble / mumble_users @ a7139bca

Historique | Voir | Annoter | Télécharger (1,18 ko)

1
#!/usr/bin/env python
2
#
3
# Munin Plugin for Murmur/ICE
4
# written by T. Fernandez
5
# fixes by Andrew Williams
6
# 07/10/2010
7
#
8
##########################################################
9

    
10
slicefile = "/usr/share/slice/Murmur.ice"
11
prxstr = "Meta:tcp -h 127.0.0.1 -p 6502"
12

    
13
import os
14
import sys
15

    
16
import Ice
17
if not os.path.exists(slicefile):
18
        print slicefile+" not found!"
19
        quit(1)
20
Ice.loadSlice('', ['-I' + Ice.getSliceDir(), slicefile])
21

    
22
import Murmur
23
ice = Ice.initialize()
24
prx = ice.stringToProxy(prxstr)
25
murmur = Murmur.MetaPrx.checkedCast(prx)
26

    
27
if (sys.argv.__len__() == 2) and (sys.argv[1] == "config"):
28
        print "graph_title Mumble users"
29
        print "graph_category voip"
30
        print "graph_vlabel users"
31
        print "graph_args --lower-limit 0"
32
        for server in murmur.getAllServers():
33
                id = str(server.id())
34
                print "murmur"+id+".label Server "+id
35
else:
36
        for server in murmur.getAllServers():
37
                id = str(server.id())
38
                if server.isRunning():
39
                    users = server.getUsers()
40
                else:
41
                    users = []
42
                print "murmur"+id+".value "+str(users.__len__())
43
quit(0)