Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-37697

The command in the upstream doc to get metrics for compliance operator doesn't work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • 4.17.0
    • Compliance Operator
    • None
    • Low
    • None
    • False
    • Hide

      None

      Show
      None

      Description of problem:

       

      In https://github.com/ComplianceAsCode/compliance-operator/blob/master/doc/usage.md#metrics, there is a command to get metrics for compliance operator doesn't work.
      % oc run --rm -i --restart=Never --image=registry.fedoraproject.org/fedora-minimal:latest -n openshift-compliance metrics-test -- bash -c 'curl -ks -H "Authorization: Bea
      rer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" https://metrics.openshift-compliance.svc:8585/metrics-co'                  
      400 Bad Requestpod "metrics-test" deleted
      The metrics itself works:
      % oc exec -n openshift-monitoring -c prometheus prometheus-k8s-0 -- curl -k -H "Authorization: Bearer $(oc create token prometheus-k8s -n openshift-monitoring)" https://metrics.openshift-compliance.svc:8585/metrics-co | grep compliance | head
       % Total  % Received % Xferd Average Speed  Time  Time   Time Current
                       Dload Upload  Total  Spent  Left Speed
       0   0  0   0  0   0   0   0 --:decrement:-- --:decrement:-- --:decrement:--   0# HELP compliance_operator_compliance_remediation_status_total A counter for the total number of updates to the status of a ComplianceRemediation
      # TYPE compliance_operator_compliance_remediation_status_total counter
      compliance_operator_compliance_remediation_status_total{name="ocp4-stig-audit-profile-set",state="NotApplied"} 2
      compliance_operator_compliance_remediation_status_total{name="ocp4-stig-audit-profile-set",state="Pending"} 1
      compliance_operator_compliance_remediation_status_total{name="ocp4-stig-oauth-or-oauthclient-token-maxage",state="NotApplied"} 2
      compliance_operator_compliance_remediation_status_total{name="ocp4-stig-oauth-or-oauthclient-token-maxage",state="Pending"} 1
      compliance_operator_compliance_remediation_status_total{name="ocp4-stig-project-config-and-template-network-policy",state="NotApplied"} 2
      compliance_operator_compliance_remediation_status_total{name="ocp4-stig-project-config-and-template-network-policy",state="Pending"} 1
      compliance_operator_compliance_remediation_status_total{name="ocp4-stig-project-config-and-template-network-policy-1",state="NotApplied"} 2
      compliance_operator_compliance_remediation_status_total{name="ocp4-stig-project-config-and-template-network-policy-1",state="Pending"} 1    
      

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

          

      How reproducible:

       Always   

      Steps to Reproduce:

      1. Install Compliance Operator 
      2. Create a ssb 
      3. Try to run command `% oc run --rm -i --restart=Never --image=registry.fedoraproject.org/fedora-minimal:latest -n openshift-compliance metrics-test -- bash -c 'curl -ks -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" https://metrics.openshift-compliance.svc:8585/metrics-co' `
         

      Actual results:

      With the command in the upstream doc, I cannot get the metrics info.    

      Expected results:

      The upstream doc https://github.com/ComplianceAsCode/compliance-operator/blob/master/doc/usage.md#metrics should offer the right command to get metrics.    

      Additional info:

          

              lbragsta@redhat.com Lance Bragstad
              xiyuan@redhat.com Xiaojie Yuan
              Xiaojie Yuan Xiaojie Yuan
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: