aboutsummaryrefslogtreecommitdiff
path: root/personal_infra/puppet/site/pg.h1.int.pdp7.net.pp
blob: 7256501ef84ccc3f20f403c602ac0e8bcdc3daf5 (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
node 'pg.h1.int.pdp7.net' {
  class {'postgres':
    pg_hba_conf => @(EOT)
      # TYPE  DATABASE        USER            ADDRESS                   METHOD
      # "local" is for Unix domain socket connections only
      local   all             all                                       peer
      host    weight          k8s_prod        k8s-prod.h1.int.pdp7.net  trust
      host    weight          grafana         grafana.h1.int.pdp7.net   trust
      host    weight          nagios          nagios.h1.int.pdp7.net    trust
      host    miniflux        miniflux        miniflux.h1.int.pdp7.net  trust
      host    nextcloud       nextcloud       nextcloud.h1.int.pdp7.net trust
      host    takahe          k8s_test        k8s-test.h1.int.pdp7.net  trust
      | EOT
    ,
  }

  package {'postgresql15-contrib':} # hstore for miniflux

  nagios_service {'medication':
    use => 'generic-service',
    service_description => 'medication',
    host_name => 'pg.h1.int.pdp7.net',
    check_command => 'check_medication',
    require => Package['nagios'],
    notify => Service['nagios'],
    owner => 'nagios',
  }

  service {'nagios':}
  package {'nagios':
    ensure => absent,
  }

  nagios_command {'check_medication':
    command_name => 'check_medication',
    command_line => '/usr/lib64/nagios/plugins/check_pgsql -H $HOSTADDRESS$ -l nagios -d weight -q "select extract(epoch from now() - max(taken_at)) / 60 / 60 from weight.pressure_medication" -W 24 -C 25',
    require => Package['nagios'],
    notify => Service['nagios'],
    owner => 'nagios',
  }
}