Skip to content

Commit

Permalink
fix: add missing pmie webhook action configuration functionality
Browse files Browse the repository at this point in the history
Resolves Red Hat issue RHEL-13760
  • Loading branch information
natoscott authored and richm committed Dec 5, 2023
1 parent d10999b commit 635c35e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Example:
metrics_monitored_hosts: ["webserver.example.com", "database.example.com"]
```
### metrics_webhook_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
Expand Down
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,8 @@ metrics_manage_firewall: false
# If true, manage the pmcd port, pmproxy ports using the selinux role
# depending upon the configuration parameters.
metrics_manage_selinux: false

# 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_webhook_endpoint: ''
1 change: 1 addition & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,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 }}"
Expand Down
7 changes: 7 additions & 0 deletions tests/check_notification.yml
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions tests/tests_verify_notification.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 635c35e

Please sign in to comment.