From 0eaf0a1eaa03d972acf3c6ec2c49684687a1d1d0 Mon Sep 17 00:00:00 2001 From: Dennis Wallberg Date: Wed, 22 Apr 2015 14:38:07 +0200 Subject: added template --- .../etc/puppet/modules/sunet/templates/nagioshost/check_uptime.pl.erb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'global') diff --git a/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_uptime.pl.erb b/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_uptime.pl.erb index dda05e4..d52eeec 100755 --- a/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_uptime.pl.erb +++ b/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_uptime.pl.erb @@ -1,3 +1,5 @@ +<%# check_uptime.pl %> + #!/usr/bin/perl -w # # ============================== SUMMARY ===================================== -- cgit v1.1 From c06ea0f096b30fdf1b83a0d9b7f72077f067b436 Mon Sep 17 00:00:00 2001 From: Dennis Wallberg Date: Wed, 22 Apr 2015 14:44:14 +0200 Subject: added nagioshost to docker --- global/overlay/etc/puppet/manifests/cosmos-site.pp | 1 + 1 file changed, 1 insertion(+) (limited to 'global') diff --git a/global/overlay/etc/puppet/manifests/cosmos-site.pp b/global/overlay/etc/puppet/manifests/cosmos-site.pp index e471544..410b957 100644 --- a/global/overlay/etc/puppet/manifests/cosmos-site.pp +++ b/global/overlay/etc/puppet/manifests/cosmos-site.pp @@ -163,6 +163,7 @@ node 'datasets.sunet.se' { } node 'docker.sunet.se' { + class { 'nagioshost': } docker::image {'registry': } docker::image {'leifj/pound': } docker::run {'sunetregistry': -- cgit v1.1 From 9a6c9b342db6b00f2786edca1d974540a766b1cf Mon Sep 17 00:00:00 2001 From: Dennis Wallberg Date: Wed, 22 Apr 2015 14:58:29 +0200 Subject: nagios configuration update --- global/overlay/etc/puppet/manifests/cosmos-site.pp | 37 +--------------------- .../etc/puppet/modules/sunet/manifests/nagios.pp | 34 ++++++++++++++++++++ 2 files changed, 35 insertions(+), 36 deletions(-) (limited to 'global') diff --git a/global/overlay/etc/puppet/manifests/cosmos-site.pp b/global/overlay/etc/puppet/manifests/cosmos-site.pp index 480eacf..c7bc59c 100644 --- a/global/overlay/etc/puppet/manifests/cosmos-site.pp +++ b/global/overlay/etc/puppet/manifests/cosmos-site.pp @@ -50,41 +50,6 @@ class mailclient ($domain) { cosmos::preseed::preseed_package {"postfix": ensure => present, domain => $domain} } -class nagioshost { - - $nagios_ip_v4 = hiera('nagios_ip_v4', '109.105.111.111') - $nagios_ip_v6 = hiera('nagios_ip_v6', '2001:948:4:6::111') - $allowed_hosts = "${nagios_ip_v4},${nagios_ip_v6}" - - package {'nagios-nrpe-server': - ensure => 'installed', - } -> - file { "/etc/nagios/nrpe.cfg" : - ensure => 'file', - mode => '0640', - group => 'nagios', - content => template('sunet/nagioshost/nrpe.cfg.erb'), - } -> - file { "/usr/lib/nagios/plugins/check_uptime.pl" : - ensure => 'file', - mode => '0640', - group => 'nagios', - content => template('sunet/nagioshost/check_uptime.pl.erb'), - } -> - ufw::allow { "allow-nrpe-v4": - from => "${nagios_ip_v4}", - ip => 'any', - proto => 'tcp', - port => 5666 - } -> - ufw::allow { "allow-nrpe-v6": - from => "${nagios_ip_v6}", - ip => 'any', - proto => 'tcp', - port => 5666 - } -} - node 'sto-tug-kvm1.swamid.se' { package {'python-vm-builder': @@ -163,7 +128,7 @@ node 'datasets.sunet.se' { } node 'docker.sunet.se' { - class { 'nagioshost': } + class { 'sunet::nagios': } docker::image {'registry': } docker::image {'leifj/pound': } docker::run {'sunetregistry': diff --git a/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp b/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp index 58a10bc..6b7d836 100644 --- a/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp +++ b/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp @@ -1,3 +1,37 @@ class sunet::nagios { + $nagios_ip_v4 = hiera('nagios_ip_v4', '109.105.111.111') + $nagios_ip_v6 = hiera('nagios_ip_v6', '2001:948:4:6::111') + $allowed_hosts = "${nagios_ip_v4},${nagios_ip_v6}" + + package {'nagios-nrpe-server': + ensure => 'installed', + } -> + service {'nagios-nrpe-server': + ensure => 'running' + } -> + file { "/etc/nagios/nrpe.cfg" : + ensure => 'file', + mode => '0640', + group => 'nagios', + content => template('sunet/nagioshost/nrpe.cfg.erb'), + } -> + file { "/usr/lib/nagios/plugins/check_uptime.pl" : + ensure => 'file', + mode => '0640', + group => 'nagios', + content => template('sunet/nagioshost/check_uptime.pl.erb'), + } -> + ufw::allow { "allow-nrpe-v4": + from => "${nagios_ip_v4}", + ip => 'any', + proto => 'tcp', + port => 5666 + } -> + ufw::allow { "allow-nrpe-v6": + from => "${nagios_ip_v6}", + ip => 'any', + proto => 'tcp', + port => 5666 + } } -- cgit v1.1 From bb0e5333540a0fddc8946cee37fde6f317403dd5 Mon Sep 17 00:00:00 2001 From: Dennis Wallberg Date: Wed, 22 Apr 2015 15:37:31 +0200 Subject: added some default nrpe checks --- .../overlay/etc/puppet/modules/sunet/templates/nagioshost/nrpe.cfg.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'global') diff --git a/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/nrpe.cfg.erb b/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/nrpe.cfg.erb index 348aa93..960dd61 100644 --- a/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/nrpe.cfg.erb +++ b/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/nrpe.cfg.erb @@ -236,7 +236,8 @@ command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20 command[check_root]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p / command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200 - +command[check_uptime]=/usr/lib/nagios/plugins/check_uptime.pl -f +command[check_reboot]=/usr/lib/nagios/plugins/check_reboot # The following examples allow user-supplied arguments and can # only be used if the NRPE daemon was compiled with support for -- cgit v1.1 From 5a10e87213b5d83209c4f25544fd186bcff9790d Mon Sep 17 00:00:00 2001 From: Dennis Wallberg Date: Wed, 22 Apr 2015 15:49:01 +0200 Subject: nrpe plugin permission + fixes --- global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp | 2 +- .../etc/puppet/modules/sunet/templates/nagioshost/check_uptime.pl.erb | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'global') diff --git a/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp b/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp index 6b7d836..b05100e 100644 --- a/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp +++ b/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp @@ -18,7 +18,7 @@ class sunet::nagios { } -> file { "/usr/lib/nagios/plugins/check_uptime.pl" : ensure => 'file', - mode => '0640', + mode => '0751', group => 'nagios', content => template('sunet/nagioshost/check_uptime.pl.erb'), } -> diff --git a/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_uptime.pl.erb b/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_uptime.pl.erb index d52eeec..e599218 100755 --- a/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_uptime.pl.erb +++ b/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_uptime.pl.erb @@ -1,5 +1,4 @@ <%# check_uptime.pl %> - #!/usr/bin/perl -w # # ============================== SUMMARY ===================================== -- cgit v1.1