mirror of
https://github.com/drewkerrigan/nagios-http-json.git
synced 2024-11-22 10:23:50 +01:00
Merge branch 'luban8' into next-release
This commit is contained in:
commit
8e469e3d98
@ -70,8 +70,9 @@ optional arguments:
|
||||
(key,value1:value2). Return warning if equality check
|
||||
fails
|
||||
-Q [KEY_VALUE_LIST_CRITICAL [KEY_VALUE_LIST_CRITICAL ...]], --key_equals_critical [KEY_VALUE_LIST_CRITICAL [KEY_VALUE_LIST_CRITICAL ...]]
|
||||
Same as -q but return critical if equality check
|
||||
fails.
|
||||
Same as -q but return critical if equality check fails.
|
||||
-u [KEY_VALUE_LIST_UNKNOWN [KEY_VALUE_LIST_UNKNOWN --key_equals_unknown [KEY_VALUE_LIST_UNKNOWN [KEY_VALUE_LIST_UNKNOWN ...]]
|
||||
Same as -Q but return unknown if equality check fails.
|
||||
-m [METRIC_LIST [METRIC_LIST ...]], --key_metric [METRIC_LIST [METRIC_LIST ...]]
|
||||
Gathers the values of these keys (key[>alias],UnitOfMe
|
||||
asure,WarnRange,CriticalRange,Min,Max) for Nagios
|
||||
|
@ -305,6 +305,12 @@ class JsonRuleProcessor:
|
||||
failure += self.checkExists(self.key_list_critical)
|
||||
return failure
|
||||
|
||||
def checkUnknown(self):
|
||||
unknown = ''
|
||||
if self.rules.key_value_list_unknown != None:
|
||||
unknown += self.checkEquality(self.rules.key_value_list_unknown)
|
||||
return unknown
|
||||
|
||||
def checkMetrics(self):
|
||||
"""Return a Nagios specific performance metrics string given keys
|
||||
and parameter definitions"""
|
||||
@ -403,6 +409,10 @@ def parseArgs():
|
||||
dest='key_value_list_critical', nargs='*',
|
||||
help='''Same as -q but return critical if
|
||||
equality check fails.''')
|
||||
parser.add_argument('-u', '--key_equals_unknown',
|
||||
dest='key_value_list_unknown', nargs='*',
|
||||
help='''Same as -q but return unknown if
|
||||
equality check fails.''')
|
||||
parser.add_argument('-m', '--key_metric', dest='metric_list', nargs='*',
|
||||
help='''Gathers the values of these keys (key[>alias],
|
||||
UnitOfMeasure,WarnRange,CriticalRange,Min,Max) for
|
||||
@ -646,6 +656,7 @@ if __name__ == "__main__":
|
||||
nagios.append_warning(processor.checkWarning())
|
||||
nagios.append_critical(processor.checkCritical())
|
||||
nagios.append_metrics(processor.checkMetrics())
|
||||
nagios.append_unknown(processor.checkUnknown())
|
||||
# Print Nagios specific string and exit appropriately
|
||||
print nagios.getMessage()
|
||||
exit(nagios.getCode())
|
||||
|
Loading…
Reference in New Issue
Block a user