summaryrefslogtreecommitdiff
path: root/manifests/nagios_plugin/duplicity.pp
blob: 7dbd2633caf247a72c432b20b127dec4de88e198 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
class backupninja::nagios_plugin::duplicity {
  case $::operatingsystem {
    'Debian': { package { 'python-argparse': ensure => installed, } }
    'Ubuntu': { package { 'python-argh':     ensure => installed, } }
    default:  {
      notify {'Backupninja-Duplicity Nagios check needs python-argparse to be installed !':}  }
  }

  file { '/usr/lib/nagios/plugins/check_backupninja_duplicity.py':
    source => 'puppet:///modules/backupninja/nagios_plugins/duplicity/check_backupninja_duplicity.py',
    mode   => '0755',
    owner  => 'nagios',
    group  => 'nagios',
  }

  # deploy helper script
  file { '/usr/lib/nagios/plugins/backupninja_duplicity_freshness.sh':
    source => 'puppet:///modules/backupninja/nagios_plugins/duplicity/backupninja_duplicity_freshness.sh',
    mode   => '0755',
    owner  => 'nagios',
    group  => 'nagios',
  }

  nagios::nrpe::command { 'check_backupninja_duplicity':
    command_line => "sudo ${::nagios::nrpe::nagios_plugin_dir}/check_backupninja_duplicity.py"
  }
  sudo::spec {'nrpe_check_backupninja_duplicity':
      ensure    => present,
      users     => 'nagios',
      hosts     => 'ALL',
      commands  => "NOPASSWD: ${::nagios::nrpe::nagios_plugin_dir}/check_backupninja_duplicity.py";
  }

  nagios::service { "Backupninja Duplicity $::fqdn":
    use_nrpe              => true,
    check_command         => 'check_backupninja_duplicity',
    nrpe_timeout          => '60',
    # check only twice a day
    normal_check_interval => '720',
    # recheck every hour
    retry_check_interval  => '60',
  }


}