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

Reorganize repository and use environment variables

This commit is contained in:
cn 2013-09-16 16:40:15 +02:00
parent edcae39f28
commit cf631a4652
4 changed files with 15 additions and 67 deletions

1
.gitignore vendored
View File

@ -1 +0,0 @@
*~

23
README
View File

@ -1,23 +0,0 @@
======Munin-Plugins======
Several plugins for munin; mostly bash scripts.
=====minecraft_=====
Description: Shows user count and RAM usage.
Website: http://wiki.natenom.name/minecraft/munin-plugin
====Install====
As the script needs root rights to work correctly, you must add following
two lines to /etc/munin/plugin-conf.d/munin-node on Debian:
[minecraft_*]
user root
If your server is running on the default port, do:
# cd /etc/munin/plugins
# ln -s /path/to/minecraft_ minecraft_25565
=====murmur-munin.py=====
Description: Munin plugin to query murmur (Mumble-Server)
Website: http://wiki.natenom.name/mumble/tools/munin
* Has support to set messagesizemax value

View File

@ -1,28 +0,0 @@
#!/bin/bash
LANG=C
LC_ALL=C
MC_PORT=${0##*_}
if [ "$1" = "config" ]
then
printf 'graph_title Minecraft-Server (Port %s)\n' ${MC_PORT}
printf 'graph_vlabel Anzahl\n'
printf 'users.label Benutzer\n'
printf 'ramusage.label Verwendeter RAM in GiB\n'
exit 0
fi
PLAYERCOUNT=$(netstat -tn | grep -i ${MC_PORT} | grep ESTABLISHED | wc -l)
MC_PID=$(netstat -tlpn | grep ${MC_PORT} | sed -n -e '1p' | awk '{ print $7 }' | cut -d'/' -f1)
if [ ! -z "${MC_PID}" ]
then #is running
MEMORYRSS=$(ps -p ${MC_PID} -o rss | grep -v RSS)
MEMGiB=$(echo "scale=2;${MEMORYRSS}/1024/1024" | bc -l)
else
MEMGiB=0
fi
printf "users.value %i\n" "${PLAYERCOUNT}"
printf "ramusage.value %3.2f\n" "${MEMGiB}"

View File

@ -4,27 +4,27 @@
# munin-murmur.py - "murmur stats (User/Bans/Uptime/Channels)" script for munin. # munin-murmur.py - "murmur stats (User/Bans/Uptime/Channels)" script for munin.
# Copyright (c) 2012, Natenom / natenom@natenom.name # Copyright (c) 2012, Natenom / natenom@natenom.name
#Path to Murmur.ice # Path to Murmur.ice
iceslice='/usr/share/Ice/slice/Murmur.ice' iceslice = os.environ.get('iceslice', '/usr/share/slice/Murmur.ice')
#Includepath for Ice, this is default for Debian # Includepath for Ice, this is default for Debian
iceincludepath="/usr/share/Ice/slice" iceincludepath = os.environ.get('iceincludepath', '/usr/share/Ice/slice')
#Murmur-Port (not needed to work, only for display purposes) # Murmur-Port (not needed to work, only for display purposes)
serverport=64738 serverport = int(os.environ.get('serverport', '64738'))
#Port where ice listen # Port where ice listen
iceport=6502 iceport = int(os.environ.get('iceport', '6502'))
#Ice Password to get read access. # Ice Password to get read access.
#If there is no such var in your murmur.ini, this can have any value. # If there is no such var in your murmur.ini, this can have any value.
#You can use the values of icesecret, icesecretread or icesecretwrite in your murmur.ini # You can use the values of icesecret, icesecretread or icesecretwrite in your murmur.ini
icesecret="secureme" icesecret = os.environ.get('icesecret', 'secureme')
#MessageSizeMax; increase this value, if you get a MemoryLimitException. # MessageSizeMax; increase this value, if you get a MemoryLimitException.
# Also check this value in murmur.ini of your Mumble-Server. # Also check this value in murmur.ini of your Mumble-Server.
# This value is being interpreted in kibiBytes. # This value is being interpreted in kibiBytes.
messagesizemax="65535" messagesizemax = os.environ.get('messagesizemax', '65535')
import Ice, sys import Ice, sys
Ice.loadSlice("--all -I%s %s" % (iceincludepath, iceslice)) Ice.loadSlice("--all -I%s %s" % (iceincludepath, iceslice))
@ -56,7 +56,7 @@ meta = Murmur.MetaPrx.checkedCast(ice.stringToProxy("Meta:tcp -h 127.0.0.1 -p %s
try: try:
server=meta.getServer(1) server=meta.getServer(1)
except Murmur.InvalidSecretException: except Murmur.InvalidSecretException:
print 'Given icesecreatread password is wrong.' print 'Given icesecret password is wrong.'
ice.shutdown() ice.shutdown()
sys.exit(1) sys.exit(1)