1
0
mirror of https://github.com/cmur2/munin-mumble.git synced 2024-11-18 12:56:18 +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.
# Copyright (c) 2012, Natenom / natenom@natenom.name
#Path to Murmur.ice
iceslice='/usr/share/Ice/slice/Murmur.ice'
# Path to Murmur.ice
iceslice = os.environ.get('iceslice', '/usr/share/slice/Murmur.ice')
#Includepath for Ice, this is default for Debian
iceincludepath="/usr/share/Ice/slice"
# Includepath for Ice, this is default for Debian
iceincludepath = os.environ.get('iceincludepath', '/usr/share/Ice/slice')
#Murmur-Port (not needed to work, only for display purposes)
serverport=64738
# Murmur-Port (not needed to work, only for display purposes)
serverport = int(os.environ.get('serverport', '64738'))
#Port where ice listen
iceport=6502
# Port where ice listen
iceport = int(os.environ.get('iceport', '6502'))
#Ice Password to get read access.
#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
icesecret="secureme"
# Ice Password to get read access.
# 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
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.
# This value is being interpreted in kibiBytes.
messagesizemax="65535"
messagesizemax = os.environ.get('messagesizemax', '65535')
import Ice, sys
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:
server=meta.getServer(1)
except Murmur.InvalidSecretException:
print 'Given icesecreatread password is wrong.'
print 'Given icesecret password is wrong.'
ice.shutdown()
sys.exit(1)