Class: Cephdetail::Health

Inherits:
Object
  • Object
show all
Defined in:
lib/cephdetail.rb

Overview

The Health class exposes health data from the /detail endpoint of the Ceph REST API.

Example:

>> health = Cephdetail::Health.new
>> df = health.df
>> status = health.status
>> cluster_health = health.cluster_health
>> osdstat = health.osdstat
>> osdperf = health.osdperf
>> pgstat = health.pgstat

Instance Method Summary collapse

Constructor Details

#initializeHealth

Fetch the URL for the Ceph REST API server in your environment



30
31
32
# File 'lib/cephdetail.rb', line 30

def initialize
  @api_url = ENV['CEPH_REST_API']
end

Instance Method Details

#cluster_healthObject

Return /health?detail data (ceph health detail) in the form of a Ruby Hash for manipulation by other code/applications. Uses the private check(attrib) method to make the HTTP request.



50
51
52
# File 'lib/cephdetail.rb', line 50

def cluster_health
  return check("health?detail")
end

#dfObject

Return disk usage stats (ceph df) in the form of a Ruby Hash for manipulation by other code/applications. Uses the private check(attrib) method to make the HTTP request.



38
39
40
# File 'lib/cephdetail.rb', line 38

def df
  return check("df")
end

#osdperfObject

Return /osd/perf data (ceph osd perf) in the form of a Ruby Hash for manipulation by other code/applications. Uses the private check(attrib) method to make the HTTP request



62
63
64
# File 'lib/cephdetail.rb', line 62

def osdperf
  return check("osd/perf")
end

#osdstatObject

Return /osd/stat data (ceph osd stat) in the form of a Ruby Hash for manipulation by other code/applications. Uses the private check(attrib) method to make the HTTP request.



56
57
58
# File 'lib/cephdetail.rb', line 56

def osdstat
  return check("osd/stat")
end

#pgstatObject

Return /pg/stat data (ceph pg stat) in the form of a Ruby Hash for manipulation by other code/applications. Uses the private check(attrib) method to make the HTTP request. WARNING: On large clusters, the result set will be massive!!!



69
70
71
# File 'lib/cephdetail.rb', line 69

def pgstat
  return check("pg/stat")
end

#statusObject

Return /status data (ceph -s) in the form of a Ruby Hash for manipulation by other code/applications. Uses the private check(attrib) method to make the HTTP request.



44
45
46
# File 'lib/cephdetail.rb', line 44

def status
  return check("status")
end