check_vllm: fix

This commit is contained in:
Cyberes 2023-09-20 15:26:43 -06:00
parent 45087f3299
commit e1fe37a175
1 changed files with 22 additions and 26 deletions

View File

@ -48,11 +48,7 @@ def main(critical, warning, timeout, target_url, does_not_contain, verify):
text_result = f"failed with status code {response.status_code}\n{response.text}"
exit_code = nagios.STATE_CRIT
else:
if not json_data.get('text'):
text_result = f"did not receive valid JSON\n{response.text}"
exit_code = nagios.STATE_CRIT
else:
if not len(json_data['text']):
if not json_data.get('text') or not len(json_data['text']):
text_result = f"did not receive valid JSON\n{response.text}"
exit_code = nagios.STATE_CRIT
else: