Class: Cloudscale::Plugins::MongoDbStatus

Inherits:
Plugin
  • Object
show all
Defined in:
lib/cloudscale/plugins/mongo/mongo_db_status.rb

Instance Attribute Summary

Attributes inherited from Plugin

#plugins, #rest_client

Instance Method Summary collapse

Methods inherited from Plugin

inherited, plugins, remove, remove_agenInstance, reset, resetRestEndpoint

Constructor Details

#initializeMongoDbStatus

Returns a new instance of MongoDbStatus.



22
23
24
25
26
# File 'lib/cloudscale/plugins/mongo/mongo_db_status.rb', line 22

def initialize
  super
  if is_enabled
  end
end

Instance Method Details

#collect(agentInstanceId) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/cloudscale/plugins/mongo/mongo_db_status.rb', line 28

def collect(agentInstanceId)
  log.info("Calling Collect on MongoDbStatus")
  stats = @db.stats

  registry.metrics["mongo.status.objects"] = metrics.gauge :status_objects do
    { :value => stats['objects'] }
  end

  report(indexMetric, menu, stats['indexes'], false, agentInstanceId, "dbIndexChart",
         "Indexes in database", "Total number of indexes in the database" , "area", "Time", "Count", "c", nil)

  report(dataSizeMetric, menu, stats['dataSize'], false, agentInstanceId, "dbDataSizeChart",
         "Data size of database", "Total data size of the database" , "area", "Time", "MB", "MB", nil)

  report(indexSizeMetric, menu, stats['indexSize'], false, agentInstanceId, "dbStorageSizeChart",
         "Storage size of database", "Total storage size of the database", "area", "Time", "MB", "MB", nil)

  report(storageSizeMetric, menu, stats['storageSize'], false, agentInstanceId, "dbIndexSizeChart",
        "Index size of database", "Total index size of the database" , "area", "Time", "MB", "MB", nil)

  report(collectionsMetric, menu, stats['collections'], false, agentInstanceId, "dbCollectionsChart",
       "Collections in database", "Total number of collections in the database" , "area", "Time", "Count", "c", nil)

  report(avgObjSizeMetric, menu, stats['avgObjSize'], false, agentInstanceId, "dbAvgObjSizeChart",
       "Average object size in database", "The average object size across all collections in the database" , "area", "Time", "MB", "MB", nil)
end

#is_enabledObject



18
19
20
# File 'lib/cloudscale/plugins/mongo/mongo_db_status.rb', line 18

def is_enabled
  false
end

#logObject



14
15
16
# File 'lib/cloudscale/plugins/mongo/mongo_db_status.rb', line 14

def log
  @log = Logger.new(STDOUT)
end