From d8558fbec02cb978a0e731bb9a344bee81e08f58 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9o=20-=20Le=20Filament?= <theo@le-filament.com>
Date: Wed, 7 Jun 2023 16:56:40 +0200
Subject: [PATCH] change(check_docker_odoo): follow update One dict to rule
 them all

---
 templates/nrpe.cfg.j2 | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/templates/nrpe.cfg.j2 b/templates/nrpe.cfg.j2
index 2b2fd16..5c12efa 100644
--- a/templates/nrpe.cfg.j2
+++ b/templates/nrpe.cfg.j2
@@ -24,7 +24,7 @@ command[check_raid_{{ device }}]=/usr/lib/nagios/custom-plugins/check_mdstat.sh
 command[check_load]=/usr/lib/nagios/plugins/check_load -r -w .85,.80,.75 -c .99,.95,.90
 command[check_mem]=/usr/lib/nagios/custom-plugins/check_mem.pl -f -C -w 20 -c 5
 {% if inventory_hostname in groups.docker | default([]) %}
-command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w {{ ((group_names | length - 7) * 20 + 370) | int | abs }} -c {{ ((group_names | length - 7) * 20 + 410) | int | abs }}
+command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w {{ ((group_names | length - 6) * 20 + 370) | int | abs }} -c {{ ((group_names | length - 6) * 20 + 410) | int | abs }}
 {% else %}
 command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 290 -c 350
 {% endif %}
@@ -105,11 +105,12 @@ command[check_docker_cloud]=/usr/lib/nagios/custom-plugins/check_docker.sh --fil
 {% endif %}
 {% endif %}
 {% if inventory_hostname in groups.docker_odoo | default([]) %}
-{% if odoo_prod is defined %}
-command[check_docker_odoo]=/usr/lib/nagios/custom-plugins/check_docker.sh --filter '^odoo($|_.*)' --cpu 10:15 --memory 35:45
+{% for name, values in odoo_instances.items() %}
+{% if values.is_prod is defined and values.is_prod %}
+command[check_docker_odoo]=/usr/lib/nagios/custom-plugins/check_docker.sh --filter '^{{ name }}($|_.*)' --cpu 10:15 --memory 35:45
+{% else %}
+command[check_docker_odoo]=/usr/lib/nagios/custom-plugins/check_docker.sh --filter '^{{ name }}($|_.*)' --cpu 10:15 --memory 20:25
 {% endif %}
-{% for instance in odoo_nonprod_instances | default([]) %}
-command[check_docker_{{ instance.name }}]=/usr/lib/nagios/custom-plugins/check_docker.sh --filter '^{{ instance.dir }}.*' --cpu 10:15 --memory 20:25
 {% endfor %}
 {% if restrict_internet_access and whitelisted_urls is defined %}
 command[check_docker_whitelists]=/usr/lib/nagios/custom-plugins/check_docker.sh --filter '^whitelists.*' --cpu 10:10 --memory 5:7
-- 
GitLab