Bug 1967335

Summary: metrics role task to enable logging for targeted hosts not working
Product: Red Hat Enterprise Linux 8 Reporter: Brian Smith <briasmit>
Component: rhel-system-rolesAssignee: Rich Megginson <rmeggins>
Status: CLOSED ERRATA QA Contact: Jan Kurik <jkurik>
Severity: unspecified Docs Contact: Eliane Ramos Pereira <elpereir>
Priority: unspecified    
Version: 8.4CC: djez, elpereir, jkurik, nhosoi, spetrosi
Target Milestone: beta   
Target Release: 8.5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: role:metrics
Fixed In Version: rhel-system-roles-1.4.0-1.el8 Doc Type: Bug Fix
Doc Text:
.Task to enable logging for targeted hosts in the `metric` role now works Previously, a bug in the `metric` RHEL System Role prevented referring to targeted hosts in the `enabling the performance metric logging` task. Consequently, the control file for performance metric logging was not generated. This update fixes the issue, and now the targeted hosts are correctly referred to. As a result, the control file is successfully created, enabling the performance metric logging execution.
Story Points: ---
Clone Of:
: 1978746 (view as bug list) Environment:
Last Closed: 2021-11-09 17:45:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1978746    

Description Brian Smith 2021-06-02 22:16:33 UTC
Description of problem:
The "Ensure performance metric logging is enabled for targeted hosts" task is not doing anything, even if the "metrics_monitored_hosts" role variable is defined.  This prevents pmlogger from gathering metrics from remote hosts


Version-Release number of selected component (if applicable):
rhel-system-roles-1.0.1-1.el8.noarch

How reproducible:
Every time

Steps to Reproduce:
1. Run playbook:
---
- hosts: localhost
  vars:
    metrics_graph_service: yes
    metrics_query_service: yes
    metrics_retention_days: 7
    metrics_monitored_hosts: ["rhel8-server1", "rhel8-server2", "rhel7-server1", "rhel7-server2"]
  roles: 
    - redhat.rhel_system_roles.metrics


Actual results:
The "Ensure performance metric logging is enabled for targeted hosts" task doesn't do anything:

TASK [redhat.rhel_system_roles.private_metrics_subrole_pcp : Ensure performance metric logging is enabled for targeted hosts] ***


Expected results:
The task runs and creates configuration files for each host under 
/etc/pcp/pmlogger/control.d/


Additional info:

It appears to me that the issue is the "Ensure performance metric logging is enabled for targeted hosts" task is looping on the "__pcp_target_hosts" variable which is not set anywhere, so the loop doesn't run.    

I updated the task to loop on "pcp_target_hosts" and this appeared to fix the issue and the task runs as expected and created the configuration files.

Comment 1 Brian Smith 2021-06-02 22:22:53 UTC
Created pull request with proposed fix (please verify this is correct way to fix issue):  https://github.com/linux-system-roles/metrics/pull/87

Comment 15 errata-xmlrpc 2021-11-09 17:45:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (rhel-system-roles bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4159