2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Plugin qstatcod4and5_: fix shellcheck issues

This commit is contained in:
Lars Kruse 2018-08-01 23:04:43 +02:00
parent eb9019d6ed
commit 57367ce98c

View File

@ -15,11 +15,9 @@
#---------------------------------------------------------------#
# Set path to QSTAT #
qstat_exe='/usr/local/bin/qstat' #
# Set the Group for munin to be displayed e.x. games or COD4 #
munin_group='games' #
#---------------------------------------------------------------#
# End of config
script_name=$(basename $0)
script_name=$(basename "$0")
#################################################################
#################################################################
@ -37,9 +35,9 @@ usage() {
config() {
if [ "${script_name}" != "qstatcod4and5_" ]; then
gametype=$(echo ${script_name} | cut -d_ -f2)
ip=$(echo ${script_name} | cut -d_ -f3)
port=$(echo ${script_name} | cut -d_ -f4)
gametype=$(echo "$script_name" | cut -d_ -f2)
ip=$(echo "$script_name" | cut -d_ -f3)
port=$(echo "$script_name" | cut -d_ -f4)
else
gametype=$1
ip=$2
@ -48,7 +46,7 @@ config() {
echo "graph_title Number of players on ${gametype} - ${ip}:${port}
graph_vlabel players
graph_category ${munin_group}
graph_category games
player.label players"
}
@ -57,24 +55,24 @@ player.label players"
#---------------------------------------------------------------#
quake_stat() {
if [ "${script_name}" != "qstatcod4and5_" ]; then
gametype=$(echo ${script_name} | cut -d_ -f2)
ip=$(echo ${script_name} | cut -d_ -f3)
port=$(echo ${script_name} | cut -d_ -f4)
gametype=$(echo "$script_name" | cut -d_ -f2)
ip=$(echo "$script_name" | cut -d_ -f3)
port=$(echo "$script_name" | cut -d_ -f4)
else
gametype=$1
ip=$2
port=$3
fi
if [ ! -z ${gametype} ] && [ ! -z ${gametype} ] && [ ! -z ${gametype} ]; then
dummy=$(${qstat_exe} -P -pa -sort P -${gametype} ${ip}:${port} | grep frags | wc -l)
if [ ! -z "$gametype" ] && [ ! -z "$gametype" ] && [ ! -z "$gametype" ]; then
dummy=$("$qstat_exe" -P -pa -sort P "-$gametype" "${ip}:${port}" | grep frags | wc -l)
playervalue=$dummy
if [ -z "${playervalue}" ]; then
if [ -z "$playervalue" ]; then
playervalue=0
fi
echo "player.value "${playervalue};
echo "player.value $playervalue"
else
echo "player.value U"
fi
@ -85,7 +83,7 @@ quake_stat() {
#---------------------------------------------------------------#
case $1 in
config)
config
config "$1" "$2" "$3"
exit 0
;;
help | ?)
@ -96,8 +94,7 @@ case $1 in
echo "no (edit the script for set qstat path)"
;;
*)
quake_stat $1 $2 $3
quake_stat "$1" "$2" "$3"
exit 0
;;
esac