mirror of
https://github.com/FAUSheppy/athq-vm-management
synced 2025-12-06 05:41:35 +01:00
feat: generate icinga2 service conf for async
This commit is contained in:
@@ -82,3 +82,9 @@ def createBackupScriptStructure(backupList, baseDomain=""):
|
||||
ansibleFilename = "./ansible/files/async-icinga-config-dynamic.json"
|
||||
with open(ansibleFilename, "w") as f:
|
||||
f.write(json.dumps(asyncIcingaConf))
|
||||
|
||||
# write async icinga services in ansible #
|
||||
ansibleFilename = "./ansible/files/async-icinga-services-dynamic.conf"
|
||||
icingaServiceTemplate = environment.get_template("async-icinga-services-dynamic.conf.j2")
|
||||
with open(ansibleFilename, "w") as f:
|
||||
f.write(icingaServiceTemplate.render(asyncIcingaConf=asyncIcingaConf))
|
||||
|
||||
33
templates/async-icinga-services-dynamic.conf.j2
Normal file
33
templates/async-icinga-services-dynamic.conf.j2
Normal file
@@ -0,0 +1,33 @@
|
||||
object Host "AsyncIcinga" {
|
||||
|
||||
import "generic-host"
|
||||
|
||||
address = "localhost"
|
||||
name = "async_icinga"
|
||||
vars.async = "true"
|
||||
vars.linux = "true"
|
||||
|
||||
vars.ssl_address = "async-icinga.atlantishq.de"
|
||||
vars.ssl_port = "443"
|
||||
|
||||
check_command = "http"
|
||||
|
||||
max_check_attempts = 5
|
||||
retry_interval = 1m
|
||||
|
||||
vars.notification["mail"] = {
|
||||
groups = ["icingaadmins"]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{% for service in asyncIcingaConf.keys() %}
|
||||
apply Service "{{ service }}" {
|
||||
import "generic-service"
|
||||
check_command = "gateway"
|
||||
vars.protocol = "https"
|
||||
vars.host = "async-icinga.atlantishq.de"
|
||||
vars.service_name = "{{ service }}"
|
||||
assign where host.name == "async_icinga"
|
||||
}
|
||||
{% endfor %}
|
||||
Reference in New Issue
Block a user