summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-06-16 22:08:55 -0300
committerSilvio Rhatto <rhatto@riseup.net>2013-06-16 22:08:55 -0300
commite4f8a2fe68bfce91c2b856578ca03567dff81e5a (patch)
tree91aac41215717efe0fb237a2d948b9c28ad0191d
parent6012a7dc583431ca9090be41794a62f5492d1b1e (diff)
downloadpuppet-mumble-e4f8a2fe68bfce91c2b856578ca03567dff81e5a.tar.gz
puppet-mumble-e4f8a2fe68bfce91c2b856578ca03567dff81e5a.tar.bz2
Adding mumble::munin
-rwxr-xr-xfiles/munin/mumble_stats43
-rwxr-xr-xfiles/munin/mumble_users42
-rw-r--r--manifests/munin.pp16
3 files changed, 101 insertions, 0 deletions
diff --git a/files/munin/mumble_stats b/files/munin/mumble_stats
new file mode 100755
index 0000000..de835f2
--- /dev/null
+++ b/files/munin/mumble_stats
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# -*- coding: utf-8
+# Python Plugin for Munin
+# Copyright (C) 2010 Natenom (Natenom@googlemail.com)
+# 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.
+# 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.
+# You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.
+#Version: 0.0.1
+#2010-02-09
+
+#Path to Murmur.ice
+iceslice='/usr/share/slice/Murmur.ice'
+
+#Murmur-Port (not needed to work, only for display purposes)
+serverport=64738
+
+#Port where ice listen
+iceport=6502
+
+
+import Ice, sys
+Ice.loadSlice('', ['-I' + Ice.getSliceDir(), iceslice])
+ice = Ice.initialize()
+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'
+ print 'uptime.label Uptime in days'
+ print 'chancount.label Channelcount/10'
+ print 'bancount.label Bans on server'
+ sys.exit(0)
+
+meta = Murmur.MetaPrx.checkedCast(ice.stringToProxy("Meta:tcp -h 127.0.0.1 -p %s" % (iceport)))
+server=meta.getServer(1)
+print "users.value %i" % (len(server.getUsers()))
+print "uptime.value %.2f" % (float(meta.getUptime())/60/60/24)
+print "chancount.value %.1f" % (len(server.getChannels())/10)
+print "bancount.value %i" % (len(server.getBans()))
+
+ice.shutdown()
diff --git a/files/munin/mumble_users b/files/munin/mumble_users
new file mode 100755
index 0000000..71ea9e2
--- /dev/null
+++ b/files/munin/mumble_users
@@ -0,0 +1,42 @@
+#!/usr/bin/python
+#
+# Munin Plugin for Murmur/ICE
+# written by T. Fernandez
+# fixes by Andrew Williams
+# 07/10/2010
+#
+##########################################################
+
+slicefile = "/usr/share/slice/Murmur.ice"
+prxstr = "Meta:tcp -h 127.0.0.1 -p 6502"
+
+import os
+import sys
+
+import Ice
+if not os.path.exists(slicefile):
+ print slicefile+" not found!"
+ quit(1)
+Ice.loadSlice('', ['-I' + Ice.getSliceDir(), slicefile])
+
+import Murmur
+ice = Ice.initialize()
+prx = ice.stringToProxy(prxstr)
+murmur = Murmur.MetaPrx.checkedCast(prx)
+
+if (sys.argv.__len__() == 2) and (sys.argv[1] == "config"):
+ print "graph_title Mumble users"
+ print "graph_vlabel users"
+ print "graph_args --lower-limit 0"
+ for server in murmur.getAllServers():
+ id = str(server.id())
+ print "murmur"+id+".label Server "+id
+else:
+ for server in murmur.getAllServers():
+ id = str(server.id())
+ if server.isRunning():
+ users = server.getUsers()
+ else:
+ users = []
+ print "murmur"+id+".value "+str(users.__len__())
+quit(0)
diff --git a/manifests/munin.pp b/manifests/munin.pp
new file mode 100644
index 0000000..79b1ebe
--- /dev/null
+++ b/manifests/munin.pp
@@ -0,0 +1,16 @@
+# Plugins thanks to https://github.com/munin-monitoring/contrib.git
+class mumble::munin {
+ package { 'python-zeroc-ice':
+ ensure => present,
+ }
+
+ munin::plugin::deploy { 'mumble_users':
+ source => "mumble/munin/mumble_users",
+ ensure => "present",
+ }
+
+ munin::plugin::deploy { 'mumble_stats':
+ source => "mumble/munin/mumble_stats",
+ ensure => "present",
+ }
+}