diff --git a/README.md b/README.md index 18258d0920738022014654b219844195516483b2..c35dc671a9f1a3777dc3355a819ce86a328f309e 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Variables from default directory : * nagios_url: URL on which Nagios will be listening * win_srv_ip: IP address of Windows server * win_b2b_url: URL for B2B exchange server -* docker_hub_uri: URI of DockerHub to trigger build of images daily +* webhooks_to_be_called_daily: list of WebHooks to be called daily * services_to_be_monitored: list of extra services to be monitored Variables used on other hosts for monitoring : diff --git a/defaults/main.yml b/defaults/main.yml index 87b71de286ee197eca614048a5a1b486ddcfb833..d487c0aa98e650335d29dbb46c8c1e56f8b8c554 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -6,8 +6,13 @@ nagios_url: "nagios.example.org" win_srv_ip: 10.12.12.12 win_b2b_url: b2b.example.org -# Docker Hub URI -docker_hub_uri: /api/build/v1/source/test/trigger/test2/call/ +# Webhooks to be triggered daily +webhooks_to_be_called_daily: + - name: Docker Odoo + url: gitlab.example.org + uri: "/api/v4/projects/xx/ref/REF_NAME/trigger/pipeline?token=TOKEN" + +# List of external services to be monitored services_to_be_monitored: - name: Webmail period: generic diff --git a/templates/commands.cfg.j2 b/templates/commands.cfg.j2 index cac012089b2b13906bab4bbd528e132749d4f64b..cd57198373cb4c1aec1210afd44aac5b4cda0cbb 100644 --- a/templates/commands.cfg.j2 +++ b/templates/commands.cfg.j2 @@ -80,9 +80,9 @@ define command { command_line $USER1$/check_nrpe -2 -H $HOSTADDRESS$ -c $ARG1$ $ARG2$ } -# trigger_docker_hub +# trigger_webhook define command { - command_name trigger_docker_hub + command_name trigger_webhook command_line $USER1$/check_http -H $ARG1$ -S -u $ARG2$ -j POST } diff --git a/templates/localhost.cfg.j2 b/templates/localhost.cfg.j2 index ef1254bb379e54d1e3c3c811e3a3a5210d76637a..343e9fbecb2aeb5e3bea02f49579db0ee5a781da 100644 --- a/templates/localhost.cfg.j2 +++ b/templates/localhost.cfg.j2 @@ -44,13 +44,15 @@ define service{ check_command check_local_procs!20!2:!nagios } +{% for webhook in webhooks_to_be_called_daily %} define service{ use daily-service host_name Nagios Server - service_description Trigger Build Odoo Images - check_command trigger_docker_hub!hub.docker.com!{{ docker_hub_uri }} + service_description WebHook {{ webhook.name }} + check_command trigger_webhook!{{ webhook.url }}!{{ webhook.uri }} } +{% endfor %} {% for service in services_to_be_monitored %} define service{ use {{ service.period }}-service