From 6eda98ec190e8206813996701303860260accd06 Mon Sep 17 00:00:00 2001 From: Mark Rogaski Date: Tue, 3 Nov 2015 04:53:24 +0000 Subject: [PATCH] Added version option. --- README.md | 9 +++++---- check_minecraft | 4 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index af9c13a..c1e53a9 100644 --- a/README.md +++ b/README.md @@ -21,20 +21,21 @@ the monitor. ## Usage ``` -usage: check_minecraft [-h] [-v] -H HOST [-p PORT] [-w RANGE] [-c RANGE] +usage: check_minecraft [-h] [-V] -H HOST [-p PORT] [-v] [-w RANGE] [-c RANGE] -check_minecraft: A plugin for monitoring a Minecraft server running version -1.7 or 1.8. +check_minecraft: A plugin for monitoring a Minecraft server running version 1.7 or 1.8. optional arguments: -h, --help show this help message and exit - -v, --verbose + -V, --version show program's version number and exit -H HOST, --host HOST hostname or IP address of the server -p PORT, --port PORT TCP port number of the server + -v, --verbose -w RANGE, --warning RANGE return warning if RTD is outside RANGE -c RANGE, --critical RANGE return critical if RTD is outside RANGE + ``` diff --git a/check_minecraft b/check_minecraft index 04d0132..db7350a 100755 --- a/check_minecraft +++ b/check_minecraft @@ -220,11 +220,13 @@ class MCServer(nagiosplugin.Resource): #@nagiosplugin.guarded def main(): argp = argparse.ArgumentParser(description=__doc__) - argp.add_argument('-v', '--verbose', action='count', default=0) + argp.add_argument('-V', '--version', action='version', + version='%(prog)s ' + __version__) argp.add_argument('-H', '--host', metavar='HOST', required=True, help='hostname or IP address of the server') argp.add_argument('-p', '--port', metavar='PORT', default=25565, help='TCP port number of the server') + argp.add_argument('-v', '--verbose', action='count', default=0) argp.add_argument('-w', '--warning', metavar='RANGE', default='120', help='return warning if RTD is outside RANGE') argp.add_argument('-c', '--critical', metavar='RANGE', default='300',