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 Prometheus to collect, store, and query JVM metrics for Che Server:

Prerequisites
Procedure
  1. 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 the data field of the ConfigMap.
    Example 1. Prometheus configuration
    apiVersion: 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 is eclipse-che.
  2. 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
Verification
  1. Use port forwarding to access the Prometheus Service locally:

    $ kubectl port-forward svc/prometheus 9090:9090 -n monitoring
  2. Verify that all targets are up by viewing the targets endpoint at localhost:9090/targets.

  3. Use the Prometheus console to view and query metrics:

Viewing Che Server metrics on Grafana dashboards

To view the Che Server metrics on Grafana:

Prerequisites
Procedure
  1. Add the data source for the Prometheus instance. See Creating a Prometheus data source.

  2. Import the example dashboard. See Import dashboard.

  3. View the Che JVM metrics in the Grafana console:

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