bundles/icinga2: add hostgroup for every bw group
Some checks failed
bundlewrap/pipeline/head There was a failure building this commit
Some checks failed
bundlewrap/pipeline/head There was a failure building this commit
This commit is contained in:
parent
12cf03e03f
commit
0bc4b5439c
3 changed files with 22 additions and 2 deletions
7
bundles/icinga2/files/icinga2/groups.conf
Normal file
7
bundles/icinga2/files/icinga2/groups.conf
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
% for group in sorted(repo.groups):
|
||||||
|
object HostGroup "group-${group.name}" {
|
||||||
|
display_name = "bw group ${group.name}"
|
||||||
|
|
||||||
|
assign where "${group.name}" in host.vars.bw_groups
|
||||||
|
}
|
||||||
|
% endfor
|
|
@ -2,10 +2,13 @@
|
||||||
object Host "${monitored_node.name}" {
|
object Host "${monitored_node.name}" {
|
||||||
import "generic-host"
|
import "generic-host"
|
||||||
|
|
||||||
vars.os = "Linux"
|
address = "${monitored_node.metadata.get('icinga_options', {}).get('hostname', monitored_node.hostname)}"
|
||||||
|
|
||||||
|
vars.os = "${monitored_node.os}"
|
||||||
vars.sla = "${monitored_node.metadata.get('sla', '24x7')}"
|
vars.sla = "${monitored_node.metadata.get('sla', '24x7')}"
|
||||||
vars.period = "${sla_info[monitored_node.metadata.get('sla', '24x7')]}"
|
vars.period = "${sla_info[monitored_node.metadata.get('sla', '24x7')]}"
|
||||||
address = "${monitored_node.metadata.get('icinga_options', {}).get('hostname', monitored_node.hostname)}"
|
vars.location = "${monitored_node.metadata.get('location', 'unknown')}"
|
||||||
|
vars.bw_groups = [ "${'", "'.join(sorted({group.name for group in monitored_node.groups}))}" ]
|
||||||
}
|
}
|
||||||
% endfor
|
% endfor
|
||||||
|
|
||||||
|
|
|
@ -129,6 +129,16 @@ files = {
|
||||||
'svc_systemd:icinga2:restart',
|
'svc_systemd:icinga2:restart',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'/etc/icinga2/conf.d/groups.conf': {
|
||||||
|
'source': 'icinga2/groups.conf',
|
||||||
|
'content_type': 'mako',
|
||||||
|
'needs': {
|
||||||
|
'pkg_apt:icinga2',
|
||||||
|
},
|
||||||
|
'triggers': {
|
||||||
|
'svc_systemd:icinga2:restart',
|
||||||
|
},
|
||||||
|
},
|
||||||
'/etc/icinga2/conf.d/templates.conf': {
|
'/etc/icinga2/conf.d/templates.conf': {
|
||||||
'source': 'icinga2/templates.conf',
|
'source': 'icinga2/templates.conf',
|
||||||
'needs': {
|
'needs': {
|
||||||
|
|
Loading…
Reference in a new issue