This repository has been archived by the owner on Dec 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #632 from david-martin/ocp_monitoring
Add ocp_monitoring sub dir to prometheus-for-federation config
- Loading branch information
Showing
5 changed files
with
690 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/grafana_datasources.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Usage | ||
|
||
To use this kustomization file with an OSD/OCP cluster, first get a token for | ||
accessing the thanos-query instance, and generate a grafana datasource from the | ||
template file | ||
|
||
```shell | ||
export SECRET=`oc get secret -n openshift-user-workload-monitoring | grep prometheus-user-workload-token | head -n 1 | awk '{print $1 }'` | ||
export TOKEN=`echo $(oc get secret $SECRET -n openshift-user-workload-monitoring -o json | jq -r '.data.token') | base64 -d` | ||
envsubst < ./config/prometheus-for-federation/ocp_monitoring/grafana_datasources.yaml.template > ./config/prometheus-for-federation/ocp_monitoring/grafana_datasources.yaml | ||
``` | ||
|
||
Then apply the resources to the cluster: | ||
|
||
```shell | ||
kustomize --load-restrictor LoadRestrictionsNone build ./config/prometheus-for-federation/ocp_monitoring/ --enable-helm | kubectl apply -f - | ||
``` | ||
|
||
Access Grafana on the exposed route, user/pass is admin/admin by default: | ||
|
||
```shell | ||
oc get route grafana -n monitoring | ||
``` | ||
|
||
# Troubleshooting | ||
|
||
If metrics are missing, check the targets in the OCP UI under Observe > Targets. | ||
Each 'User' target corresponds to a ServiceMonitor or PodMonitor detected by the | ||
user-workload-monitoring prometheus operator. | ||
If a target is missing, check the logs of the prometheus operator in the | ||
openshift-user-workload-monitoring namespace. |
23 changes: 23 additions & 0 deletions
23
config/prometheus-for-federation/ocp_monitoring/grafana_datasources.yaml.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"apiVersion": 1, | ||
"datasources": [ | ||
{ | ||
"access": "proxy", | ||
"editable": false, | ||
"name": "thanos-query", | ||
"orgId": 1, | ||
"type": "prometheus", | ||
"url": "https://thanos-querier.openshift-monitoring.svc:9091", | ||
"version": 1, | ||
"jsonData": { | ||
"httpHeaderName1": "Authorization", | ||
"httpMethod": "POST", | ||
"manageAlerts": false, | ||
"tlsSkipVerify": true | ||
}, | ||
"secureJsonData": { | ||
"httpHeaderValue1": "Bearer $TOKEN" | ||
} | ||
} | ||
] | ||
} |
36 changes: 36 additions & 0 deletions
36
config/prometheus-for-federation/ocp_monitoring/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
resources: | ||
- monitoring.yaml | ||
- github.com/Kuadrant/gateway-api-state-metrics?ref=main | ||
- github.com/Kuadrant/gateway-api-state-metrics/config/examples/dashboards?ref=main | ||
|
||
# Patch grafana deployment to include dashboard configmaps | ||
patchesJson6902: | ||
- target: | ||
group: apps | ||
version: v1 | ||
kind: Deployment | ||
name: grafana | ||
path: ../grafana_deployment_patch.yaml | ||
|
||
generatorOptions: | ||
disableNameSuffixHash: true | ||
|
||
secretGenerator: | ||
- name: grafana-datasources | ||
namespace: monitoring | ||
behavior: replace | ||
files: | ||
- grafana_datasources.yaml | ||
|
||
configMapGenerator: | ||
- name: grafana-istio-workload | ||
namespace: monitoring | ||
files: | ||
- ../grafana_dashboard_istio-workload.json | ||
- name: grafana-mgc-metrics | ||
namespace: monitoring | ||
files: | ||
- ../grafana-dashboard-mgc-metrics.json |
Oops, something went wrong.