3.2. Adding Grafana to Ambari Metrics

As of Ambari 2.2.2, Grafana is now included as a component of Ambari Metrics. You must add Grafana to the system and install Grafana on a host in the cluster.

[Note]Note

When using the API commands below, be sure to replace the ambari.server with the Ambari Server hostname, cluster.name with your cluster name and host.name with the host where you will run Grafana. This can be the same host that is running the Metrics Colllector.

  1. Upgrade to Ambari 2.2.2 and perform needed post-upgrade checks. Make sure all services are up and healthy.

  2. Add the METRICS_GRAFANA component to Ambari:

    curl -u admin:admin -H "X-Requested-By:ambari" -i -X POST
    http://ambari.server:8080/api/v1/clusters/cluster.name/services/AMBARI_METRICS/components/METRICS_GRAFANA
  3. Add METRICS_GRAFANA to a host in the cluster.

    curl -u admin:admin -H "X-Requested-By:ambari" -i -X POST -d
    '{"host_components":[{"HostRoles":{"component_name":"METRICS_GRAFANA"}}]}'
    http://ambari.server:8080/api/v1/clusters/cluster.name/hosts?Hosts/host_name=host.name 
  4. From Ambari Web, browse to Services > Ambari Metrics and you will see Grafana is in the Install Pending… state. You need to complete the configuration of Grafana before installing and starting.

  5. To complete the configuration, click on Services > Ambari Metrics > Configs and you will need to enter the default Grafana Admin Password in the General section. Click Save.

  6. Browse to Hosts > host.name (i.e. the host.name used in the API call where you added Grafana). You will see the Grafana component is in an Install Pending… state. Use the Install Pending… action button and select Re-install.

    Figure 3.1. installgrafanapending.png


  7. Once the install operation completes, select Start to start Grafana.

  8. To access Grafana, browse to Services > Ambari Metrics, select Quick Links and then choose Grafana.

  9. Refer to the Ambari User’s Guide for more information on Using Grafana.