EMR Observability
When migrating Apache Hadoop and Spark workloads from on-premises to Amazon EMR, establishing comprehensive observability is critical for operational success. EMR provides multiple monitoring approaches that address the challenges of dynamic, cloud-based big data environments.
Native monitoring with Amazon CloudWatch
EMR automatically publishes cluster metrics to CloudWatch at five-minute intervals at no additional charge. CloudWatch is the foundation for EMR observability, providing visibility into cluster health, resource utilization, and job progress.
The key metrics are grouped into the following categories.
Cluster status metrics
-
IsIdle -
AppsRunning,AppsPending,AppsCompleted,AppsFailed -
ContainerAllocated,ContainerReserved,ContainerPending
Node health metrics
-
CoreNodesRunning,CoreNodesPending -
MRActiveNodes,MRUnhealthyNodes -
LiveDataNodes,DeadDataNodes -
MissingBlocks,CorruptBlocks
Resource utilization metrics
-
MemoryAvailableMB,YARNMemoryAvailablePercentage -
HDFSUtilization -
S3BytesRead,S3BytesWritten -
HDFSBytesRead,HDFSBytesWritten
You can access these metrics through the EMR console Monitoring tab or the CloudWatch console.
Setting up CloudWatch alarms
Configure automated alerts for critical thresholds. The following example defines an alarm on unhealthy nodes:
{ "AlarmName": "EMR-Cluster-Unhealthy-Nodes", "MetricName": "MRUnhealthyNodes", "Namespace": "AWS/ElasticMapReduce", "Statistic": "Average", "Period": 300, "EvaluationPeriods": 2, "Threshold": 1, "ComparisonOperator": "GreaterThanThreshold" }
Common alarm configurations include the following:
-
Cluster idle detection – alert when
IsIdle = 1for extended periods, for cost optimization. -
Node failure detection – alert when
MRUnhealthyNodes > 0orDeadDataNodes > 0. -
Storage capacity – alert when
HDFSUtilization > 80%. -
Application failures – alert when
AppsFailedexceeds a threshold.
Enhanced monitoring with the Amazon CloudWatch agent (EMR 7.x)
Beyond the default five-minute metrics, EMR 7.0 and later support enhanced monitoring through the Amazon CloudWatch agent, which publishes a broader set of metrics at one-minute granularity for faster detection. EMR 7.1 and later add customizable metric classifications for Hadoop, YARN, and HBase components, and EMR 7.11.0 adds near-real-time CloudWatch Logs streaming and live application UIs.
When migrating from on-premises monitoring, such as Ganglia or JMX polling, this provides finer-grained, near-real-time visibility without a self-managed metrics stack. For more information, see Enhanced monitoring with the CloudWatch agent in the Amazon EMR Management Guide. For example dashboards visualizing these metrics, see the figures in the Optimizing and monitoring your cluster section of the Cost Estimation and Optimization chapter, Cost Estimation and Optimization.
Enhanced observability with Prometheus and Grafana
For production workloads requiring deeper insights, AWS recommends integrating Amazon Managed Service for Prometheus and Amazon Managed Grafana to create a centralized, scalable observability platform.
Architecture overview
-
Prometheus exporters on EMR clusters – install JMX Exporter, Node Exporter, and application-specific exporters through bootstrap scripts.
-
Metrics collection – configure Prometheus to scrape metrics from YARN ResourceManager, HDFS NameNode, Spark applications, and HBase RegionServers.
-
Centralized storage – send metrics to an Amazon Managed Service for Prometheus workspace for long-term retention and cross-cluster aggregation.
-
Visualization – create dashboards in Amazon Managed Grafana for real-time operational visibility.
Benefits of Prometheus and Grafana
-
Task-level, node-level, and cluster-level metrics in a single pane of glass.
-
Real-time operational visibility across multiple EMR clusters and AWS accounts.
-
Centralized metric storage with configurable retention (default 150 days).
-
Custom alerting through Prometheus Alertmanager integrated with Amazon SNS.
Implementation example
The following bootstrap script installs the Prometheus JMX Exporter on EMR nodes:
#!/bin/bash # Install JMX Exporter for YARN and HDFS metrics sudo mkdir -p /opt/prometheus cd /opt/prometheus sudo wget https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.19.0/jmx_prometheus_javaagent-0.19.0.jar # Configure JMX Exporter for YARN ResourceManager sudo tee /opt/prometheus/yarn-config.yaml > /dev/null <<EOF lowercaseOutputName: true rules: - pattern: 'Hadoop<service=ResourceManager, name=QueueMetrics.*>' name: yarn_queue_metrics labels: queue: "\$1" EOF
Sample Grafana dashboard panels
-
YARN resource utilization – memory and vCore allocation across queues.
-
HDFS health – NameNode heap usage, DataNode availability, block replication status.
-
Spark application metrics – executor memory usage, task duration, shuffle read and write.
-
HBase performance – RegionServer request latency, compaction queue size, memstore size.
Application-specific monitoring
Spark observability
EMR provides persistent access to Spark application UIs through the Spark History Server, which stores event logs in S3 for post-job analysis. The following configuration enables the persistent Spark History Server:
[ { "Classification": "spark", "Properties": { "spark.eventLog.enabled": "true", "spark.eventLog.dir": "s3://my-bucket/spark-logs/", "spark.history.fs.logDirectory": "s3://my-bucket/spark-logs/" } } ]
Monitor the following key Spark metrics:
-
Executor metrics —
executor.memoryUsed,executor.diskUsed,executor.totalCores. -
Task metrics –
task.duration,task.shuffleReadBytes,task.shuffleWriteBytes. -
Stage metrics —
stage.completedTasks,stage.failedTasks,stage.executorRunTime. -
Application metrics –
app.duration,app.numExecutors,app.memoryUsed.
You can emit application-specific metrics to CloudWatch using custom SparkListeners.
class CloudWatchSparkListener extends SparkListener { override def onTaskEnd(taskEnd: SparkListenerTaskEnd): Unit = { val metrics = taskEnd.taskMetrics // Publish metrics to CloudWatch cloudWatch.putMetricData( namespace = "EMR/Spark", metricName = "TaskDuration", value = metrics.executorRunTime ) } }
YARN ResourceManager monitoring
YARN ResourceManager provides metrics for cluster resource allocation and application scheduling. Monitor the following critical YARN metrics:
-
Memory metrics –
availableMB,allocatedMB,totalMB,reservedMB. -
vCore metrics —
availableVirtualCores,allocatedVirtualCores,totalVirtualCores. -
Application metrics —
appsSubmitted,appsRunning,appsCompleted,appsFailed,appsKilled. -
Container metrics —
containersAllocated,containersReserved,containersPending.
You can access the YARN ResourceManager UI through the EMR console Application user interfaces tab.
HDFS monitoring
HDFS monitoring focuses on NameNode availability, DataNode health, and block replication. Monitor the following key HDFS metrics:
-
NameNode metrics –
CapacityUsed,CapacityRemaining,FilesTotal,BlocksTotal,MissingBlocks,CorruptBlocks. -
DataNode metrics –
BytesRead,BytesWritten,BlocksRead,BlocksWritten,VolumeFailures. -
Replication metrics —
UnderReplicatedBlocks,PendingReplicationBlocks,ScheduledReplicationBlocks.
Monitor HDFS health through CloudWatch metrics (HDFSUtilization,
MissingBlocks, CorruptBlocks), the HDFS NameNode UI, and
the Prometheus JMX Exporter.
Logging architecture
Persistent logging to Amazon S3
Enable cluster-wide log archival to S3 for long-term retention and post-mortem analysis. Configure S3 logging at cluster launch.
aws emr create-cluster \ --release-label emr-7.12.0 \ --applications Name=Spark Name=Hadoop \ --log-uri s3://my-bucket/emr-logs/ \ --instance-type m5.xlarge \ --instance-count 3
The following log types are archived to S3:
-
Cluster logs – bootstrap action logs, instance state logs, step logs.
-
Application logs – YARN container logs, Spark driver and executor logs, Hadoop MapReduce logs.
-
System logs – syslog, dmesg, cloud-init logs.
Logs are uploaded to S3 every 5 minutes and retained after cluster termination.
Real-time logging with CloudWatch Logs
For real-time log analysis and alerting, configure EMR to stream logs to CloudWatch Logs. Install the CloudWatch agent through a bootstrap script.
#!/bin/bash sudo yum install -y amazon-cloudwatch-agent sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \ -a fetch-config \ -m ec2 \ -c file:/opt/aws/amazon-cloudwatch-agent/etc/config.json \ -s
CloudWatch Logs support the following use cases:
-
Real-time error detection – create metric filters to detect ERROR and FATAL log patterns.
-
Application debugging – search and filter logs across all cluster nodes from a single interface.
-
Compliance and auditing – centralized log retention with configurable retention policies.
Migration considerations from on-premises
When transitioning from on-premises monitoring tools to AWS, consider the following:
-
Replace Ganglia – Ganglia is the default monitoring tool for on-premises Hadoop. The migration path is to replace it with CloudWatch for basic metrics plus Grafana for advanced dashboards. The benefit is that a managed service eliminates maintaining Ganglia infrastructure.
-
Replace Nagios and Zabbix – these are on-premises custom scripts and agents for alerting. The AWS alternative is CloudWatch alarms with Amazon SNS notifications. The benefit is native integration with EMR metrics and no agent installation.
-
Centralize logging – on-premises logs are scattered across cluster nodes. The AWS alternative is S3 for persistent storage plus CloudWatch Logs for real-time analysis. The benefit is that logs survive cluster termination and are searchable across all nodes.
-
Unified dashboards – on-premises environments use separate dashboards for YARN, HDFS, Spark, and HBase. The AWS solution is Amazon Managed Grafana with unified dashboards. The benefit is a single pane of glass for multi-cluster, multi-application observability.
Performance optimization tools
AWS EMR Advisor is an open-source tool, available from the aws-samples/aws-emr-advisor
repository on GitHub, that analyzes Spark event logs to provide cluster right-sizing and
cost-optimization recommendations. Use it after representative runs to identify over-provisioned
resources and tune cluster configuration for cost and performance. For more information, see
aws-samples/aws-emr-advisor
Best practices summary
This chapter covered the following observability approaches:
-
Start with native CloudWatch metrics (five-minute, no additional charge) for baseline cluster health.
-
Enable the Amazon CloudWatch agent on EMR 7.x for one-minute granularity and component-level metrics.
-
Adopt Amazon Managed Service for Prometheus and Amazon Managed Grafana for centralized, multi-cluster dashboards and custom alerting.
-
Enable the persistent Spark History Server and S3 log archival so logs survive cluster termination.
-
Use CloudWatch Logs for real-time error detection and auditing.
-
Replace on-premises Ganglia, Nagios, Zabbix, and scattered logging with the EMR-native model.
-
Set CloudWatch alarms with Amazon SNS on critical cluster-health, capacity, and application-failure metrics.
Documentation and resources
-
Monitor Amazon EMR metrics with CloudWatch in the Amazon EMR Management Guide.
-
Enhanced monitoring with the CloudWatch agent in the Amazon EMR Management Guide.
-
Publish Amazon EMR logs to CloudWatch Logs in the Amazon EMR Management Guide.