13.2.1 Set Up Prometheus and Grafana

Set up Prometheus and Grafana in the Kubernetes cluster where you have installed MicroTx to monitor MicroTx.

Before you begin, ensure that you have installed Istio and MicroTx.
  1. Set the metrics property to true in the values.yaml file, Helm Chart used to deploy the MicroTx coordinator. You must set this property to enable Prometheus to scrape the metrics logs of the MicroTx coordinator.

    The following code snippet provides a sample value for the metrics property in the values.yaml file.

    metrics:
      enabled: true
  2. Open the prometheus.yaml file in any code editor.
    When you download the Istio installation bundle, it contains prometheus.yaml, a basic sample installation to quickly get Prometheus up and running. The prometheus.yaml file is available in the samples/addon folder at the location where you have downloaded the Istio installation files.
  3. Under scrape_configs, add the following lines of code and save the changes.
    scrape_configs:
    - job_name: tcs-metric
      static_configs:
      - targets:
        - 192.0.2.1

    Where, 192.0.2.1 is the external IP address of the Istio ingress gateway. For details about how to note down this value, see Find IP Address of Istio Ingress Gateway.

  4. Run the following command to install Prometheus.
    kubectl apply -f samples/addons/prometheus.yaml
  5. Run the following command to verify that Prometheus was installed.
    kubectl -n istio-system get svc prometheus
  6. Ensure that Prometheus service discovery is able to discover the MicroTx host. Refer to the Prometheus documentation for more details.
    To ensure that Prometheus can discover the MicroTx host, check the Targets in Prometheus or search for any one of the MicroTx metrics in the Prometheus UI.
  7. Install Grafana.
    kubectl apply -f samples/addons/grafana.yaml
    When you download the Istio installation bundle, it contains grafana.yaml, a basic sample installation to quickly get Grafana up and running. The grafana.yaml file is available in the samples/addon folder at the location where you have downloaded the Istio installation files.

    Alternatively, install Grafana separately. See https://grafana.com/docs/grafana/latest/installation/kubernetes/.

  8. Run the following command to verify that Grafana was installed.
    kubectl -n istio-system get svc grafana
  9. Start the Grafana dashboard.
    istioctl dashboard grafana
    The Grafana dashboard opens in a new browser. Notw down the link to access the Grafana dashboard.
  10. Create a Prometheus data source in Grafana, so that the MicroTx metrics scraped by Prometheus are displayed in the Grafana dashboard.
  11. Import MicroTx dashboard by importing the JSON file which contains metrics and details about MicroTx. This file is located at <installation_directory>/otmm-<version>/otmm/dashboards/microtx-dashboard.json.
    For information about importing dashboards in Grafana, see https://grafana.com/docs/grafana/latest/dashboards/export-import/#import-dashboard.