Added sanity checks, updated version number and README file

This commit is contained in:
Jack-Benny Persson 2012-02-14 23:51:55 +01:00
parent 9354928711
commit 68494656cd
2 changed files with 22 additions and 9 deletions

14
README
View File

@ -1,14 +1,16 @@
check_quake.sh
This is meant to be a Nagios plugin to monitor Quake servers. Currently only
Quake II server are supported, but it's easy to to any types of servers that
are supported by qstat. This plugin uses qstat to do all the queries.
This is a Nagios plugin to monitor Quake servers. Currently only Quake II
servers are supported, but more games will be added in the future.
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
working nicely.
Options:
-h
Print detailed help screen
@ -16,7 +18,7 @@ Options:
Print version information
-H
Set the host/IP of the server to watch
-P
-p
Set the port number of the Quake server to watch
Default is 27910
--warning

View File

@ -29,9 +29,12 @@
# #
###############################################################################
VERSION="0.1"
VERSION="0.2"
AUTHOR="(c) 2012 Jack-Benny Persson (jack-benny@cyberinfo.se)"
# Qstat binary
QSTAT=/usr/bin/quakestat
# Exit codes
STATE_OK=0
STATE_WARNING=1
@ -43,6 +46,14 @@ PORT=27919
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 ####
# Print version information
@ -66,7 +77,7 @@ Options:
Print version information
-H
Set the host/IP of the server to watch
-P
-p
Set the port number of the Quake server to watch
Default is 27910
--warning
@ -106,7 +117,7 @@ while [[ -n "$1" ]]; do
shift 2
;;
-P)
-p)
if [[ -z "$2" ]]; then
printf "\nOption $1 requires an argument\n"
print_help