]> xn--ix-yja.es Git - alex.git/commitdiff
Monitor medication
authoralex <alex@pdp7.net>
Sun, 22 Oct 2023 15:10:20 +0000 (17:10 +0200)
committeralex <alex@pdp7.net>
Sun, 22 Oct 2023 15:10:37 +0000 (17:10 +0200)
personal_infra/puppet/site/nagios.h1.int.pdp7.net.pp
personal_infra/puppet/site/pg.h1.int.pdp7.net.pp

index 6db53e62d5a5a9734765794defb19b913e0c7546..32e28f06864949b6e3d533c5917a63026ad575c8 100644 (file)
@@ -13,4 +13,6 @@ node 'nagios.h1.int.pdp7.net' {
       check_command => 'check-host-alive',
     }
   }
+
+  package {'nagios-plugins-pgsql':}
 }
index c61a20d1ebec57f9bc77dfa11662add96a1fa1f8..720f7f1a226218d291adae1a6044c5ae6fe49cb9 100644 (file)
@@ -7,6 +7,7 @@ node 'pg.h1.int.pdp7.net' {
       host    weight          k8s_prod        k8s-prod.h1.int.pdp7.net  trust
       host    weight          grafana         grafana.h2.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
       | EOT
@@ -14,4 +15,27 @@ node 'pg.h1.int.pdp7.net' {
   }
 
   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',
+  }
 }