8.2.5. ServiceMonitor オブジェクトを作成します。

ServiceMonitor リソースを作成して、メトリクスをスクレープするように OpenShift Monitoring を設定します。

  1. ServiceMonitor リソースの YAML ファイルを作成します。

    $ cat quay-service-monitor.yaml
    
    apiVersion: monitoring.coreos.com/v1
    kind: ServiceMonitor
    metadata:
      labels:
        quay-operator/quayregistry: example-registry
      name: example-registry-quay-metrics-monitor
      namespace: quay-enterprise
    spec:
      endpoints:
      - port: quay-metrics
      namespaceSelector:
        any: true
      selector:
        matchLabels:
          quay-component: monitoring
  2. ServiceMonitor を作成します。

    $  oc apply -f quay-service-monitor.yaml
    
    servicemonitor.monitoring.coreos.com/example-registry-quay-metrics-monitor created