Apache Hadoop integration for Grafana Cloud
Apache Hadoop is an open-source framework designed to process and store large amounts of data across distributed clusters of computers. It provides a scalable and fault-tolerant solution for handling big data by utilizing a distributed file system (Hadoop Distributed File System) and a parallel processing model (MapReduce). This integration for Grafana Cloud allows users to monitor a Hadoop cluster with 4 separate dashboards for visualizing metrics and logs for a Hadoop NameNode, DataNode, NodeManager, and ResourceManager component.
This integration supports Apache Hadoop version 3.3.1+
Apache Hadoop 3.3 and upper supports Java 8 and Java 11 (runtime only)
This integration supports the JMX exporter 0.17.0+
This integration includes 8 useful alerts and 4 pre-built dashboards to help monitor and visualize Apache Hadoop metrics and logs.
Before you begin
In order for the integration to properly work, you must set up the JMX Exporter for Prometheus on each instance in your cluster.
Set up JMX Exporter
Each instance requires a JMX to Prometheus exporter. This is a collector that creates an HTTP server that serves mBean metrics of the local JVM target. Depending on the Apache Hadoop component being monitored - i.e., the NameNode, DataNode, NodeManager and/or ResourceManager - a slightly different configuration will be used. Typically, a DataNode and a NodeManager are grouped together, while the ResourceManager and NameNode are separate. However, each Hadoop deployment architecture may vary.
Expose JMX Remotely
To expose the JMX remotely, it needs to be enabled for the components being monitored. A configuration option enables JMX on the Hadoop daemons, which exists in a
hadoop-env.sh file located in the
/etc/hadoop/conf. Within the bash file, there is a
HDFS_<COMPONENT>_OPTS value that will take an argument to enable JMX, specify the <JMX_PORT>, and manage security options. It should look similar to:
export HDFS_<COMPONENT>_OPTS="-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=<JMX_PORT> -Dcom.sun.management.jmxremote.ssl=false"
Then save the configuration file and restart the Hadoop daemons. For more details on setting up an Apache Hadoop cluster environment, refer to the official documentation.
Connect JMX to the Prometheus Exporter
In order to connect JMX to the Prometheus Exporter, a collector is configured in a config file for each component being monitored. This
namenode.yaml, can be placed anywhere and named anything but must specify the exposed
JMX_PORT for the component being monitored. It should look similar to:
hostPort: localhost:<JMX_PORT> lowercaseOutputName: true lowercaseOutputLabelNames: true rules: - pattern: ".*"
Run the Prometheus Exporter
To run the JMX to Prometheus exporter, the Java Agent or a Standalone HTTP Server is used. These require two arguments: a
To run the JMX to Prometheus exporter as a Java Agent:
java -javaagent:./jmx_prometheus_javaagent-0.17.0.jar=<JMX_EXPORTER_PORT>:<COMPONENT>.yaml -jar yourJar.jar
To run the JMX to Prometheus exporter as a Standalone HTTP Server:
java -jar jmx_prometheus_httpserver-0.17.0.jar <JMX_EXPORTER_PORT> /path-to-jmx-configs/<COMPONENT>.yaml
To validate that the JMX Exporter is setup correctly, the Prometheus metrics should be available locally via curl:
Install Apache Hadoop integration for Grafana Cloud
- In your Grafana Cloud stack, click Connections in the left-hand menu.
- Find Apache Hadoop and click its tile to open the integration.
- Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send Apache Hadoop metrics and logs to your Grafana Cloud instance.
- Click Install to add this integration’s pre-built dashboards and alerts to your Grafana Cloud instance, and you can start monitoring your Apache Hadoop setup.
Post-install configuration for the Apache Hadoop integration
After enabling the metrics generation, instruct the Grafana Agent to scrape your Apache Hadoop component. The Grafana Agent config is stored in
Enable the integration by adding the suggested snippets to your agent configuration file.
If you want to show logs and metrics signals correlated in your dashboards as a single pane of glass, ensure the following:
instancelabel values must match for the Apache Hadoop integration and logs scrape config in your agent configuration file.
jobmust be set to
integrations/apache-hadoop(already configured in the snippets).
instancemust be set to a value that uniquely identifies your Apache Hadoop node.
hadoop_clustermust be the value that identifies the Apache Hadoop cluster this node belongs to.
__path__is the component log location, which the default Apache Hadoop log path is indicated in the
HADOOP_LOG_DIRfor your system located in
/etc/hadoop/conf. An example log path may look like
Make sure to change
targets in the snippet according to your host name and
On Linux, you will also need to add the
grafana-agent user to the
hadoop group to get logs. Run the following command to configure the user as required:
sudo usermod -a -G hadoop grafana-agent
Configuration snippets for Grafana Agent
metrics.configs.scrape_configs, insert the following lines and change the URLs according to your environment:
- job_name: integrations/apache-hadoop metrics_path: /metrics static_configs: - targets: ['<your-host-name>:<jmx-exporter-port>'] labels: instance: '<your-instance-name>' hadoop_cluster: '<your-cluster-name>'
logs.configs.scrape_configs, insert the following lines according to your environment.
- job_name: integrations/apache-hadoop static_configs: - targets: - localhost labels: job: integrations/apache-hadoop instance: '<your-instance-name>' hadoop_cluster: '<your-cluster-name>' __path__: '<your-log-path>'
Full example configuration for Grafana Agent
Refer to the following Grafana Agent configuration for a complete example that contains all the snippets used for the Apache Hadoop integration. This example also includes metrics that are sent to monitor your Grafana Agent instance.
integrations: prometheus_remote_write: - basic_auth: password: <your_prom_pass> username: <your_prom_user> url: <your_prom_url> agent: enabled: true relabel_configs: - action: replace source_labels: - agent_hostname target_label: instance - action: replace target_label: job replacement: "integrations/agent-check" metric_relabel_configs: - action: keep regex: (prometheus_target_.*|prometheus_sd_discovered_targets|agent_build.*|agent_wal_samples_appended_total|process_start_time_seconds) source_labels: - __name__ # Add here any snippet that belongs to the `integrations` section. # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line. logs: configs: - clients: - basic_auth: password: <your_loki_pass> username: <your_loki_user> url: <your_loki_url> name: integrations positions: filename: /tmp/positions.yaml scrape_configs: # Add here any snippet that belongs to the `logs.configs.scrape_configs` section. # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line. - job_name: integrations/apache-hadoop static_configs: - targets: - localhost labels: job: integrations/apache-hadoop instance: '<your-instance-name>' hadoop_cluster: '<your-cluster-name>' __path__: '<your-log-path>' metrics: configs: - name: integrations remote_write: - basic_auth: password: <your_prom_pass> username: <your_prom_user> url: <your_prom_url> scrape_configs: # Add here any snippet that belongs to the `metrics.configs.scrape_configs` section. # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line. - job_name: integrations/apache-hadoop metrics_path: /metrics static_configs: - targets: ['<your-host-name>:<jmx-exporter-port>'] labels: instance: '<your-instance-name>' hadoop_cluster: '<your-cluster-name>' global: scrape_interval: 60s wal_directory: /tmp/grafana-agent-wal
The Apache Hadoop integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.
- Apache Hadoop DataNode overview
- Apache Hadoop NameNode overview
- Apache Hadoop NodeManager overview
- Apache Hadoop ResourceManager overview
Apache Hadoop NameNode overview (1/2)
Apache Hadoop DataNode overview (1/1)
Apache Hadoop NodeManger overview (1/2)
The Apache Hadoop integration includes the following useful alerts:
|ApacheHadoopLowHDFSCapacity||Warning: Remaining HDFS cluster capacity is low which may result in DataNode failures or prevent DataNodes from writing data.|
|ApacheHadoopHDFSMissingBlocks||Critical: There are missing blocks in the HDFS cluster which may indicate potential data loss.|
|ApacheHadoopHDFSHighVolumeFailures||Critical: A volume failure in HDFS cluster may indicate hardware failures.|
|ApacheHadoopHighDeadDataNodes||Critical: Number of dead DataNodes has increased, which could result in data loss and increased network activity.|
|ApacheHadoopHighNodeManagerCPUUsage||Critical: A NodeManager has a CPU usage higher than the configured threshold.|
|ApacheHadoopHighNodeManagerMemoryUsage||Critical: A NodeManager has a higher memory utilization than the configured threshold.|
|ApacheHadoopHighResourceManagerVirtualCoreCPUUsage||Critical: A ResourceManager has a virtual core CPU usage higher than the configured threshold.|
|ApacheHadoopHighResourceManagerMemoryUsage||Critical: A ResourceManager has a higher memory utilization than the configured threshold.|
The most important metrics provided by the Apache Hadoop integration, which are used on the pre-built dashboards and Prometheus alerts, are as follows:
# 0.0.3 - September 2023 * New Filter Metrics option for configuring the Grafana Agent, which saves on metrics cost by dropping any metric not used by this integration. Beware that anything custom built using metrics that are not on the snippet will stop working. * New hostname relabel option, which applies the instance name you write on the text box to the Grafana Agent configuration snippets, making it easier and less error prone to configure this mandatory label. # 0.0.2 - August 2023 * Add regex filter for logs datasource # 0.0.1 - July 2023 * Initial release
By connecting your Apache Hadoop instance to Grafana Cloud, you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see Active series and dpm usage and Cloud tier pricing.