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
|
(key,value1:value2). Return warning if equality check
|
||||||
fails
|
fails
|
||||||
-Q [KEY_VALUE_LIST_CRITICAL [KEY_VALUE_LIST_CRITICAL ...]], --key_equals_critical [KEY_VALUE_LIST_CRITICAL [KEY_VALUE_LIST_CRITICAL ...]]
|
-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
|
Same as -q but return critical if equality check fails.
|
||||||
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 ...]]
|
-m [METRIC_LIST [METRIC_LIST ...]], --key_metric [METRIC_LIST [METRIC_LIST ...]]
|
||||||
Gathers the values of these keys (key[>alias],UnitOfMe
|
Gathers the values of these keys (key[>alias],UnitOfMe
|
||||||
asure,WarnRange,CriticalRange,Min,Max) for Nagios
|
asure,WarnRange,CriticalRange,Min,Max) for Nagios
|
||||||
|
@ -305,6 +305,12 @@ class JsonRuleProcessor:
|
|||||||
failure += self.checkExists(self.key_list_critical)
|
failure += self.checkExists(self.key_list_critical)
|
||||||
return failure
|
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):
|
def checkMetrics(self):
|
||||||
"""Return a Nagios specific performance metrics string given keys
|
"""Return a Nagios specific performance metrics string given keys
|
||||||
and parameter definitions"""
|
and parameter definitions"""
|
||||||
@ -403,6 +409,10 @@ def parseArgs():
|
|||||||
dest='key_value_list_critical', nargs='*',
|
dest='key_value_list_critical', nargs='*',
|
||||||
help='''Same as -q but return critical if
|
help='''Same as -q but return critical if
|
||||||
equality check fails.''')
|
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='*',
|
parser.add_argument('-m', '--key_metric', dest='metric_list', nargs='*',
|
||||||
help='''Gathers the values of these keys (key[>alias],
|
help='''Gathers the values of these keys (key[>alias],
|
||||||
UnitOfMeasure,WarnRange,CriticalRange,Min,Max) for
|
UnitOfMeasure,WarnRange,CriticalRange,Min,Max) for
|
||||||
@ -646,6 +656,7 @@ if __name__ == "__main__":
|
|||||||
nagios.append_warning(processor.checkWarning())
|
nagios.append_warning(processor.checkWarning())
|
||||||
nagios.append_critical(processor.checkCritical())
|
nagios.append_critical(processor.checkCritical())
|
||||||
nagios.append_metrics(processor.checkMetrics())
|
nagios.append_metrics(processor.checkMetrics())
|
||||||
|
nagios.append_unknown(processor.checkUnknown())
|
||||||
# Print Nagios specific string and exit appropriately
|
# Print Nagios specific string and exit appropriately
|
||||||
print nagios.getMessage()
|
print nagios.getMessage()
|
||||||
exit(nagios.getCode())
|
exit(nagios.getCode())
|
||||||
|
Loading…
Reference in New Issue
Block a user