pbs - rename PBS_STORE to PBS_DATASTORE

This commit is contained in:
Ludovic Cartier
2026-06-01 17:11:50 +02:00
parent 1c9824a205
commit fc66a7b8b2
2 changed files with 8 additions and 8 deletions
+5 -5
View File
@@ -15,7 +15,7 @@ STATE_UNKNOWN=3
PBS_HOST="" PBS_HOST=""
PBS_PORT=8007 PBS_PORT=8007
PBS_TOKEN="" PBS_TOKEN=""
PBS_STORE="" PBS_DATASTORE=""
BACKUP_ID="" BACKUP_ID=""
BACKUP_TYPE="host" BACKUP_TYPE="host"
NAMESPACE="" NAMESPACE=""
@@ -50,7 +50,7 @@ while getopts "H:T:s:n:t:P:N:k" opt; do
case "$opt" in case "$opt" in
H) PBS_HOST="$OPTARG" ;; H) PBS_HOST="$OPTARG" ;;
T) PBS_TOKEN="$OPTARG" ;; T) PBS_TOKEN="$OPTARG" ;;
s) PBS_STORE="$OPTARG" ;; s) PBS_DATASTORE="$OPTARG" ;;
n) BACKUP_ID="$OPTARG" ;; n) BACKUP_ID="$OPTARG" ;;
t) BACKUP_TYPE="$OPTARG" ;; t) BACKUP_TYPE="$OPTARG" ;;
P) PBS_PORT="$OPTARG" ;; P) PBS_PORT="$OPTARG" ;;
@@ -60,7 +60,7 @@ while getopts "H:T:s:n:t:P:N:k" opt; do
esac esac
done done
if [[ -z "$PBS_HOST" || -z "$PBS_TOKEN" || -z "$PBS_STORE" || -z "$BACKUP_ID" ]]; then if [[ -z "$PBS_HOST" || -z "$PBS_TOKEN" || -z "$PBS_DATASTORE" || -z "$BACKUP_ID" ]]; then
usage usage
fi fi
@@ -75,7 +75,7 @@ CURL_OPTS=(-sf --max-time 15)
# --- URL de l'API --- # --- URL de l'API ---
BASE_URL="https://${PBS_HOST}:${PBS_PORT}/api2/json" BASE_URL="https://${PBS_HOST}:${PBS_PORT}/api2/json"
SNAPSHOTS_URL="${BASE_URL}/admin/datastore/${PBS_STORE}/snapshots?backup-type=${BACKUP_TYPE}&backup-id=${BACKUP_ID}" SNAPSHOTS_URL="${BASE_URL}/admin/datastore/${PBS_DATASTORE}/snapshots?backup-type=${BACKUP_TYPE}&backup-id=${BACKUP_ID}"
[[ -n "$NAMESPACE" ]] && SNAPSHOTS_URL+="&ns=${NAMESPACE}" [[ -n "$NAMESPACE" ]] && SNAPSHOTS_URL+="&ns=${NAMESPACE}"
# --- Appel API --- # --- Appel API ---
@@ -108,7 +108,7 @@ SNAPSHOTS=$(echo "$RESPONSE" | jq -r '.data // []')
TOTAL_COUNT=$(echo "$SNAPSHOTS" | jq 'length') TOTAL_COUNT=$(echo "$SNAPSHOTS" | jq 'length')
if [[ "$TOTAL_COUNT" -eq 0 ]]; then if [[ "$TOTAL_COUNT" -eq 0 ]]; then
echo "CRITICAL: Aucun backup trouvé pour '${BACKUP_ID}' dans le datastore '${PBS_STORE}'" echo "CRITICAL: Aucun backup trouvé pour '${BACKUP_ID}' dans le datastore '${PBS_DATASTORE}'"
exit $STATE_CRITICAL exit $STATE_CRITICAL
fi fi
+3 -3
View File
@@ -163,9 +163,9 @@ command[check_ceph_cap]=/usr/lib/nagios/plugins/check_ceph cap
command[check_ceph_pg]=/usr/lib/nagios/plugins/check_ceph pg command[check_ceph_pg]=/usr/lib/nagios/plugins/check_ceph pg
{% endif %} {% endif %}
{% if nrpe_pbs is defined %} {% if nrpe_pbs_backups is defined %}
# pbs backups # pbs backups
{% for backup_id in nrpe_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.store }} -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 '' }} 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 %} {% endfor %}
{% endif %} {% endif %}