diff --git a/manifests/sitemonitornaemon.pp b/manifests/sitemonitornaemon.pp index 55fc404..cf0b62d 100644 --- a/manifests/sitemonitornaemon.pp +++ b/manifests/sitemonitornaemon.pp @@ -11,6 +11,9 @@ class sunetdrive::sitemonitornaemon() { $environment = sunetdrive::get_environment() $influx_passwd = safe_hiera('influx_passwd') $slack_url = safe_hiera('slack_url') + $extra_host_groups = { + node3_hosts => join($facts['configured_hosts_in_cosmos']['all'].filter |$host| { $host =~ /^node3\./ }, ',') + } file { '/usr/local/bin/slack_nagios.sh': ensure => present, @@ -45,6 +48,11 @@ class sunetdrive::sitemonitornaemon() { content => template('sunetdrive/monitor/sunetdrive_thruk_templates.conf.erb'), mode => '0644', } + file { '/etc/naemon/conf.d/sunetdrive_extra_hostgroups.cfg': + ensure => present, + content => template('sunetdrive/monitor/sunetdrive_extra_hostgroups.cfg.erb'), + mode => '0644', + } nagioscfg::service {'check_scriptherder': hostgroup_name => ['sunetdrive::nrpe'], check_command => 'check_nrpe_1arg_to300!check_scriptherder', @@ -105,5 +113,6 @@ class sunetdrive::sitemonitornaemon() { description => 'S3 buckets with multiple Nextcloud mounts', contact_groups => ['alerts'] } + } diff --git a/templates/monitor/sunetdrive_extra_hostgroups.cfg.erb b/templates/monitor/sunetdrive_extra_hostgroups.cfg.erb new file mode 100644 index 0000000..246bc21 --- /dev/null +++ b/templates/monitor/sunetdrive_extra_hostgroups.cfg.erb @@ -0,0 +1,8 @@ +<% @extra_host_groups.each do |group, members| -%> +# <%= group -%> +define hostgroup { + hostgroup_name <%= group -%> + alias <%= group -%> + members <%= members -%> +} +<% end -%>