Skip to content

Commit ec93ce1

Browse files
committed
feat: add metrics_pcp_optional_agents for users to configure optional agents
Feature: PCP provides many agents. The metrics role will automatically enable agents for features being managed e.g. the metrics role will automatically enable the `elasticsearch` agent if `metrics_from_elasticsearch: true`. The new parameter `metrics_pcp_optional_agents` allows the user to provide a list of additional agents to enable. Reason: Users should be able to enable agents other than the ones for features managed by the metrics role. Result: Users can enable the agents they need to use. Signed-off-by: Rich Megginson <rmeggins@redhat.com>
1 parent 372eec5 commit ec93ce1

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,17 @@ It cannot be used for *removing* policy.
165165
If you want to remove policy, you will need to use the selinux system
166166
role directly.
167167

168+
### metrics_pcp_optional_agents: []
169+
170+
List of optional PCP agents to enable. The role will enable agents for
171+
components you are managing. For example, if you use
172+
metrics_from_elasticsearch, the role will enable the elasticsearch agent
173+
automatically. This variable is for additional agents.
174+
175+
```yaml
176+
metrics_pcp_optional_agents: [dm, nfsclient, openmetrics]
177+
```
178+
168179
## Example Playbook
169180

170181
Basic metric recording setup for each managed host only, with one

defaults/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,10 @@ metrics_manage_selinux: false
5757
# performance issues are to be sent. By default, these events are logged to the
5858
# local system log only.
5959
metrics_webhook_endpoint: ''
60+
61+
# List of optional PCP agents to enable. The role will enable
62+
# agents for components you are managing. For example, if you
63+
# use metrics_from_elasticsearch, the role will enable the
64+
# elasticsearch agent automatically. This variable is for
65+
# additional agents.
66+
metrics_pcp_optional_agents: []

tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
pcp_pmie_endpoint: "{{ metrics_webhook_endpoint }}"
118118
pcp_pmlogger_discard: "{{ metrics_retention_days }}"
119119
pcp_target_hosts: "{{ metrics_monitored_hosts }}"
120-
pcp_optional_agents: "{{ __metrics_domains }}"
120+
pcp_optional_agents: "{{ (__metrics_domains + metrics_pcp_optional_agents) | unique | list }}"
121121
pcp_accounts: "{{ __metrics_accounts }}"
122122
pcp_rest_api: "{{ metrics_query_service | bool or
123123
metrics_graph_service | bool }}"

tests/tests_verify_fullstack.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
metrics_graph_service: true
88
metrics_manage_firewall: true
99
metrics_manage_selinux: true
10+
metrics_pcp_optional_agents: [dm, nfsclient, openmetrics]
1011

1112
pre_tasks:
1213
- name: Stop test

0 commit comments

Comments
 (0)