drewkerrigan / nagios-http-json

A generic plugin for Nagios which checks json values from a given HTTP endpoint against argument specified rules and determines the status and performance data for that service.
Other
67 stars 60 forks source link

Parse JSON on HTTPError, if JSON in response #60

Closed martialblog closed 4 years ago

martialblog commented 4 years ago

I tried to refactor this PR https://github.com/drewkerrigan/nagios-http-json/pull/47 to include the wanted functionality.

Refactors:

New:

        if e.info().get_content_subtype() == "json":
            json_data = e.read()

I'm not 100% certain this is the best solution... There might be some changes before merging this.

martialblog commented 4 years ago

@drewkerrigan I'd love your feedback on this. Cheers, Markus