From bc1854aa2597e23dce147b10cad6b394395b59b7 Mon Sep 17 00:00:00 2001 From: Ahmad Bilal Khalid Date: Sat, 20 Jul 2019 20:18:23 +0500 Subject: [PATCH] check whether arg hostname exists or not --- main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.py b/main.py index 2c0086f..6d28b4e 100644 --- a/main.py +++ b/main.py @@ -222,6 +222,10 @@ def main(): args = argparser.parse_args() host = client.get(args.hostname, value_in_json=True) + if not host: + print("No Such Host") + exit(1) + host.value["status"] = "ALIVE" host.value["last_heartbeat"] = datetime.utcnow().isoformat()