From 877abf0d9b4f0b05425f82bb648d7f9c2215c3fa Mon Sep 17 00:00:00 2001 From: Dennis Wallberg Date: Wed, 22 Apr 2015 16:13:19 +0200 Subject: typo --- .../etc/puppet/modules/sunet/manifests/nagios.pp | 7 ++++ .../sunet/templates/nagioshost/check_reboot.erb | 37 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100755 global/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_reboot.erb (limited to 'global/overlay/etc') diff --git a/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp b/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp index c09679d..cbd47a0 100644 --- a/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp +++ b/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp @@ -27,6 +27,13 @@ class sunet::nagios { require => Package['nagios-nrpe-server'], content => template('sunet/nagioshost/check_uptime.pl.erb'), } -> + file { "/usr/lib/nagios/plugins/check_reboot" : + ensure => 'file', + mode => '0751', + group => 'nagios', + require => Package['nagios-nrpe-server'], + content => template('sunet/nagioshost/check_reboot'), + } -> ufw::allow { "allow-nrpe-v4": from => "${nagios_ip_v4}", ip => 'any', diff --git a/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_reboot.erb b/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_reboot.erb new file mode 100755 index 0000000..aa0bd5d --- /dev/null +++ b/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_reboot.erb @@ -0,0 +1,37 @@ +#!/bin/bash +declare -rx PROGNAME=${0##*/} +declare -rx PROGPATH=${0%/*}/ + +function cleanup { + #if [ -e "$TMPFILE" ] ; then + #rm "$TMPFILE" + #fi + exit $1 +} + +if [ -r "${PROGPATH}utils.sh" ] ; then + source "${PROGPATH}utils.sh" +else + echo "Can't find utils.sh." + printf "Currently being run from %s\n" "$PROGPATH" + # since we couldn't define STATE_UNKNOWN since reading utils.sh failed, we use 3 here but everywhere else after this use cleanup $STATE + cleanup 3 +fi + +STATE=$STATE_UNKNOWN + + +if [ -f /var/run/reboot-required.pkgs ] +then + pkg=`cat /var/run/reboot-required.pkgs` +fi + +if [ -f /var/run/reboot-required ] +then + echo "Reboot WARNING: System reboot required by package $pkg" + cleanup $STATE_WARNING; +fi + echo "Reboot OK: No reboot required" + cleanup $STATE_OK; +cleanup $STATE; + -- cgit v1.1 From 7242a1cf051cf6a73e47d9a9fb68ed6c6ae43778 Mon Sep 17 00:00:00 2001 From: Dennis Wallberg Date: Wed, 22 Apr 2015 16:14:24 +0200 Subject: added plugin --- global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'global/overlay/etc') diff --git a/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp b/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp index cbd47a0..48bf5ca 100644 --- a/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp +++ b/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp @@ -6,12 +6,12 @@ class sunet::nagios { package {'nagios-nrpe-server': ensure => 'installed', - } -> + } service {'nagios-nrpe-server': ensure => 'running', enable => 'true', require => Package['nagios-nrpe-server'], - } -> + } file { "/etc/nagios/nrpe.cfg" : notify => Service['nagios-nrpe-server'], ensure => 'file', @@ -19,27 +19,27 @@ class sunet::nagios { group => 'nagios', require => Package['nagios-nrpe-server'], content => template('sunet/nagioshost/nrpe.cfg.erb'), - } -> + } file { "/usr/lib/nagios/plugins/check_uptime.pl" : ensure => 'file', mode => '0751', group => 'nagios', require => Package['nagios-nrpe-server'], content => template('sunet/nagioshost/check_uptime.pl.erb'), - } -> + } file { "/usr/lib/nagios/plugins/check_reboot" : ensure => 'file', mode => '0751', group => 'nagios', require => Package['nagios-nrpe-server'], content => template('sunet/nagioshost/check_reboot'), - } -> + } 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', -- cgit v1.1 From 0008d057cde159d7039c5f93fe69d5b9f7ee6bfb Mon Sep 17 00:00:00 2001 From: Dennis Wallberg Date: Wed, 22 Apr 2015 16:17:46 +0200 Subject: typo fixed --- global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'global/overlay/etc') diff --git a/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp b/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp index 48bf5ca..91ccf6c 100644 --- a/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp +++ b/global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp @@ -32,7 +32,7 @@ class sunet::nagios { mode => '0751', group => 'nagios', require => Package['nagios-nrpe-server'], - content => template('sunet/nagioshost/check_reboot'), + content => template('sunet/nagioshost/check_reboot.erb'), } ufw::allow { "allow-nrpe-v4": from => "${nagios_ip_v4}", -- cgit v1.1