From b5305b5cad5cbb0a2c072b29f2d4dc05126c39d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sun, 8 Jul 2018 21:51:30 +0200 Subject: Add postgresql monitoring --- modules/profile/manifests/postgresql/backup_dump.pp | 9 +++++++++ modules/profile/manifests/postgresql/backup_pgbouncer.pp | 10 ++++++++++ modules/profile/manifests/postgresql/master.pp | 10 ++++++++++ modules/profile/manifests/postgresql/ssl.pp | 1 + 4 files changed, 30 insertions(+) (limited to 'modules/profile/manifests/postgresql') diff --git a/modules/profile/manifests/postgresql/backup_dump.pp b/modules/profile/manifests/postgresql/backup_dump.pp index 53fb20e..5e469c5 100644 --- a/modules/profile/manifests/postgresql/backup_dump.pp +++ b/modules/profile/manifests/postgresql/backup_dump.pp @@ -57,4 +57,13 @@ define profile::postgresql::backup_dump ( }, ] } + + @profile::monitoring::local_service { "Last postgresql dump in $pg_backup_path is not too old": + sudos => { + "naemon-postgresql-dumps" => "naemon ALL=($pg_user) NOPASSWD: /usr/bin/find $pg_backup_path -mindepth 1 -maxdepth 1 -printf %T@\\n", + } + local => { + check_command => "check_last_file_date!$pg_backup_path!10!$pg_user" + } + } } diff --git a/modules/profile/manifests/postgresql/backup_pgbouncer.pp b/modules/profile/manifests/postgresql/backup_pgbouncer.pp index 45b8ed5..c82eefd 100644 --- a/modules/profile/manifests/postgresql/backup_pgbouncer.pp +++ b/modules/profile/manifests/postgresql/backup_pgbouncer.pp @@ -48,6 +48,16 @@ define profile::postgresql::backup_pgbouncer ( content => "${pg_infos[pgbouncer_dbname]} = host=$pg_path$pg_port user=${pg_infos[dbuser]} dbname=${pg_infos[dbname]}", } + # FIXME: current pam configuration requires password for postgres + # @profile::monitoring::local_service { "Database ${pg_infos[pgbouncer_dbname]} is available in pgbouncer": + # sudos => { + # "naemon-postgresql-database-public" => "naemon ALL=(postgres) NOPASSWD: /usr/bin/psql -c select\ nspname\ from\ pg_catalog.pg_namespace ${pg_infos[pgbouncer_dbname]}" + # }, + # local => { + # check_command => "check_command_output!psql -c 'select nspname from pg_catalog.pg_namespace' ${pg_infos[pgbouncer_dbname]}!public!-r postgres", + # } + # } + # pg_hba for accessed cluster postgresql::server::pg_hba_rule { "$pg_backup_host - local access as ${pg_infos[dbuser]} user": description => "Allow local access to ${pg_infos[dbuser]} user", diff --git a/modules/profile/manifests/postgresql/master.pp b/modules/profile/manifests/postgresql/master.pp index 02315a6..e775eb4 100644 --- a/modules/profile/manifests/postgresql/master.pp +++ b/modules/profile/manifests/postgresql/master.pp @@ -59,5 +59,15 @@ define profile::postgresql::master ( handle_slot => true, add_self_role => true, } + + @profile::monitoring::local_service { "Postgresql replication for $backup_host is up to date": + sudos => { + "naemon-postgresql-replication-$backup_host" => "naemon ALL=(postgres) NOPASSWD: /etc/naemon/monitoring-plugins/check_postgres_replication $backup_host /run/postgresql 5432" + + }, + local => { + check_command => "check_postgresql_replication!$backup_host!/run/postgresql/!5432", + } + } } } diff --git a/modules/profile/manifests/postgresql/ssl.pp b/modules/profile/manifests/postgresql/ssl.pp index dc56c0b..9b0a95c 100644 --- a/modules/profile/manifests/postgresql/ssl.pp +++ b/modules/profile/manifests/postgresql/ssl.pp @@ -79,4 +79,5 @@ define profile::postgresql::ssl ( } } + # FIXME: add monitoring for ssl } -- cgit v1.2.3 From 2742958fd69c91c442685be62140f1e29e363b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 10 Jul 2018 12:31:32 +0200 Subject: Move todos to readme.md and add first documentation --- modules/profile/manifests/postgresql/backup_pgbouncer.pp | 2 +- modules/profile/manifests/postgresql/ssl.pp | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'modules/profile/manifests/postgresql') diff --git a/modules/profile/manifests/postgresql/backup_pgbouncer.pp b/modules/profile/manifests/postgresql/backup_pgbouncer.pp index c82eefd..5fd7861 100644 --- a/modules/profile/manifests/postgresql/backup_pgbouncer.pp +++ b/modules/profile/manifests/postgresql/backup_pgbouncer.pp @@ -48,7 +48,7 @@ define profile::postgresql::backup_pgbouncer ( content => "${pg_infos[pgbouncer_dbname]} = host=$pg_path$pg_port user=${pg_infos[dbuser]} dbname=${pg_infos[dbname]}", } - # FIXME: current pam configuration requires password for postgres + # Current pam configuration requires password for postgres # @profile::monitoring::local_service { "Database ${pg_infos[pgbouncer_dbname]} is available in pgbouncer": # sudos => { # "naemon-postgresql-database-public" => "naemon ALL=(postgres) NOPASSWD: /usr/bin/psql -c select\ nspname\ from\ pg_catalog.pg_namespace ${pg_infos[pgbouncer_dbname]}" diff --git a/modules/profile/manifests/postgresql/ssl.pp b/modules/profile/manifests/postgresql/ssl.pp index 9b0a95c..b809a9d 100644 --- a/modules/profile/manifests/postgresql/ssl.pp +++ b/modules/profile/manifests/postgresql/ssl.pp @@ -78,6 +78,4 @@ define profile::postgresql::ssl ( content => "ssl = on\nssl_key_file = '$ssl_key'\nssl_cert_file = '$ssl_cert'\n" } } - - # FIXME: add monitoring for ssl } -- cgit v1.2.3 From a0df248a2be61557b8a67c3d6e4df24dc3e7843e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 10 Jul 2018 12:36:52 +0200 Subject: Add monitoring for etherpad --- modules/profile/manifests/postgresql/master.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/profile/manifests/postgresql') diff --git a/modules/profile/manifests/postgresql/master.pp b/modules/profile/manifests/postgresql/master.pp index e775eb4..99ac4c4 100644 --- a/modules/profile/manifests/postgresql/master.pp +++ b/modules/profile/manifests/postgresql/master.pp @@ -66,7 +66,7 @@ define profile::postgresql::master ( }, local => { - check_command => "check_postgresql_replication!$backup_host!/run/postgresql/!5432", + check_command => "check_postgresql_replication!$backup_host!/run/postgresql!5432", } } } -- cgit v1.2.3 From bff7d1b743bc2239d7ce7ced37dd03e4e846c03d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 10 Jul 2018 10:45:04 +0200 Subject: Add monitoring for backup --- modules/profile/manifests/postgresql/backup_dump.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/profile/manifests/postgresql') diff --git a/modules/profile/manifests/postgresql/backup_dump.pp b/modules/profile/manifests/postgresql/backup_dump.pp index 5e469c5..5f456ed 100644 --- a/modules/profile/manifests/postgresql/backup_dump.pp +++ b/modules/profile/manifests/postgresql/backup_dump.pp @@ -60,10 +60,10 @@ define profile::postgresql::backup_dump ( @profile::monitoring::local_service { "Last postgresql dump in $pg_backup_path is not too old": sudos => { - "naemon-postgresql-dumps" => "naemon ALL=($pg_user) NOPASSWD: /usr/bin/find $pg_backup_path -mindepth 1 -maxdepth 1 -printf %T@\\n", - } + "naemon-postgresql-dumps-$pg_host" => "naemon ALL=($pg_user) NOPASSWD: /usr/bin/find $pg_backup_path -mindepth 1 -maxdepth 1 -printf %T@?n", + }, local => { - check_command => "check_last_file_date!$pg_backup_path!10!$pg_user" + check_command => "check_last_file_date!$pg_backup_path!10!$pg_user", } } } -- cgit v1.2.3 From d8bc769648c1528f5d749deee060d70e326ef431 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Wed, 11 Jul 2018 09:11:42 +0200 Subject: Monitor rsync backups --- modules/profile/manifests/postgresql/backup_dump.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/profile/manifests/postgresql') diff --git a/modules/profile/manifests/postgresql/backup_dump.pp b/modules/profile/manifests/postgresql/backup_dump.pp index 5f456ed..e247cf0 100644 --- a/modules/profile/manifests/postgresql/backup_dump.pp +++ b/modules/profile/manifests/postgresql/backup_dump.pp @@ -63,7 +63,7 @@ define profile::postgresql::backup_dump ( "naemon-postgresql-dumps-$pg_host" => "naemon ALL=($pg_user) NOPASSWD: /usr/bin/find $pg_backup_path -mindepth 1 -maxdepth 1 -printf %T@?n", }, local => { - check_command => "check_last_file_date!$pg_backup_path!10!$pg_user", + check_command => "check_last_file_date!$pg_backup_path!7!$pg_user", } } } -- cgit v1.2.3