This repo will help clients to validate cmo matrix are matching from openshift prometheus.
This app is written in golang and require golang environment to be present in the system
refer this link for instructions Go Downloads
oc login -u **username** -p **password** **console-url**
oc port-forward -n openshift-monitoring pod/prometheus-k8s-0 9090:9090Execute these command in a seperate terminal session because oc port forward is a blocking call
//populate the clusterID of the openshift cluster here
clusterID = ""
//populate the project name for which metrics needs to be fetched here
project = ""
//populate service account id
id = ""
//populate service account secret
secret = ""- ClusterID: cluster id of the openshift cluster
- project: The openshift project for which data needs to be queried
- id & secret: client id and secret. This is obtained by creating service account on the redhat console
For more information on service accounts Redhat Service Accounts
go run main.goSample Output:
(base) shivanggoswami@Shivangs-MacBook-Pro cmo-validation-github % go run main.go
Data from the console:
[
{
"date": "2024-06-13",
"project": "costmanagement-metrics-operator",
"usage": {
"value": 0.006976286666667,
"units": "Core-Hours"
}
},
{
"date": "2024-06-14",
"project": "costmanagement-metrics-operator",
"usage": {
"value": 0.039031766388889,
"units": "Core-Hours"
}
}
]
Data from the prometheus:
Prometheus Data for 2024-06-13 : 0.006948658973104022
Prometheus Data for 2024-06-14 : 0.03928629528140759