diff options
author | Dennis Wallberg <dennis@nordu.net> | 2015-04-22 16:13:19 +0200 |
---|---|---|
committer | Dennis Wallberg <dennis@nordu.net> | 2015-04-22 16:13:19 +0200 |
commit | 877abf0d9b4f0b05425f82bb648d7f9c2215c3fa (patch) | |
tree | 1fffaf45a3fabb53c8a59f3e3f8005b21be90a74 /global | |
parent | a60382a9ef96e350036c693ddf7b6be3ec5083fd (diff) |
typo
Diffstat (limited to 'global')
-rw-r--r-- | global/overlay/etc/puppet/modules/sunet/manifests/nagios.pp | 7 | ||||
-rwxr-xr-x | global/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_reboot.erb | 37 |
2 files changed, 44 insertions, 0 deletions
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; + |