You are viewing documentation for a release that is no longer maintained. To view the documentation for the most recent version, see the latest RHACS docs.
Chapter 12. Monitoring with Prometheus
Prometheus is an open-source monitoring and alerting platform. You can use it to monitor health and availability of Central and Sensor components of Red Hat Advanced Cluster Security for Kubernetes.
12.1. Enabling monitoring Copy linkLink copied to clipboard!
Before you can monitor Red Hat Advanced Cluster Security for Kubernetes, you must enable monitoring.
Procedure
Patch the services to expose the port number
9090.Patch the Sensor service:
oc -n stackrox patch svc/sensor -p '{"spec":{"ports":[{"name":"monitoring","port":9090,"protocol":"TCP","targetPort":9090}]}}'$ oc -n stackrox patch svc/sensor -p '{"spec":{"ports":[{"name":"monitoring","port":9090,"protocol":"TCP","targetPort":9090}]}}'1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- If you use Kubernetes, enter
kubectlinstead ofoc.
Patch the Central service:
oc -n stackrox patch svc/central -p '{"spec":{"ports":[{"name":"monitoring","port":9090,"protocol":"TCP","targetPort":9090}]}}'$ oc -n stackrox patch svc/central -p '{"spec":{"ports":[{"name":"monitoring","port":9090,"protocol":"TCP","targetPort":9090}]}}'Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Modify network policies to allow ingress.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- If you use Kubernetes, enter
kubectlinstead ofoc.
12.1.1. Customizing the default port Copy linkLink copied to clipboard!
To customize the port used for Prometheus metrics in Red Hat Advanced Cluster Security for Kubernetes Central and Sensor, you can use the ROX_METRICS_PORT environment variable.
Procedure
Set the
ROX_METRICS_PORTenvironment variable:oc -n stackrox set env deploy/central ROX_METRICS_PORT=<value>
$ oc -n stackrox set env deploy/central ROX_METRICS_PORT=<value>1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- If you use Kubernetes, enter
kubectlinstead ofoc.
You can specify the <value> for the ROX_METRICS_PORT environment variable as:
-
disabledto disable monitoring. -
<port_number>to bind it to a wildcard address. -
<address>:<port_number>to use specific address and port number. You can also specify an IPv6 address by using square brackets, for example,[2001:db8::1234]:9090.