first attempt at creating extra_host_groups

This commit is contained in:
Rikard Danielsson 2025-03-13 12:15:34 +01:00
parent f87fac3c3b
commit 26ea8e8e8d
Signed by untrusted user: richir
GPG key ID: 584D2AA2FA669135
2 changed files with 17 additions and 0 deletions

View file

@ -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']
}
}

View file

@ -0,0 +1,8 @@
<% @extra_host_groups.each do |group, members| -%>
# <%= group -%>
define hostgroup {
hostgroup_name <%= group -%>
alias <%= group -%>
members <%= members -%>
}
<% end -%>