Class: HadoopMetrics2::ResourceManager

Inherits:
Object
  • Object
show all
Includes:
API
Defined in:
lib/hadoop_metrics2/resource_manager.rb

Constant Summary collapse

NODE_TYPE =
'rm'
JSON_FILED_VALUES =
%W(LiveNodeManagers)

Constants included from API

API::GCNameMap, API::MegaByte

Instance Attribute Summary

Attributes included from API

#name

Instance Method Summary collapse

Methods included from API

#gc, #get_jmx, #initialize, #memory, #metrics, #query_jmx, #scheduler, #via_jmx

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class HadoopMetrics2::API

Instance Method Details

#application(opts = {}) ⇒ Object



14
15
16
17
18
# File 'lib/hadoop_metrics2/resource_manager.rb', line 14

def application(opts = {})
  column = get_column(opts)
  column = HadoopMetrics2.to_snake_case(column) if @snake_case
  metrics(get_force(opts))['clusterMetrics']
end

#fairscheduler_active_apps(opts = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/hadoop_metrics2/resource_manager.rb', line 20

def fairscheduler_active_apps(opts = {})
  targets = scheduler(get_force(opts))['scheduler']['schedulerInfo']['rootQueue']['childQueues']
  return targets nil if targets.nil?

  each_apps = {}
  targets.each { |target|
    name = target['queueName'].gsub(/root./, '')
    each_apps[name] ||= 0
    each_apps[name] += target['numActiveApps']
  }
  each_apps
end

#infoObject



10
11
12
# File 'lib/hadoop_metrics2/resource_manager.rb', line 10

def info
  query_jmx('Hadoop:service=ResourceManager,name=RMNMInfo', JSON_FILED_VALUES).first
end