From 1ab1166c1e2a93b17da9bb106f86d877afc8e709 Mon Sep 17 00:00:00 2001 From: Ludovic Cartier Date: Mon, 1 Jun 2026 17:30:19 +0200 Subject: [PATCH] pbs - put inventory_hostname by default --- README.md | 9 +++------ defaults/main.yml | 4 ++++ templates/nrpe.j2 | 6 ++---- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 6d3b6b7..1bdc137 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ The following checks are deployed to `/usr/lib/nagios/plugins/` (or configured p | `nrpe_pbs_host` | `-` | `check_pbs_backup` | Hôte PBS (IP ou FQDN). | | `nrpe_pbs_token` | `-` | `check_pbs_backup` | API token PBS au format `user@realm!tokenid:secret`. | | `nrpe_pbs_store` | `-` | `check_pbs_backup` | Nom du datastore PBS. | -| `nrpe_pbs_backups` | `-` | `check_pbs_backup` | Liste des backup-id à vérifier. | +| `nrpe_pbs_backups` | `[inventory_hostname]` | `check_pbs_backup` | Liste des backup-id à vérifier. | | `nrpe_pbs_type` | `host` | `check_pbs_backup` | Type de backup : `host`, `vm` ou `ct` (optionnel). | | `nrpe_pbs_port` | `8007` | `check_pbs_backup` | Port de l'API PBS (optionnel). | | `nrpe_pbs_namespace` | `-` | `check_pbs_backup` | Namespace PBS (optionnel). | @@ -185,11 +185,8 @@ The following checks are deployed to `/usr/lib/nagios/plugins/` (or configured p vars: nrpe_pbs_host: pbs01.example.com nrpe_pbs_token: "backup@pbs!monitoring:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - nrpe_pbs_store: main - nrpe_pbs_backups: - - myhost - - otherhost - nrpe_pbs_ssl_insecure: true # optionnel, cert auto-signé + nrpe_pbs_datastore: main + nrpe_pbs_ssl_insecure: true # nrpe_pbs_type: host # optionnel, défaut : host (vm, ct) # nrpe_pbs_namespace: ns # optionnel ``` diff --git a/defaults/main.yml b/defaults/main.yml index 6b47ce1..82cfffe 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -67,3 +67,7 @@ nrpe_ssl_critical: 14 nrpe_ntp_host: 'europe.pool.ntp.org' nrpe_ntp_warning: 10 nrpe_ntp_critical: 15 + +# nrpe_pbs_host: pbs01.example.com +# nrpe_pbs_token: "backup@pbs!monitoring:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" +# nrpe_pbs_datastore: main \ No newline at end of file diff --git a/templates/nrpe.j2 b/templates/nrpe.j2 index a4c4dd9..549936a 100644 --- a/templates/nrpe.j2 +++ b/templates/nrpe.j2 @@ -163,9 +163,7 @@ command[check_ceph_cap]=/usr/lib/nagios/plugins/check_ceph cap command[check_ceph_pg]=/usr/lib/nagios/plugins/check_ceph pg {% endif %} -{% if nrpe_pbs_backups is defined %} +{% if nrpe_pbs_host is defined %} # pbs backups -{% for backup_id in nrpe_pbs_backups %} -command[check_pbs_backup_{{ backup_id }}]=/usr/lib/nagios/plugins/check_pbs_backup -H {{ nrpe_pbs_host }} -T {{ nrpe_pbs_token }} -s {{ nrpe_pbs_datastore }} -n {{ backup_id }}{{ ' -t ' + nrpe_pbs_type if nrpe_pbs_type is defined else '' }}{{ ' -P ' + nrpe_pbs_port|string if nrpe_pbs_port is defined else '' }}{{ ' -N ' + nrpe_pbs_namespace if nrpe_pbs_namespace is defined else '' }}{{ ' -k' if nrpe_pbs_ssl_insecure | default(false) else '' }} -{% endfor %} +command[check_pbs_backup]=/usr/lib/nagios/plugins/check_pbs_backup -H {{ nrpe_pbs_host }} -T {{ nrpe_pbs_token }} -s {{ nrpe_pbs_datastore }} -n {{ backup_id | default(inventory_hostname) }}{{ ' -t ' + nrpe_pbs_type if nrpe_pbs_type is defined else '' }}{{ ' -P ' + nrpe_pbs_port|string if nrpe_pbs_port is defined else '' }}{{ ' -N ' + nrpe_pbs_namespace if nrpe_pbs_namespace is defined else '' }}{{ ' -k' if nrpe_pbs_ssl_insecure | default(false) else '' }} {% endif %} \ No newline at end of file