diff --git a/README.md b/README.md index 533054e..4923668 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,12 @@ Example: metrics_monitored_hosts: ["webserver.example.com", "database.example.com"] ``` +### metrics_event_endpoint: '' + +Webhook endpoint (URL) where notification about any automatically detected +performance issues are to be sent. By default, these events are logged to +the local system log only. + ### metrics_retention_days: 14 Retain historical performance data for the specified number of days; after diff --git a/tasks/main.yml b/tasks/main.yml index 8a85b8e..f7751c6 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -102,6 +102,7 @@ - name: Setup metric collection service. vars: + pcp_pmie_endpoint: "{{ metrics_webhook_endpoint }}" pcp_pmlogger_discard: "{{ metrics_retention_days }}" pcp_target_hosts: "{{ metrics_monitored_hosts }}" pcp_optional_agents: "{{ __metrics_domains }}" diff --git a/tests/check_notification.yml b/tests/check_notification.yml new file mode 100644 index 0000000..f101768 --- /dev/null +++ b/tests/check_notification.yml @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: MIT +--- +# yamllint disable rule:line-length +- name: Check if webhook notification is set + command: grep -e 'webhook_endpoint .* {{ __test_webhook }}' /var/lib/pcp/config/pmie/config.default + changed_when: false +# yamllint enable rule:line-length diff --git a/tests/tests_verify_notification.yml b/tests/tests_verify_notification.yml new file mode 100644 index 0000000..6b64473 --- /dev/null +++ b/tests/tests_verify_notification.yml @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: MIT +--- +- name: Test configuration of webhook notification + hosts: all + vars: + __test_webhook: https://example.com:4242/endpoint + + roles: + - role: linux-system-roles.metrics + vars: + metrics_webhook_endpoint: "{{ __test_webhook }}" + + pre_tasks: + - name: Save state of services + import_tasks: get_services_state.yml + + tasks: + - name: Check basic services and the webhook endpoint + include_tasks: "{{ item }}" + loop: + - check_pcp.yml + - check_pmie.yml + - check_notification.yml + + post_tasks: + - name: Restore state of services + import_tasks: restore_services_state.yml