This commit is contained in:
2022-03-11 14:40:08 +01:00
parent d27f74f7d1
commit c7af52abe7

12
main.py
View File

@@ -50,3 +50,15 @@ object Host "{hostname}" {{
check_command = "hostalive" check_command = "hostalive"
}}'''.format(hostname=hostname,address=obj["address"]) }}'''.format(hostname=hostname,address=obj["address"])
print(template) 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)