diff --git a/README.md b/README.md index e67ec35..ba66438 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,8 @@ optional arguments: Basic auth string "username:password" -p PATH, --path PATH Path. -e [KEY_LIST [KEY_LIST ...]], --key_exists [KEY_LIST [KEY_LIST ...]] - Checks existence of these keys to determine status. + Checks existence of these keys to determine status. Multiple key values can + be delimited with colon (key,value1:value2). -q [KEY_VALUE_LIST [KEY_VALUE_LIST ...]], --key_equals [KEY_VALUE_LIST [KEY_VALUE_LIST ...]] Checks equality of these keys and values (key,value key2,value2) to determine status. diff --git a/check_http_json.py b/check_http_json.py index bd064b3..eb1227e 100755 --- a/check_http_json.py +++ b/check_http_json.py @@ -75,7 +75,7 @@ class JsonHelper: else: return (None, 'not_found') - def equals(self, key, value): return self.exists(key) and str(self.get(key)) == value + def equals(self, key, value): return self.exists(key) and str(self.get(key)) in value.split(':') def lte(self, key, value): return self.exists(key) and float(self.get(key)) <= float(value) def gte(self, key, value): return self.exists(key) and float(self.get(key)) >= float(value) def exists(self, key): return (self.get(key) != (None, 'not_found')) @@ -193,7 +193,8 @@ def parseArgs(): parser.add_argument('-e', '--key_exists', dest='key_list', nargs='*', help='Checks existence of these keys to determine status.') parser.add_argument('-q', '--key_equals', dest='key_value_list', nargs='*', - help='Checks equality of these keys and values (key,value key2,value2) to determine status.') + help='Checks equality of these keys and values (key,value key2,value2) to determine status.\ + Multiple key values can be delimited with colon (key,value1:value2)') parser.add_argument('-l', '--key_lte', dest='key_lte_list', nargs='*', help='Checks that these keys and values (key,value key2,value2) are less than or equal to\ the returned json value to determine status.')