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.

Procedure

Collecting Che Server metrics with Prometheus

To use the in-cluster Prometheus instance to collect, store, and query JVM metrics for Che Server:

Prerequisites
Procedure

The che-operator automatically creates the following resources when metrics are enabled:

  • A ServiceMonitor resource named che-host for detecting the Che JVM metrics Service

  • A Role and RoleBinding granting the prometheus-k8s service account permission to scrape metrics endpoints in the eclipse-che namespace

To complete the monitoring configuration:

  1. Allow the in-cluster Prometheus instance to detect the ServiceMonitor in the Che namespace. The default Che namespace is eclipse-che.

    $ kubectl label namespace eclipse-che openshift.io/cluster-monitoring=true
Verification
  1. In the Administrator view of the OpenShift web console, go to ObserveMetrics.

  2. Run a PromQL query to confirm that the metrics are available. For example, enter process_uptime_seconds{job="che-host"} and click Run queries.

To troubleshoot missing metrics, view the Prometheus container logs for possible RBAC-related errors:

  1. Get the name of the Prometheus pod:

    $ oc get pods -l app.kubernetes.io/name=prometheus -n openshift-monitoring -o=jsonpath='{.items[*].metadata.name}'
  2. Print the last 20 lines of the Prometheus container logs from the Prometheus pod from the previous step:

    $ oc logs --tail=20 <prometheus_pod_name> -c prometheus -n openshift-monitoring

Viewing Che Server from an OpenShift web console dashboard

After configuring the in-cluster Prometheus instance to collect Che Server JVM metrics, you can view the metrics on a custom dashboard in the Administrator perspective of the OpenShift web console.

Prerequisites
Procedure
  • Create a ConfigMap for the dashboard definition in the openshift-config-managed namespace and apply the necessary label.

    1. $ oc create configmap grafana-dashboard-devspaces-server \
        --from-literal=devspaces-server-dashboard.json="$(curl https://raw.githubusercontent.com/eclipse-che/che-server/main/docs/grafana/openshift-console-dashboard.json)" \
        -n openshift-config-managed
    2. $ oc label configmap grafana-dashboard-devspaces-server console.openshift.io/dashboard=true -n openshift-config-managed
      The dashboard definition is based on Grafana 6.x dashboards. Not all Grafana 6.x dashboard features are supported in the OpenShift web console.
Verification steps
  1. In the Administrator view of the OpenShift web console, go to ObserveDashboards.

  2. Go to DashboardChe Server JVM and verify that the dashboard panels contain data.

    The *JVM quick facts* panel
    Figure 1. Quick Facts
    The *JVM Memory* panel
    Figure 2. JVM Memory
    The *JVM Misc* panel
    Figure 3. JVM Misc
    The *JVM Memory Pools (heap)* panel
    Figure 4. JVM Memory Pools (heap)
    The *JVM Memory Pools (non-heap)* panel
    Figure 5. JVM Memory Pools (Non-Heap)
    The *JVM garbage collection* panel
    Figure 6. Garbage Collection
    The *JVM class loading* panel
    Figure 7. Class loading
    The *JVM buffer pools* panel
    Figure 8. Buffer Pools