Compare commits
No commits in common. "master" and "v0.1" have entirely different histories.
102
README
102
README
@ -1,17 +1,14 @@
|
|||||||
check_quake.sh
|
check_quake.sh
|
||||||
|
|
||||||
This is a Nagios plugin to monitor game servers.
|
This is meant to be a Nagios plugin to monitor Quake servers. Currently only
|
||||||
The plugin uses qstat to do all the queries.
|
Quake II server are supported, but it's easy to to any types of servers that
|
||||||
All games that are supported by qstat works with check_quake.
|
are supported by qstat. This plugin uses qstat to do all the queries.
|
||||||
The plugin complies with the Nagios Plugin Development Guidelines. It has
|
|
||||||
some basic sanity checks, uses the default exit codes, follows the standard
|
|
||||||
arguments, has only one line of output etc.
|
|
||||||
|
|
||||||
|
Note that this plugin does NOT yet comply with the Nagios Plugin Development
|
||||||
|
Guidelines (for example missing some sanity checks).
|
||||||
The plugin is in use by myself to monitor a friends Quake II server and is
|
The plugin is in use by myself to monitor a friends Quake II server and is
|
||||||
working nicely.
|
working nicely.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-h
|
-h
|
||||||
Print detailed help screen
|
Print detailed help screen
|
||||||
@ -19,96 +16,9 @@ Options:
|
|||||||
Print version information
|
Print version information
|
||||||
-H
|
-H
|
||||||
Set the host/IP of the server to watch
|
Set the host/IP of the server to watch
|
||||||
-p
|
-P
|
||||||
Set the port number of the Quake server to watch
|
Set the port number of the Quake server to watch
|
||||||
Default is 27910
|
Default is 27910
|
||||||
--game
|
|
||||||
Set the gametype to be monitored. Default is Quake 2 (q2s)
|
|
||||||
Any game supported by qstat works. See the list below:
|
|
||||||
a2s Half-Life 2 new server
|
|
||||||
ams America's Army v2.x server
|
|
||||||
bfs BFRIS server
|
|
||||||
odm Call of Duty Master server
|
|
||||||
cods Call of Duty server
|
|
||||||
crs Command and Conquer: Renegade server
|
|
||||||
d3g Descent3 Gamespy Protocol server
|
|
||||||
d3m Descent3 Master (PXO) server
|
|
||||||
d3p Descent3 PXO protocol server
|
|
||||||
d3s Descent3 server
|
|
||||||
dm3m Doom 3 Master server
|
|
||||||
dm3s Doom 3 server
|
|
||||||
efm Star Trek: Elite Force server
|
|
||||||
efs Star Trek: Elite Force server
|
|
||||||
eye All Seeing Eye Protocol server
|
|
||||||
fcs FarCry server
|
|
||||||
gps Gamespy Protocol server
|
|
||||||
grs Ghost Recon server
|
|
||||||
gs2 Gamespy V2 Protocol server
|
|
||||||
gs3 Gamespy V3 Protocol server
|
|
||||||
gs4 Gamespy V4 Protocol server
|
|
||||||
gsm Gamespy Master server
|
|
||||||
h2s Hexen II server
|
|
||||||
hl2s Half-Life 2 server
|
|
||||||
hla2s Half-Life server
|
|
||||||
hla2sm Steam Master server
|
|
||||||
hlm Half-Life Master server
|
|
||||||
hlqs Half-Life server
|
|
||||||
hls Half-Life server
|
|
||||||
hrs Heretic II server
|
|
||||||
hws HexenWorld server
|
|
||||||
jk3m Jedi Knight: Jedi Academy server
|
|
||||||
jk3s Jedi Knight: Jedi Academy server
|
|
||||||
kps Kingpin server
|
|
||||||
maqs Medal of Honor: Allied Assault (Q) server
|
|
||||||
mas Medal of Honor: Allied Assault server
|
|
||||||
mhs Medal of Honor: Allied Assault server
|
|
||||||
netp NetPanzer server
|
|
||||||
netpm NetPanzer Master server
|
|
||||||
nexuizm Nexuiz Master server
|
|
||||||
nexuizs Nexuiz server
|
|
||||||
preym Prey Master server
|
|
||||||
preys PREY server
|
|
||||||
prs Pariah server
|
|
||||||
q2m Quake II Master server
|
|
||||||
q2s Quake II server
|
|
||||||
q3m Quake III Master server
|
|
||||||
q3s Quake III: Arena server
|
|
||||||
q4m Quake 4 Master server
|
|
||||||
q4s Quake 4 server
|
|
||||||
qs Quake server
|
|
||||||
qwm QuakeWorld Master server
|
|
||||||
qws QuakeWorld server
|
|
||||||
rss Ravenshield server
|
|
||||||
rwm Return to Castle Wolfenstein Master server
|
|
||||||
rws Return to Castle Wolfenstein server
|
|
||||||
sas Savage server
|
|
||||||
sfs Soldier of Fortune server
|
|
||||||
sgs Shogo: Mobile Armor Division server
|
|
||||||
sms Serious Sam server
|
|
||||||
sns Sin server
|
|
||||||
sof2m SOF2 Master server
|
|
||||||
sof2m1.0 SOF2 Master (1.0) server
|
|
||||||
sof2s Soldier of Fortune 2 server
|
|
||||||
stm Steam Master server
|
|
||||||
stma2s Steam Master for A2S server
|
|
||||||
stmhl2 Steam Master for HL2 server
|
|
||||||
t2m Tribes 2 Master server
|
|
||||||
t2s Tribes 2 server
|
|
||||||
tbm Tribes Master server
|
|
||||||
tbs Tribes server
|
|
||||||
tm TrackMania server
|
|
||||||
tremulous Tremulous server
|
|
||||||
tremulousm Tremulous Master server
|
|
||||||
ts2 Teamspeak 2 server
|
|
||||||
uns Unreal server
|
|
||||||
ut2004m UT2004 Master server
|
|
||||||
ut2004s UT2004 server
|
|
||||||
ut2s Unreal Tournament 2003 server
|
|
||||||
warsowm Warsow Master server
|
|
||||||
warsows Warsow server
|
|
||||||
woetm Enemy Territory Master server
|
|
||||||
woets Enemy Territory server
|
|
||||||
--warning
|
--warning
|
||||||
Issue a warning state instead of a critical state
|
Issue a warning state instead of a critical state
|
||||||
Default is critical
|
Default is critical
|
||||||
|
|
||||||
|
8
THANKS
8
THANKS
@ -1,8 +0,0 @@
|
|||||||
check_quake THANKS file
|
|
||||||
|
|
||||||
check_quake was originally written by Jack-Benny Persson.
|
|
||||||
Some people has further contributed to check_quake by reporting problems,
|
|
||||||
suggesting various improvements or submitting actual code. Here is a list of
|
|
||||||
these people. Help me keep it complete and exempt of errors.
|
|
||||||
|
|
||||||
Flemming Gregersen kinives@gmail.com
|
|
135
check_quake.sh
135
check_quake.sh
@ -22,22 +22,16 @@
|
|||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# #
|
# #
|
||||||
# Nagios plugin to monitor a game server. #
|
# Nagios plugin to monitor a Quake II server. #
|
||||||
# All games supported by qstat works. #
|
|
||||||
# The plugin exit with a CRICITAL error code if the server is down. #
|
# The plugin exit with a CRICITAL error code if the server is down. #
|
||||||
# This behavior can be changed with the --warning argument. #
|
# This behavior can be changed with the --warning argument. #
|
||||||
# Written in Bash (and uses standard tools such as grep and awk). #
|
# Written in Bash (and uses standard tools such as grep and awk). #
|
||||||
# Latest version of the script can be found at: #
|
|
||||||
# https://github.com/jackbenny/check_quake #
|
|
||||||
# #
|
# #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
VERSION="0.3"
|
VERSION="0.1"
|
||||||
AUTHOR="(c) 2012 Jack-Benny Persson (jack-benny@cyberinfo.se)"
|
AUTHOR="(c) 2012 Jack-Benny Persson (jack-benny@cyberinfo.se)"
|
||||||
|
|
||||||
# Qstat binary
|
|
||||||
QSTAT=/usr/bin/quakestat
|
|
||||||
|
|
||||||
# Exit codes
|
# Exit codes
|
||||||
STATE_OK=0
|
STATE_OK=0
|
||||||
STATE_WARNING=1
|
STATE_WARNING=1
|
||||||
@ -45,19 +39,10 @@ STATE_CRITICAL=2
|
|||||||
STATE_UNKNOWN=3
|
STATE_UNKNOWN=3
|
||||||
|
|
||||||
# Some default values
|
# Some default values
|
||||||
PORT=27910
|
PORT=27919
|
||||||
GAME="q2s"
|
|
||||||
|
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
# Sanity checks
|
|
||||||
if [[ ! -x "$QSTAT" ]]; then
|
|
||||||
printf "It appears you don't have the qstat package installed in\
|
|
||||||
$QSTAT\n"
|
|
||||||
exit $STATE_UNKNOWN
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#### Functions ####
|
#### Functions ####
|
||||||
|
|
||||||
# Print version information
|
# Print version information
|
||||||
@ -71,7 +56,7 @@ print_help()
|
|||||||
{
|
{
|
||||||
print_version
|
print_version
|
||||||
printf "$AUTHOR\n"
|
printf "$AUTHOR\n"
|
||||||
printf "Monitor a game server\n"
|
printf "Monitor a Quake II server\n"
|
||||||
/bin/cat <<EOT
|
/bin/cat <<EOT
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
@ -81,95 +66,9 @@ Options:
|
|||||||
Print version information
|
Print version information
|
||||||
-H
|
-H
|
||||||
Set the host/IP of the server to watch
|
Set the host/IP of the server to watch
|
||||||
-p
|
-P
|
||||||
Set the port number of the game server to watch
|
Set the port number of the Quake server to watch
|
||||||
Default is 27910 (Quake 2)
|
Default is 27910
|
||||||
--game
|
|
||||||
Set the game to be monitored. Default is Quake 2 (q2s)
|
|
||||||
Any game supported by qstat works. See the list below:
|
|
||||||
a2s Half-Life 2 new server
|
|
||||||
ams America's Army v2.x server
|
|
||||||
bfs BFRIS server
|
|
||||||
odm Call of Duty Master server
|
|
||||||
cods Call of Duty server
|
|
||||||
crs Command and Conquer: Renegade server
|
|
||||||
d3g Descent3 Gamespy Protocol server
|
|
||||||
d3m Descent3 Master (PXO) server
|
|
||||||
d3p Descent3 PXO protocol server
|
|
||||||
d3s Descent3 server
|
|
||||||
dm3m Doom 3 Master server
|
|
||||||
dm3s Doom 3 server
|
|
||||||
efm Star Trek: Elite Force server
|
|
||||||
efs Star Trek: Elite Force server
|
|
||||||
eye All Seeing Eye Protocol server
|
|
||||||
fcs FarCry server
|
|
||||||
gps Gamespy Protocol server
|
|
||||||
grs Ghost Recon server
|
|
||||||
gs2 Gamespy V2 Protocol server
|
|
||||||
gs3 Gamespy V3 Protocol server
|
|
||||||
gs4 Gamespy V4 Protocol server
|
|
||||||
gsm Gamespy Master server
|
|
||||||
h2s Hexen II server
|
|
||||||
hl2s Half-Life 2 server
|
|
||||||
hla2s Half-Life server
|
|
||||||
hla2sm Steam Master server
|
|
||||||
hlm Half-Life Master server
|
|
||||||
hlqs Half-Life server
|
|
||||||
hls Half-Life server
|
|
||||||
hrs Heretic II server
|
|
||||||
hws HexenWorld server
|
|
||||||
jk3m Jedi Knight: Jedi Academy server
|
|
||||||
jk3s Jedi Knight: Jedi Academy server
|
|
||||||
kps Kingpin server
|
|
||||||
maqs Medal of Honor: Allied Assault (Q) server
|
|
||||||
mas Medal of Honor: Allied Assault server
|
|
||||||
mhs Medal of Honor: Allied Assault server
|
|
||||||
netp NetPanzer server
|
|
||||||
netpm NetPanzer Master server
|
|
||||||
nexuizm Nexuiz Master server
|
|
||||||
nexuizs Nexuiz server
|
|
||||||
preym Prey Master server
|
|
||||||
preys PREY server
|
|
||||||
prs Pariah server
|
|
||||||
q2m Quake II Master server
|
|
||||||
q2s Quake II server
|
|
||||||
q3m Quake III Master server
|
|
||||||
q3s Quake III: Arena server
|
|
||||||
q4m Quake 4 Master server
|
|
||||||
q4s Quake 4 server
|
|
||||||
qs Quake server
|
|
||||||
qwm QuakeWorld Master server
|
|
||||||
qws QuakeWorld server
|
|
||||||
rss Ravenshield server
|
|
||||||
rwm Return to Castle Wolfenstein Master server
|
|
||||||
rws Return to Castle Wolfenstein server
|
|
||||||
sas Savage server
|
|
||||||
sfs Soldier of Fortune server
|
|
||||||
sgs Shogo: Mobile Armor Division server
|
|
||||||
sms Serious Sam server
|
|
||||||
sns Sin server
|
|
||||||
sof2m SOF2 Master server
|
|
||||||
sof2m1.0 SOF2 Master (1.0) server
|
|
||||||
sof2s Soldier of Fortune 2 server
|
|
||||||
stm Steam Master server
|
|
||||||
stma2s Steam Master for A2S server
|
|
||||||
stmhl2 Steam Master for HL2 server
|
|
||||||
t2m Tribes 2 Master server
|
|
||||||
t2s Tribes 2 server
|
|
||||||
tbm Tribes Master server
|
|
||||||
tbs Tribes server
|
|
||||||
tm TrackMania server
|
|
||||||
tremulous Tremulous server
|
|
||||||
tremulousm Tremulous Master server
|
|
||||||
ts2 Teamspeak 2 server
|
|
||||||
uns Unreal server
|
|
||||||
ut2004m UT2004 Master server
|
|
||||||
ut2004s UT2004 server
|
|
||||||
ut2s Unreal Tournament 2003 server
|
|
||||||
warsowm Warsow Master server
|
|
||||||
warsows Warsow server
|
|
||||||
woetm Enemy Territory Master server
|
|
||||||
woets Enemy Territory server
|
|
||||||
--warning
|
--warning
|
||||||
Issue a warning state instead of a critical state
|
Issue a warning state instead of a critical state
|
||||||
Default is critical
|
Default is critical
|
||||||
@ -207,7 +106,7 @@ while [[ -n "$1" ]]; do
|
|||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-p)
|
-P)
|
||||||
if [[ -z "$2" ]]; then
|
if [[ -z "$2" ]]; then
|
||||||
printf "\nOption $1 requires an argument\n"
|
printf "\nOption $1 requires an argument\n"
|
||||||
print_help
|
print_help
|
||||||
@ -217,16 +116,6 @@ while [[ -n "$1" ]]; do
|
|||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
|
||||||
--game)
|
|
||||||
if [[ -z "$2" ]]; then
|
|
||||||
printf "\nOption $1 requires an argument\n"
|
|
||||||
print_help
|
|
||||||
exit $STATE_UNKNOWN
|
|
||||||
fi
|
|
||||||
GAME=$2
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
|
|
||||||
--warning)
|
--warning)
|
||||||
warning="yes"
|
warning="yes"
|
||||||
shift 1
|
shift 1
|
||||||
@ -262,21 +151,21 @@ fi
|
|||||||
### MAIN ###
|
### MAIN ###
|
||||||
|
|
||||||
#Test if the server is up and running
|
#Test if the server is up and running
|
||||||
QSTAT_TEST=`quakestat -u -default ${GAME} ${HOST}:${PORT} | grep "${HOST}"`
|
QSTAT_TEST=`quakestat -u -default q2s ${HOST}:${PORT} | grep "${HOST}"`
|
||||||
|
|
||||||
#Let's see if the above command was succesful or not
|
#Let's see if the above command was succesful or not
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
printf "${GAME} on port $PORT - OK\n"
|
printf "Q2 on port $PORT - OK\n"
|
||||||
exit $STATE_OK
|
exit $STATE_OK
|
||||||
|
|
||||||
#See if we wanted a warning instead of a critical
|
#See if we wanted a warning instead of a critical
|
||||||
elif [[ "$warning" == "yes" ]]; then
|
elif [[ "$warning" == "yes" ]]; then
|
||||||
printf "${GAME} on port $PORT - WARNING\n"
|
printf "Q2 on port $PORT - WARNING\n"
|
||||||
exit $STATE_WARNING
|
exit $STATE_WARNING
|
||||||
#Critical
|
#Critical
|
||||||
else
|
else
|
||||||
|
|
||||||
printf "${GAME} on port $PORT - CRITICAL\n"
|
printf "Q2 on port $PORT - CRITICAL\n"
|
||||||
exit $STATE_CRITICAL
|
exit $STATE_CRITICAL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user