mirror of
				https://github.com/cmur2/munin-mumble.git
				synced 2025-11-03 18:25:14 +01:00 
			
		
		
		
	Added minecraft_ script
This commit is contained in:
		
							
								
								
									
										28
									
								
								minecraft_
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								minecraft_
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 
 | 
			
		||||
LC_LANG=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 | cut -d'
 | 
			
		||||
' -f2)
 | 
			
		||||
    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}"
 | 
			
		||||
		Reference in New Issue
	
	Block a user