prometheus: add support for installing webhook server
This commit is contained in:
@@ -7,5 +7,6 @@ prometheus_install_grafana: false
|
||||
prometheus_hcloud_relabel_configs: []
|
||||
|
||||
prometheus_install_alertmanager: true
|
||||
prometheus_install_webhook: false
|
||||
|
||||
alertmanager_storage_retention: "{{ prometheus_storage_retention }}"
|
||||
|
||||
@@ -51,6 +51,11 @@ argument_specs:
|
||||
type: bool
|
||||
required: false
|
||||
default: true
|
||||
prometheus_install_webhook:
|
||||
description: If true, installs webhook server in the same docker network as prometheus and configures it
|
||||
type: bool
|
||||
required: false
|
||||
default: false
|
||||
|
||||
alertmanager_storage_retention:
|
||||
description: Period of time for which alertmanager data is stored for. A number followed by unit (s, m, h, d, w, y). Passed directly to alertmanager role
|
||||
@@ -58,6 +63,47 @@ argument_specs:
|
||||
required: false
|
||||
default: "{{ prometheus_storage_retention | default('3650d') }}"
|
||||
|
||||
prometheus_webhook_handlers:
|
||||
description: List of webhook server handlers
|
||||
type: list
|
||||
required: "{{ prometheus_install_webhook }}"
|
||||
elements: dict
|
||||
options:
|
||||
id:
|
||||
description: specifies the ID of your hook. This value is used to create the HTTP endpoint
|
||||
type: str
|
||||
required: true
|
||||
execute-command:
|
||||
description: specifies the command that should be executed when the hook is triggered
|
||||
type: str
|
||||
required: true
|
||||
command-working-directory:
|
||||
description: specifies the working directory that will be used for the script when it's executed
|
||||
type: str
|
||||
required: false
|
||||
pass-arguments-to-command:
|
||||
description: >
|
||||
specifies the list of arguments that will be passed to the
|
||||
command. See for more info:
|
||||
https://github.com/adnanh/webhook/blob/master/docs/Referencing-Request-Values.md
|
||||
type: list
|
||||
required: false
|
||||
elements: dict
|
||||
options:
|
||||
source:
|
||||
description: Source of the argument. Use `string` to specify argument here.
|
||||
type: str
|
||||
required: true
|
||||
choices:
|
||||
- string
|
||||
- header
|
||||
- url
|
||||
- request
|
||||
- payload
|
||||
name:
|
||||
description: Argument if source is string, otherwise the source attribute name.
|
||||
type: str
|
||||
required: true
|
||||
|
||||
# All options after this will be passed directly to the container role
|
||||
docker_service_suffix:
|
||||
|
||||
@@ -31,6 +31,20 @@
|
||||
- name: prometheus
|
||||
when: prometheus_install_alertmanager
|
||||
|
||||
- name: Webhook container for prometheus
|
||||
include_role:
|
||||
name: container
|
||||
vars:
|
||||
docker_service: prometheus_webhook
|
||||
docker_image: thecatlady/webhook
|
||||
reverse_proxy_type: none
|
||||
docker_mounts:
|
||||
- template: webhooks.yaml
|
||||
path: /config/hooks.yml
|
||||
docker_networks:
|
||||
- name: prometheus
|
||||
when: prometheus_install_webhook
|
||||
|
||||
- name: Grafana container for prometheus
|
||||
include_role:
|
||||
name: grafana
|
||||
|
||||
5
roles/prometheus/templates/webhooks.yaml.j2
Normal file
5
roles/prometheus/templates/webhooks.yaml.j2
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
|
||||
{% for item in prometheus_webhook_handlers %}
|
||||
- {{ item }}
|
||||
{% endfor %}
|
||||
Reference in New Issue
Block a user