Class: Cloudscale::Plugins::MongoServerStatus
- Defined in:
- lib/cloudscale/plugins/mongo/mongo_server_status.rb
Instance Attribute Summary collapse
-
#db ⇒ Object
Returns the value of attribute db.
-
#generalInformation ⇒ Object
readonly
Returns the value of attribute generalInformation.
-
#globalLockLockTime ⇒ Object
readonly
Returns the value of attribute globalLockLockTime.
-
#globalLockTotalTime ⇒ Object
readonly
Returns the value of attribute globalLockTotalTime.
-
#indexCountersBtreeAccesses ⇒ Object
readonly
Returns the value of attribute indexCountersBtreeAccesses.
-
#indexCountersBtreeHits ⇒ Object
readonly
Returns the value of attribute indexCountersBtreeHits.
-
#indexCountersBtreeMisses ⇒ Object
readonly
Returns the value of attribute indexCountersBtreeMisses.
-
#memBits ⇒ Object
readonly
Returns the value of attribute memBits.
-
#memMapped ⇒ Object
readonly
Returns the value of attribute memMapped.
-
#memMappedWithJournal ⇒ Object
readonly
Returns the value of attribute memMappedWithJournal.
-
#memResident ⇒ Object
readonly
Returns the value of attribute memResident.
-
#memVirtual ⇒ Object
readonly
Returns the value of attribute memVirtual.
-
#menu_generalInformation ⇒ Object
readonly
Returns the value of attribute menu_generalInformation.
-
#menu_globalLock ⇒ Object
readonly
Returns the value of attribute menu_globalLock.
-
#menu_idxCounter ⇒ Object
readonly
Returns the value of attribute menu_idxCounter.
-
#menu_memory ⇒ Object
readonly
Returns the value of attribute menu_memory.
-
#menu_network ⇒ Object
readonly
Returns the value of attribute menu_network.
-
#menu_opCounter ⇒ Object
readonly
Returns the value of attribute menu_opCounter.
-
#networkBytesIn ⇒ Object
readonly
Returns the value of attribute networkBytesIn.
-
#networkBytesOut ⇒ Object
readonly
Returns the value of attribute networkBytesOut.
-
#networkNumOfRequests ⇒ Object
readonly
Returns the value of attribute networkNumOfRequests.
-
#opcountersDelete ⇒ Object
readonly
Returns the value of attribute opcountersDelete.
-
#opcountersGetMore ⇒ Object
readonly
Returns the value of attribute opcountersGetMore.
-
#opcountersInsert ⇒ Object
readonly
Returns the value of attribute opcountersInsert.
-
#opcountersQuery ⇒ Object
readonly
Returns the value of attribute opcountersQuery.
-
#opcountersUpdate ⇒ Object
readonly
Returns the value of attribute opcountersUpdate.
Attributes inherited from Plugin
Instance Method Summary collapse
- #collect(agentInstanceId) ⇒ Object
-
#initialize ⇒ MongoServerStatus
constructor
A new instance of MongoServerStatus.
- #is_enabled ⇒ Object
- #log ⇒ Object
- #report_general_information(agentInstanceId) ⇒ Object
- #report_global_lock_times(agentInstanceId) ⇒ Object
- #report_index_counters(agentInstanceId) ⇒ Object
- #report_memory(agentInstanceId) ⇒ Object
- #report_network(agentInstanceId) ⇒ Object
- #report_op_counters(agentInstanceId) ⇒ Object
Methods inherited from Plugin
inherited, plugins, remove, remove_agenInstance, reset, resetRestEndpoint
Constructor Details
#initialize ⇒ MongoServerStatus
Returns a new instance of MongoServerStatus.
27 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 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 27 def initialize super if is_enabled = Plugins::PluginMenus.load_hash() @menu_generalInformation = (["mongodb-server-stats"], "generalInformation") @menu_idxCounter = (["mongodb-server-stats"], "indexCounters") @menu_globalLock = (["mongodb-server-stats"], "globalLock") @menu_opCounter = (["mongodb-server-stats"], "opCounters") @menu_memory = (["mongodb-server-stats"], "memory") @menu_network = (["mongodb-server-stats"], "network") @db = Plugins::PluginPreop.instance.db components = Plugins::PluginComponents.load_hash() @indexCountersBtreeHits = load_metric(components["mongodb-server-stats"], "indexCountersBtreeHits") @indexCountersBtreeAccesses = load_metric(components["mongodb-server-stats"], "indexCountersBtreeAccesses") @indexCountersBtreeMisses = load_metric(components["mongodb-server-stats"], "indexCountersBtreeMisses") @globalLockLockTime = load_metric(components["mongodb-server-stats"], "globalLockLockTime") @globalLockTotalTime = load_metric(components["mongodb-server-stats"], "globalLockTotalTime") @opcountersInsert = load_metric(components["mongodb-server-stats"], "opcountersInsert") @opcountersQuery = load_metric(components["mongodb-server-stats"], "opcountersQuery") @opcountersUpdate = load_metric(components["mongodb-server-stats"], "opcountersUpdate") @opcountersDelete = load_metric(components["mongodb-server-stats"], "opcountersDelete") @opcountersGetMore = load_metric(components["mongodb-server-stats"], "opcountersGetMore") @generalInformation = load_metric(components["mongodb-server-stats"], "generalInformation") @memBits = load_metric(components["mongodb-server-stats"], "memBits") @memResident = load_metric(components["mongodb-server-stats"], "memResident") @memVirtual = load_metric(components["mongodb-server-stats"], "memVirtual") @memMapped = load_metric(components["mongodb-server-stats"], "memMapped") @memMappedWithJournal = load_metric(components["mongodb-server-stats"], "memMappedWithJournal") @networkBytesIn = load_metric(components["mongodb-server-stats"], "networkBytesIn") @networkBytesOut = load_metric(components["mongodb-server-stats"], "networkBytesOut") @networkNumOfRequests = load_metric(components["mongodb-server-stats"], "networkNumOfRequests") end end |
Instance Attribute Details
#db ⇒ Object
Returns the value of attribute db.
13 14 15 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 13 def db @db end |
#generalInformation ⇒ Object (readonly)
Returns the value of attribute generalInformation.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def generalInformation @generalInformation end |
#globalLockLockTime ⇒ Object (readonly)
Returns the value of attribute globalLockLockTime.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def globalLockLockTime @globalLockLockTime end |
#globalLockTotalTime ⇒ Object (readonly)
Returns the value of attribute globalLockTotalTime.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def globalLockTotalTime @globalLockTotalTime end |
#indexCountersBtreeAccesses ⇒ Object (readonly)
Returns the value of attribute indexCountersBtreeAccesses.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def indexCountersBtreeAccesses @indexCountersBtreeAccesses end |
#indexCountersBtreeHits ⇒ Object (readonly)
Returns the value of attribute indexCountersBtreeHits.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def indexCountersBtreeHits @indexCountersBtreeHits end |
#indexCountersBtreeMisses ⇒ Object (readonly)
Returns the value of attribute indexCountersBtreeMisses.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def indexCountersBtreeMisses @indexCountersBtreeMisses end |
#memBits ⇒ Object (readonly)
Returns the value of attribute memBits.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def memBits @memBits end |
#memMapped ⇒ Object (readonly)
Returns the value of attribute memMapped.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def memMapped @memMapped end |
#memMappedWithJournal ⇒ Object (readonly)
Returns the value of attribute memMappedWithJournal.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def memMappedWithJournal @memMappedWithJournal end |
#memResident ⇒ Object (readonly)
Returns the value of attribute memResident.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def memResident @memResident end |
#memVirtual ⇒ Object (readonly)
Returns the value of attribute memVirtual.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def memVirtual @memVirtual end |
#menu_generalInformation ⇒ Object (readonly)
Returns the value of attribute menu_generalInformation.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def @menu_generalInformation end |
#menu_globalLock ⇒ Object (readonly)
Returns the value of attribute menu_globalLock.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def @menu_globalLock end |
#menu_idxCounter ⇒ Object (readonly)
Returns the value of attribute menu_idxCounter.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def @menu_idxCounter end |
#menu_memory ⇒ Object (readonly)
Returns the value of attribute menu_memory.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def @menu_memory end |
#menu_network ⇒ Object (readonly)
Returns the value of attribute menu_network.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def @menu_network end |
#menu_opCounter ⇒ Object (readonly)
Returns the value of attribute menu_opCounter.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def @menu_opCounter end |
#networkBytesIn ⇒ Object (readonly)
Returns the value of attribute networkBytesIn.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def networkBytesIn @networkBytesIn end |
#networkBytesOut ⇒ Object (readonly)
Returns the value of attribute networkBytesOut.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def networkBytesOut @networkBytesOut end |
#networkNumOfRequests ⇒ Object (readonly)
Returns the value of attribute networkNumOfRequests.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def networkNumOfRequests @networkNumOfRequests end |
#opcountersDelete ⇒ Object (readonly)
Returns the value of attribute opcountersDelete.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def opcountersDelete @opcountersDelete end |
#opcountersGetMore ⇒ Object (readonly)
Returns the value of attribute opcountersGetMore.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def opcountersGetMore @opcountersGetMore end |
#opcountersInsert ⇒ Object (readonly)
Returns the value of attribute opcountersInsert.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def opcountersInsert @opcountersInsert end |
#opcountersQuery ⇒ Object (readonly)
Returns the value of attribute opcountersQuery.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def opcountersQuery @opcountersQuery end |
#opcountersUpdate ⇒ Object (readonly)
Returns the value of attribute opcountersUpdate.
14 15 16 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 14 def opcountersUpdate @opcountersUpdate end |
Instance Method Details
#collect(agentInstanceId) ⇒ Object
67 68 69 70 71 72 73 74 75 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 67 def collect(agentInstanceId) log.info("Calling Collect on MongoServerStatus") report_index_counters(agentInstanceId) report_global_lock_times(agentInstanceId) report_op_counters(agentInstanceId) report_general_information(agentInstanceId) report_memory(agentInstanceId) report_network(agentInstanceId) end |
#is_enabled ⇒ Object
23 24 25 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 23 def is_enabled false end |
#log ⇒ Object
19 20 21 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 19 def log @log = Logger.new(STDOUT) end |
#report_general_information(agentInstanceId) ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 109 def report_general_information(agentInstanceId) stats = @db.command('serverStatus' => 1) body = Array.new body.push(["Host", stats['host']]) body.push(["Version", stats['version']]) body.push(["Uptime", stats['uptime']]) body.push(["Local time", stats['localTime']]) body.push(["Connections currently", stats['connections']['current']]) body.push(["Connections available", stats['connections']['available']]) mongo_general_inf_table = Monitor::Table.new("generalInformationMonGo", "MongoDB General Information", nil, body, "compact") mongo_general_inf_table.caption = "General Information regarding your MongoDB Instance" persist_table(mongo_general_inf_table, agentInstanceId, ) end |
#report_global_lock_times(agentInstanceId) ⇒ Object
159 160 161 162 163 164 165 166 167 168 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 159 def report_global_lock_times(agentInstanceId) stats = @db.command('serverStatus' => 1) if stats['globalLock'] report(globalLockLockTime, , stats['globalLock']['lockTime'], false, agentInstanceId, "globalLockLockTimeChart", "Globallock Lock Time", "The global lock time across collections in the database" , "area", "Time", "", "s", nil) report(globalLockTotalTime, , stats['globalLock']['totalTime'], false, agentInstanceId, "globalLockTotalTimeChart", "Number of btree hits", "The global lock time in total across collections in the database" , "area", "Time", "", "s", nil) end end |
#report_index_counters(agentInstanceId) ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 144 def report_index_counters(agentInstanceId) stats = @db.command('serverStatus' => 1) if (stats["indexCounters"] and stats["indexCounters"]["btree"]) report(indexCountersBtreeAccesses, , stats['indexCounters']['btree']['accesses'], true, agentInstanceId, "btreeAccessesChart", "Number of btree accesses", "Number of btree accesses across all collections in the database" , "area", "Time", "Count", "c", "s") report(indexCountersBtreeMisses, , stats['indexCounters']['btree']['misses'], true, agentInstanceId, "btreeMissesChart", "Number of btree misses", "Number of btree misses across all collections in the database" , "area", "Time", "Count", "c", "s") report(indexCountersBtreeHits, , stats['indexCounters']['btree']['hits'], true, agentInstanceId, "btreeHitsChart", "Number of btree hits", "Number of btree hits across all collections in the database" , "area", "Time", "Count", "c", "s") end end |
#report_memory(agentInstanceId) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 77 def report_memory(agentInstanceId) stats = @db.command('serverStatus' => 1) report(memBits, , stats['mem']['bits'], false, agentInstanceId, "memBitsChart", "Memory bits", "Memory bits across collections in the database", "area", "Time", "Count", "c", nil) report(memResident, , stats['mem']['resident'], false, agentInstanceId, "memResidentChart", "Memory resident", "Memory resident across collections in the database", "area", "Time", "Count", "c", nil) report(memVirtual, , stats['mem']['virtual'], false, agentInstanceId, "memVirtualChart", "Memory virtual", "Memory virtual across collections in the database", "area", "Time", "Count", "c", nil) report(memMapped, , stats['mem']['mapped'], false, agentInstanceId, "memMappedChart", "Memory mapped", "Memory mapped across collections in the database", "area", "Time", "Count", "c", nil) report(memMappedWithJournal, , stats['mem']['mappedWithJournal'], false, agentInstanceId, "memMappedWithJournalChart", "Memory mapped with Journal", "Memory mapped with Journal across collections in the database", "area", "Time", "Count", "c", nil) end |
#report_network(agentInstanceId) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 96 def report_network(agentInstanceId) stats = @db.command('serverStatus' => 1) report(networkBytesIn, , stats['network']['bytesIn'], true, agentInstanceId, "networkBytesInChart", "Network Bytes in", "Network Bytes in", "area", "Time", "Count", "B", "s") report(networkBytesOut, , stats['network']['bytesOut'], true, agentInstanceId, "networkBytesOutChart", "Network Bytes out", "Network Bytes out", "area", "Time", "Count", "B", "s") report(networkNumOfRequests, , stats['network']['numRequests'], true, agentInstanceId, "networkNumOfRequests", "Number of Requests", "Number of Requests", "area", "Time", "Count", "c", "s") end |
#report_op_counters(agentInstanceId) ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/cloudscale/plugins/mongo/mongo_server_status.rb', line 125 def report_op_counters(agentInstanceId) stats = @db.command('serverStatus' => 1) report(opcountersInsert, , stats['opcounters']['insert'], true, agentInstanceId, "opcountersInsertChart", "Operation Counter Inserts", "Operation Counter Inserts across collections in the database", "area", "Time", "Count", "c", "s") report(opcountersQuery, , stats['opcounters']['query'], true, agentInstanceId, "opcountersQueryChart", "Operation Counter Query", "Operation Counter Query across collections in the database", "area", "Time", "Count", "c", "s") report(opcountersUpdate, , stats['opcounters']['update'], true, agentInstanceId, "opcountersUpdateChart", "Operation Counter Update", "Operation Counter Update across collections in the database", "area", "Time", "Count", "c", "s") report(opcountersDelete, , stats['opcounters']['delete'], true, agentInstanceId, "opcountersDeleteChart", "Operation Counter Delete", "Operation Counter Delete across collections in the database", "area", "Time", "Count", "c", "s") report(opcountersGetMore, , stats['opcounters']['getmore'], true, agentInstanceId, "opcountersGetMoreChart", "Operation Counter Get More", "Operation Counter Get More across collections in the database", "area", "Time", "Count", "c", "s") end |