13.3. Monitoring Central services by using Helm
You can monitor Central services, Central and Scanner, by changing the configuration options in the central-services Helm chart. For more information, see "Changing configuration options after deploying the central-services Helm chart" in the "Additional resources" section.
Procedure
Update the
values-public.yamlconfiguration file with the following values:central.exposeMonitoring: true scanner.exposeMonitoring: true-
Run the
helm upgradecommand and specify the configuration files.
If you are using the Prometheus Operator, you can use a service monitor to scrape the metrics from Red Hat Advanced Cluster Security for Kubernetes (RHACS).
- If you are not using the Prometheus operator, you must edit the Prometheus configuration files to receive the data from RHACS.
-
If you use Kubernetes, enter
kubectlinstead ofoc.
Procedure
Create a new
servicemonitor.yamlfile with the following content:apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: prometheus-stackrox namespace: stackrox spec: endpoints: - interval: 30s port: monitoring scheme: http selector: matchLabels: app.kubernetes.io/name: <stackrox-service>where:
app.kubernetes.io/name:<stackrox-service>-
Specifies the name of the service to monitor. The label must match with the
Serviceresource that you want to monitor. For example,centralorscanner.
Apply the YAML to the cluster:
$ oc apply -f servicemonitor.yaml
Verification
Run the following command to check the status of service monitor:
$ oc get servicemonitor --namespace stackrox