From cf631a46525499475c9eff65a53e7cfac6eaaeef Mon Sep 17 00:00:00 2001 From: cn Date: Mon, 16 Sep 2013 16:40:15 +0200 Subject: [PATCH] Reorganize repository and use environment variables --- .gitignore | 1 - README | 23 ----------------------- minecraft_ | 28 ---------------------------- murmur-munin.py => mumble | 30 +++++++++++++++--------------- 4 files changed, 15 insertions(+), 67 deletions(-) delete mode 100644 .gitignore delete mode 100644 README delete mode 100644 minecraft_ rename murmur-munin.py => mumble (66%) diff --git a/.gitignore b/.gitignore deleted file mode 100644 index b25c15b..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*~ diff --git a/README b/README deleted file mode 100644 index e79b80f..0000000 --- a/README +++ /dev/null @@ -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 - diff --git a/minecraft_ b/minecraft_ deleted file mode 100644 index 837d36b..0000000 --- a/minecraft_ +++ /dev/null @@ -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}" diff --git a/murmur-munin.py b/mumble similarity index 66% rename from murmur-munin.py rename to mumble index 96b775f..372ae15 100644 --- a/murmur-munin.py +++ b/mumble @@ -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)