From ab02d473993000296c388027644253d5f25297ff Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Fri, 8 May 2015 15:27:02 -0400 Subject: Fix a few things related to nagios. * Default nagios service name changed to "backups-${name}" * Fix checkbackups cronjob command * Add parameters for checkbackups warn/crit levels * Update upgrade notice --- README | 12 ++++++++++++ manifests/init.pp | 3 ++- manifests/rdiff.pp | 2 +- manifests/rsync.pp | 2 +- manifests/server.pp | 12 ++++++------ 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/README b/README index 8deda94..42a8bfe 100644 --- a/README +++ b/README @@ -55,6 +55,18 @@ You will want to use the following resource: Otherwise your backups may be duplicated! +Changes to nagios integration +----------------------------- + +The default nagios passive service name has changed from "backups" to +"backups-${name}". If you want it to be automatically created on your +nagios host, you will need to set $backupninja::manage_nagios to true. +on the client. + +Use the following resource to remove the old "backups" passive service. + + nagios::service { 'backups': ensure => absent } + Getting started --------------- diff --git a/manifests/init.pp b/manifests/init.pp index dd9ee08..b7d3522 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -27,7 +27,8 @@ class backupninja ( $scriptdir = '/usr/share/backupninja', $libdir = '/usr/lib/backupninja', $usecolors = true, - $vservers = false + $vservers = false, + $manage_nagios = false, ) { # install client dependencies diff --git a/manifests/rdiff.pp b/manifests/rdiff.pp index 84fd0f3..4929d68 100644 --- a/manifests/rdiff.pp +++ b/manifests/rdiff.pp @@ -27,7 +27,7 @@ define backupninja::rdiff( $vsinclude = false, $keep = 30, $sshoptions = false, $options = '--force', $ssh_dir_manage = true, $ssh_dir = "${home}/.ssh", $authorized_keys_file = 'authorized_keys', $installuser = true, $keymanage = $backupninja::keymanage, $key = false, $backuptag = "backupninja-${::fqdn}", $backupkeytype = $backupninja::keytype, $backupkeystore = $backupninja::keystore, - $extras = false, $nagios_description = 'backups') + $extras = false, $nagios_description = "backups-${name}") { # install client dependencies ensure_resource('package', 'rdiff-backup', {'ensure' => $backupninja::ensure_rdiffbackup_version}) diff --git a/manifests/rsync.pp b/manifests/rsync.pp index ee49f81..af427bf 100644 --- a/manifests/rsync.pp +++ b/manifests/rsync.pp @@ -7,7 +7,7 @@ define backupninja::rsync( $ssh_dir_manage = true, $ssh_dir = "${home}/.ssh", $authorized_keys_file = 'authorized_keys', $installuser = true, $keymanage = $backupninja::keymanage, $key = false, $backuptag = "backupninja-${::fqdn}", $backupkeytype = $backupninja::keytype, $backupkeystore = $backupninja::keystore, $extras = false, - $nagios_description = 'backups', $subfolder = 'rsync', + $nagios_description = "backups-${name}", $subfolder = 'rsync', $log = false, $partition = false, $fscheck = false, $read_only = false, $mountpoint = false, $backupdir = false, $format = false, $days = false, diff --git a/manifests/server.pp b/manifests/server.pp index 94dd7c7..d76ddca 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -9,7 +9,9 @@ class backupninja::server ( $backupdir = '/backup', $backupdir_ensure = 'directory', $manage_nagios = false, - $nagios_server = undef + $nagios_server = undef, + $nagios_warn_level = 129600, + $nagios_crit_level = 216000, ) { group { "backupninjas": @@ -28,9 +30,7 @@ class backupninja::server ( if $manage_nagios { - if $nagios_server == undef { - fail('Cannot manage nagios with undefined nagios_server parameter!') - } + case $nagios_server { undef: { err('Cannot manage nagios without nagios_server parameter!') } } include nagios::nsca::client @@ -41,7 +41,7 @@ class backupninja::server ( } cron { checkbackups: - command => "/usr/local/bin/checkbackups -d $backupdir | /usr/sbin/send_nsca -H $nagios_server -c /etc/send_nsca.cfg | grep -v 'sent to host successfully'", + command => "/usr/local/bin/checkbackups -d ${backupdir} -s ${nagios_server} -w ${nagios_warn_level} -c ${nagios_crit_level} | grep -v 'sent to host successfully", user => "root", hour => "8-23", minute => 59, @@ -60,7 +60,7 @@ class backupninja::server ( $gid = "backupninjas", $backuptag = "backupninja-${::fqdn}", $nagios_description = 'backups') { - if $manage_nagios { + if $backupninja::manage_nagios { # configure a passive service check for backups nagios::service::passive { $nagios_description: } } -- cgit v1.2.3