Under the Hood With Ambari Metrics and Grafana
Under the Hood With Ambari Metrics and Grafana
Ambari Metrics now has Grafana for awesome dashboards that you can build to visualize your data.
Join the DZone community and get the full member experience.Join For Free
Hortonworks Sandbox for HDP and HDF is your chance to get started on learning, developing, testing and trying out new features. Each download comes preconfigured with interactive tutorials, sample data and developments from the Apache community.
The Ambari Metrics System (AMS) released with Ambari 2.0 about a year ago is an Ambari-native pluggable and scalable system for collecting and querying Hadoop Metrics (AMBARI-5707). Since that time, the community has been working hard at adding new capabilities to the system and recently announced the availability of Ambari 2.2.2 where AMS now includes Grafana, a powerful dashboard builder that is fully open source with a wide community adoption.
Let’s take some time to look into the architectural and implementation details.
Background: Ambari Metrics System
For those unfamiliar with AMS, here’s a quick description: The architecture schematic shows the key components of this service. Metrics Collector is the REST API component that receives metrics payload as JSON over HTTP from the Sinks and Monitors. The metrics are written into the HBase storage layer which is dedicated storage for metric data and managed as a part of AMS, separate from the cluster HBase. The HBase schema is defined using Phoenix and all the read write operations from AMS are Phoenix jdbc API calls. The Sink implementations are native to AMS and are placed in the classpath of the supported Hadoop ecosystem services by Ambari. The Monitors are lightweight python daemons for system counters that use psutil native libraries for data collection. In addition to buffering and aggregating raw metric data, AMS provides capabilities like time based as well as application level aggregation along with functions like rate, diff, min, max, sum and count on all metrics.
AMS can scale horizontally by adding additional Collector nodes which effectively adds additional HBase Regionserver(s) to handle increased read/write load. Ambari stack advisor is utilized to advise on AMS configurations proportional to the number of Sinks and monitors and thereby the cluster size. The AMS HA feature is currently being worked on and should be part of the core platform soon.
AMS Grafana Integration
Grafana provides a powerful and customizable dashboard builder for visualizing time series data. Ambari installs Grafana v2.6 as a Master Component of AMS and adds a datasource for AMS to Grafana. The dashboard builder is supported through a Metadata API in AMS that allows easy discovery of metrics, applications and hosts which are the key components that formalize an API call to AMS. There has been significant work put into creating templated dashboards for Hadoop ecosystem services tailored towards analyzing issues and performance bottlenecks on the Hadoop cluster. The following is an image of the dashboard builder highlighting the metric name drop down with type ahead and auto complete along with options to apply aggregate functions as needed based on whether the metric is a GAUGE or a COUNTER.
Ambari versions and maintains these dashboards through upgrades. Moreover, security features like https are also available for the Grafana data source. We envision that with a simple integration story for AMS, majority of the services that are a part of Ambari ecosystem will very soon start using AMS as their metrics database and Grafana to derive rich and meaningful analytics. Presently HDFS, YARN and HBASE default dashboards are included along with System metrics. The following screen capture shows a view of the Containers Allocation for a YARN Queue. The Total Containers Allocated graph shows how many containers got allocated within the provided time range, the queue name selection appears as a drop down at the top left corner of the dashboard. Applying a diff function on this metric indicates how busy your queue is and a zero value would indicate that three are no more resources available to allocate, thereby resulting in a spike in the Containers Pending. This provides an intuitive way to determine resource utilization on the cluster with respect to capacity queues.
We look forward to adding more dashboards (such as HIVE, KAFKA and STORM) in future Ambari releases. So keep your eye on our blog for the latest.
Published at DZone with permission of Sid Wagle , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.