drewkerrigan/nagios-http-json

Unknown message handler fails with reference to `critical_message`

Closed this issue · 1 comments

Looks like a copy-paste error here. The NagiosHelper.append_unknown() function takes an argument of unknown_message but tries to append critical_message to self.critical_message

One way that this is reproducible by passing a path that would return a 404:

Console 1

$ python -m SimpleHTTPServer
localhost.localdomain - - [19/Dec/2017 14:03:42] code 404, message File not found
localhost.localdomain - - [19/Dec/2017 14:03:42] "GET /management/health HTTP/1.1" 404 -

Console 2

$ ./check_http_json.py -H localhost:8000 -p management/health -q status,UP -f _ -d
Traceback (most recent call last):
  File "./check_http_json.py", line 421, in <module>
    nagios.append_unknown("HTTPError[%s], url:%s" % (str(e.code), url))
  File "./check_http_json.py", line 59, in append_unknown
    self.critical_message += critical_message
NameError: global name 'critical_message' is not defined

My apologies. Looks like this was fixed already