mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
quake/qstat: enhancements
- dash - bots - configurable binary
This commit is contained in:
parent
adcc2f54e6
commit
63f8552ae6
1 changed files with 19 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/ksh
|
#!/bin/sh
|
||||||
#################################################################
|
#################################################################
|
||||||
# Title : Qstat plugin for Munin #
|
# Title : Qstat plugin for Munin #
|
||||||
# Author : Benjamin DUPUIS - Poil #
|
# Author : Benjamin DUPUIS - Poil #
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
#################################################################
|
#################################################################
|
||||||
# Variable : #
|
# Variable : #
|
||||||
#---------------------------------------------------------------#
|
#---------------------------------------------------------------#
|
||||||
qstat_exe='/usr/local/bin/qstat'
|
qstat_exe="${qstat_exe:-/usr/local/bin/qstat}"
|
||||||
|
|
||||||
#---------------------------------------------------------------#
|
#---------------------------------------------------------------#
|
||||||
# End of config
|
# End of config
|
||||||
|
@ -23,7 +23,7 @@ usage() {
|
||||||
echo 'For testing the script, run qstat_ GameType IP Port'
|
echo 'For testing the script, run qstat_ GameType IP Port'
|
||||||
echo ' - GameType : q3s, q4s ... run qstat for seeing available gametype'
|
echo ' - GameType : q3s, q4s ... run qstat for seeing available gametype'
|
||||||
echo 'For munin you must ln -s /usr/share/munin/plugins/qstat_ /etc/munin/plugins/qstat_GameType_IP2test_Port'
|
echo 'For munin you must ln -s /usr/share/munin/plugins/qstat_ /etc/munin/plugins/qstat_GameType_IP2test_Port'
|
||||||
echo 'Perhaps you must have to set qstat_exe path, actually on'${qstat_exe};
|
echo 'Perhaps you must have to set qstat_exe path, actually on' "${qstat_exe}";
|
||||||
echo 'Have Fun'
|
echo 'Have Fun'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,16 +40,17 @@ config() {
|
||||||
|
|
||||||
echo "graph_title Number of players on ${gametype} - ${ip}:${port}
|
echo "graph_title Number of players on ${gametype} - ${ip}:${port}
|
||||||
graph_vlabel players
|
graph_vlabel players
|
||||||
graph_args --base 1000 -r --lower-limit 0 --upper-limit 16
|
graph_args --base 1000 -r --lower-limit 0
|
||||||
graph_category games
|
graph_category games
|
||||||
maxplayer.label max players
|
maxplayer.label max players
|
||||||
|
bot.label bots
|
||||||
player.label players"
|
player.label players"
|
||||||
}
|
}
|
||||||
|
|
||||||
#################################################################
|
#################################################################
|
||||||
# Quake Stat, call qstat #
|
# Quake Stat, call qstat #
|
||||||
#---------------------------------------------------------------#
|
#---------------------------------------------------------------#
|
||||||
quake_stat() {
|
qstat_run() {
|
||||||
if [ "${script_name}" != "qstat_" ]; then
|
if [ "${script_name}" != "qstat_" ]; then
|
||||||
gametype=$(echo "$script_name" | cut -d_ -f2)
|
gametype=$(echo "$script_name" | cut -d_ -f2)
|
||||||
ip=$(echo "$script_name" | cut -d_ -f3)
|
ip=$(echo "$script_name" | cut -d_ -f3)
|
||||||
|
@ -61,24 +62,33 @@ quake_stat() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$gametype" ] && [ -n "$gametype" ] && [ -n "$gametype" ]; then
|
if [ -n "$gametype" ] && [ -n "$gametype" ] && [ -n "$gametype" ]; then
|
||||||
dummy=$("$qstat_exe" -raw ";" -nh "-$gametype" "${ip}:${port}")
|
rawstats=$("$qstat_exe" -raw ";" -nh "-$gametype" "${ip}:${port}")
|
||||||
|
|
||||||
playervalue=$(echo "$dummy" | cut -d\; -f6)
|
playervalue=$(echo "$rawstats" | cut -d\; -f6)
|
||||||
maxplayervalue=$(echo "$dummy" | cut -d\; -f5)
|
maxplayervalue=$(echo "$rawstats" | cut -d\; -f5)
|
||||||
|
|
||||||
|
# Assume that bots have a ping time of 0 miliseconds
|
||||||
|
botvalue=$("$qstat_exe" -P -pa -sort P "-$gametype" "${ip}:${port}" | grep -c 0ms)
|
||||||
|
|
||||||
if [ -z "${playervalue}" ]; then
|
if [ -z "${playervalue}" ]; then
|
||||||
playervalue=0
|
playervalue=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "${botvalue}" ]; then
|
||||||
|
botvalue=0
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "${maxplayervalue}" ]; then
|
if [ -z "${maxplayervalue}" ]; then
|
||||||
maxplayervalue=0
|
maxplayervalue=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo "maxplayer.value "${maxplayervalue};
|
echo "maxplayer.value "${maxplayervalue};
|
||||||
|
echo "bot.value "${botvalue};
|
||||||
echo "player.value "${playervalue};
|
echo "player.value "${playervalue};
|
||||||
else
|
else
|
||||||
echo "maxplayer.value U"
|
echo "maxplayer.value U"
|
||||||
|
echo "bot.value U"
|
||||||
echo "player.value U"
|
echo "player.value U"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -99,7 +109,7 @@ case $1 in
|
||||||
echo "no (edit the script for set qstat path)"
|
echo "no (edit the script for set qstat path)"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
quake_stat "$@"
|
qstat_run "$@"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue