Bug 2180440

Summary: odf-monitoring-tool. YAML file misjudged as corrupted
Product: [Red Hat Storage] Red Hat OpenShift Data Foundation Reporter: Daniel Osypenko <dosypenk>
Component: ceph-monitoringAssignee: arun kumar mohan <amohan>
Status: CLOSED ERRATA QA Contact: Daniel Osypenko <dosypenk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.13CC: amohan, mbenatto, muagarwa, nberry, odf-bz-bot, security-response-team
Target Milestone: ---   
Target Release: ODF 4.13.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-06-21 15:24:39 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:

Description Daniel Osypenko 2023-03-21 13:21:49 UTC
Description of problem (please be detailed as possible and provide log
snippests):

Passing the valid YAML file, the script produces an ERROR:

anielosypenko@dosypenk-mac comparealerts % ./comparealerts ../prometheus-ocs-rules.yaml ../prometheus_alerts.yml 
[ERROR] 2023/03/21 13:38:09 main.go:122: Alert file2: "../prometheus_alerts.yml" error: corrupted yaml or json file: ../prometheus_alerts.yml

same error appeared with valid JSON file
danielosypenko@dosypenk-mac comparealerts % ./comparealerts -of pp ../prometheus-ocs-rules.json ../prometheus_alerts.json
[ERROR] 2023/03/21 14:24:29 main.go:122: Alert file2: "../prometheus_alerts.json" error: corrupted yaml or json file: ../prometheus_alerts.json

Version of all relevant components (if applicable):

The monitoring-tool from the repo https://github.com/red-hat-storage/odf-monitoring-tools, last commit beef0905efc172c77f0446398b2eed24d5a3c3ab from Feb 22, 2023

go version go1.20.2 darwin/arm64

Does this issue impact your ability to continue to work with the product
(please explain in detail what is the user impact)?

yes

Is there any workaround available to the best of your knowledge?

--

Rate from 1 - 5 the complexity of the scenario you performed that caused this
bug (1 - very simple, 5 - very complex)?

2

Can this issue reproducible?

yes

Can this issue reproduce from the UI?

no

If this is a regression, please provide more details to justify this:

not a regression. Issue found within Happy Path validation

Steps to Reproduce:

1. git clone https://github.com/red-hat-storage/odf-monitoring-tools.git

2. cd into comparealerts directory of the project

3. go build

    3.a a binary executable, named: comparealerts ,  will be created

4. download upstream and downstream prometheus rules yaml files

https://github.com/red-hat-storage/ocs-operator/blob/main/metrics/deploy/prometheus-ocs-rules.yaml

and

https://github.com/ceph/ceph/blob/main/monitoring/ceph-mixin/prometheus_alerts.yml 

5. run cmd ./comparealerts -of pp <path_to_file>/prometheus-ocs-rules.yaml <path_to_file>/prometheus_alerts.yml

6. convert <path_to_file>/prometheus-ocs-rules.yaml and <path_to_file>/prometheus_alerts.yml to JSON files, insure that files contain valid JSONs and run step 5 with JSON files instead of YAML 

Actual results:
[ERROR] 2023/03/21 13:39:09 main.go:122: Alert file2: "../prometheus_alerts.yml" error: corrupted yaml or json file: ../prometheus_alerts.yml

Expected results:

differences between prometheus rules Pretty Printed to standard output

Additional info:
Feature ticket - https://issues.redhat.com/browse/RHSTOR-3803

Comment 3 arun kumar mohan 2023-03-28 13:57:50 UTC
This is fixed with this change PR: https://github.com/red-hat-storage/odf-monitoring-tools/pull/3/files and it is merged now.
Please check.

Comment 4 Daniel Osypenko 2023-03-30 09:36:57 UTC
https://github.com/red-hat-storage/odf-monitoring-tools with latest merged commit a65719edaff0ef038498d1bb13affd50f073fe25 passes the test

Comment 9 errata-xmlrpc 2023-06-21 15:24:39 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 (Red Hat OpenShift Data Foundation 4.13.0 enhancement and bug fix 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-2023:3742