diff --git a/main.py b/main.py index 33609db..8439351 100644 --- a/main.py +++ b/main.py @@ -49,4 +49,16 @@ object Host "{hostname}" {{ address = "{address}" check_command = "hostalive" }}'''.format(hostname=hostname,address=obj["address"]) + print(template) + +for hostname,obj in config["service"].items(): + template = r''' +object Service "{service}" {{ + import "generic-service" + host_name = "{hostname}" + check_command = "{command}" + check_interval = {check_interval}m + retry_interval = {retry_interval}m +}}'''.format(hostname=hostname, service=obj["service_description"], check_interval=int(float(obj["check_interval"])), + retry_interval=int(float(obj["retry_interval"])),command=obj["check_command"]) print(template) \ No newline at end of file