Uploaded image for project: 'Docs for Red Hat Developers'
  1. Docs for Red Hat Developers
  2. RHDEVDOCS-5177

Update prereqs for viewing a list of metrics

XMLWordPrintable

    • devex docs #237 May 4-May 18
    • 2
    • ---
    • ---

      Description of problem:

      Following https://docs.openshift.com/container-platform/4.12/monitoring/managing-metrics.html#viewing-a-list-of-available-metrics_managing-metrics , but, `oc whoami -t` will not return any token. It failed at:

      MacBook-Pro:~ jianzhang$ oc whoami 
      system:admin
      MacBook-Pro:~ jianzhang$ oc whoami -t
      error: no token is currently in use for this session
      
      curl -k -H "Authorization: Bearer $(oc whoami -t)" https://<thanos_querier_route>/api/v1/metadata 
      
      MacBook-Pro:~ jianzhang$ curl -k -H "Authorization: Bearer $(oc whoami -t)" https://thanos-querier-openshift-monitoring.apps.qe-daily-413-0324.qe.azure.devcluster.openshift.com/api/v1/metadata |jq
      error: no token is currently in use for this session
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
        0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0parse error: Invalid numeric literal at line 2, column 10
      100 24887    0 24887    0     0  16599      0 --:--:--  0:00:01 --:--:-- 16646
      curl: (23) Failure writing output to destination
      
      
      

      We should create a token, and use it, like below,

      MacBook-Pro:~ jianzhang$ token=`oc -n openshift-monitoring create token prometheus-k8s`
      MacBook-Pro:~ jianzhang$ curl -k -H "Authorization: Bearer ${token}" https://thanos-querier-openshift-monitoring.apps.qe-daily-413-0324.qe.azure.devcluster.openshift.com/api/v1/metadata |jq 
      ...

      Version-Release number of selected component (if applicable):

      4.12

      How reproducible:

      always

      Steps to Reproduce:

      1, Following https://docs.openshift.com/container-platform/4.12/monitoring/managing-metrics.html#viewing-a-list-of-available-metrics_managing-metrics
      
      2. MacBook-Pro:~ jianzhang$ oc get routes -n openshift-monitoring thanos-querier -o jsonpath='{.status.ingress[0].host}'
      thanos-querier-openshift-monitoring.apps.qe-daily-413-0324.qe.azure.devcluster.openshift.com
      
       3. 
      MacBook-Pro:~ jianzhang$ curl -k -H "Authorization: Bearer $(oc whoami -t)" https://thanos-querier-openshift-monitoring.apps.qe-daily-413-0324.qe.azure.devcluster.openshift.com/api/v1/metadata
      error: no token is currently in use for this session
       

      Actual results:

      MacBook-Pro:~ jianzhang$ curl -k -H "Authorization: Bearer $(oc whoami -t)" https://thanos-querier-openshift-monitoring.apps.qe-daily-413-0324.qe.azure.devcluster.openshift.com/api/v1/metadata
      error: no token is currently in use for this session

      Expected results:

      Get metrics successfully

      Additional info:

       

              rhn-support-bburt Brian Burt
              rhn-support-jiazha Jian Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: