Monitoring Che Server
You can configure Che to expose JVM metrics such as JVM memory and class loading for Che Server.
Enabling and exposing Che Server metrics
Che exposes the JVM metrics on port 8087
of the che-host
Service.
You can configure this behaviour.
-
Configure the
CheCluster
Custom Resource. See Using the CLI to configure the CheCluster Custom Resource.spec: components: metrics: enable: <boolean> (1)
1 true
to enable,false
to disable.
Collecting Che Server metrics with Prometheus
To use Prometheus to collect, store, and query JVM metrics for Che Server:
-
Che is exposing metrics on port
8087
. See Enabling and exposing Che server JVM metrics. -
Prometheus 2.26.0 or later is running. The Prometheus console is running on port
9090
with a corresponding Service. See First steps with Prometheus.
-
Configure Prometheus to scrape metrics from port
8087
.The example monitoring stack already creates the prometheus-config
ConfigMap with an empty configuration. To provide the Prometheus configuration details, edit thedata
field of the ConfigMap.Example 1. Prometheus configurationapiVersion: v1 kind: ConfigMap metadata: name: prometheus-config data: prometheus.yml: |- global: scrape_interval: 5s (1) evaluation_interval: 5s (2) scrape_configs: (3) - job_name: 'Che Server' static_configs: - targets: ['che-host.<Che_namespace>:8087'] (4)
1 The rate at which a target is scraped. 2 The rate at which the recording and alerting rules are re-checked. 3 The resources that Prometheus monitors. In the default configuration, a single job, Che Server
, scrapes the time series data exposed by Che Server.4 The scrape target for the metrics from port 8087
. Replace<Che_namespace>
with the Che namespace. The default Che namespace iseclipse-che
. -
Scale the
Prometheus
Deployment down and up to read the updated ConfigMap from the previous step.$ kubectl scale --replicas=0 deployment/prometheus -n monitoring && kubectl scale --replicas=1 deployment/prometheus -n monitoring
-
Use port forwarding to access the
Prometheus
Service locally:$ kubectl port-forward svc/prometheus 9090:9090 -n monitoring
-
Verify that all targets are up by viewing the
targets
endpoint atlocalhost:9090/targets
. -
Use the Prometheus console to view and query metrics:
-
View metrics at
localhost:9090/metrics
. -
Query metrics from
localhost:9090/graph
.For more information, see Using the expression browser.
-
Viewing Che Server metrics on Grafana dashboards
To view the Che Server metrics on Grafana:
-
Prometheus is collecting metrics on the Che cluster. See Monitoring Che with Prometheus and Grafana.
-
Grafana 6.0 or later is running on port
3000
with a corresponding Service. See Installing Grafana.
-
Add the data source for the Prometheus instance. See Creating a Prometheus data source.
-
Import the example dashboard. See Import dashboard.
-
View the Che JVM metrics in the Grafana console: