You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am struggling to figure out how to use multiple keys and their value lookups in one plugin call using a wildcard operator.
From the documentation description it seems possible:
-q ... Checks equality of these keys and values (key[>alias],value key2,value2) to determine status.
And in an example:
Data for keys of all items in a list (*).capacity.value:
I obviously want to monitor the status key of each service.
But running the plugin against it using a wildcard does not work:
$ ./check_http_json.py -H api.example.com -s -p "_healthcheck" -q '(*).status,True'
Traceback (most recent call last):
File "/home/ckadm/Git/nagios-http-json/./check_http_json.py", line 672, in <module>
main(sys.argv[1:])
File "/home/ckadm/Git/nagios-http-json/./check_http_json.py", line 660, in main
nagios.append_message(WARNING_CODE, processor.checkWarning())
File "/home/ckadm/Git/nagios-http-json/./check_http_json.py", line 338, in checkWarning
failure += self.checkEquality(self.key_value_list)
File "/home/ckadm/Git/nagios-http-json/./check_http_json.py", line 269, in checkEquality
if not self.helper.equals(key, v):
File "/home/ckadm/Git/nagios-http-json/./check_http_json.py", line 129, in equals
return self.exists(key) and \
File "/home/ckadm/Git/nagios-http-json/./check_http_json.py", line 145, in exists
return (self.get(key) != (None, 'not_found'))
File "/home/ckadm/Git/nagios-http-json/./check_http_json.py", line 164, in get
return self.getSubArrayElement(key, data)
File "/home/ckadm/Git/nagios-http-json/./check_http_json.py", line 124, in getSubArrayElement
return self.get(remainingKey, data[index])
KeyError: 0
Adding each key manually into the plugin's -q parameter seems to work:
Hi there and thanks for the plugin,
I am struggling to figure out how to use multiple keys and their value lookups in one plugin call using a wildcard operator.
From the documentation description it seems possible:
And in an example:
I have the following JSON output:
I obviously want to monitor the
status
key of each service.But running the plugin against it using a wildcard does not work:
Adding each key manually into the plugin's
-q
parameter seems to work:But this (static definition of keys to be monitored) is obviously prone to error as the number of services can change in the JSON output.
Do you have an idea how to best solve this?
The text was updated successfully, but these errors were encountered: