diff --git a/check_opnsense_traffic_for_host.py b/check_opnsense_traffic_for_host.py index 51f2199..01c3969 100755 --- a/check_opnsense_traffic_for_host.py +++ b/check_opnsense_traffic_for_host.py @@ -88,6 +88,9 @@ def main(): if response.status_code != 200: print(f'UNKNOWN: unable to query OPNsense API for {interface}: {response.status_code}\n{response.text}') sys.exit(nagios.UNKNOWN) + if isinstance(response.json(), list): + print(F'UNKNOWN - OPNsense returned wrong datatype:\n{response.json()}') + for item in response.json().get(interface, {}).get('records', False): if item['address'] == args.host: traffic_data.append(item)