Skip to content

Instantly share code, notes, and snippets.

@alloydwhitlock
Created September 30, 2013 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alloydwhitlock/6768546 to your computer and use it in GitHub Desktop.
Save alloydwhitlock/6768546 to your computer and use it in GitHub Desktop.
collectd curl_json plugin configuration to pull MongoDB statistics from the REST interface. This requires collectd to be compiled with curl_json or have the plugin installed. This has been tested with MongoDB 2.4.4. Optional metrics have been commented out, though can be easily enabled.
## Load curl_json plugin
LoadPlugin curl_json
<Plugin curl_json>
<URL "http://localhost:28017/serverStatus?text=1">
Instance "mongodb"
## Specify JSON array keys to collect information
# Asserts
# The asserts document reports the number of assertions or errors produced by the server
<Key "asserts/regular">
Type "gauge"
</Key>
<Key "asserts/warning">
Type "gauge"
</Key>
<Key "asserts/mgs">
Type "gauge"
</Key>
<Key "asserts/user">
Type "gauge"
</Key>
<Key "asserts/regular">
Type "gauge"
</Key>
# Background Flushing Statistics
# The backgroundFlushing document reports on the process MongoDB uses to write data to disk
<Key "backgroundFlushing/flushes">
Type "gauge"
</Key>
<Key "backgroundFlushing/total_ms">
Type "gauge"
</Key>
<Key "backgroundFlushing/average_ms">
Type "gauge"
</Key>
<Key "backgroundFlushing/last_ms">
Type "gauge"
</Key>
# Connections
# The connections field reports on MongoDB’s current memory use by the MongoDB process.
<Key "connections/current">
Type "gauge"
</Key>
<Key "connections/available">
Type "gauge"
</Key>
<Key "connections/totalCreated">
Type "gauge"
</Key>
# Cursors
# The cursors document reports on current cursor use and state.
<Key "cursors/totalOpen">
Type "gauge"
</Key>
<Key "cursors/ClientCursors_size">
Type "gauge"
</Key>
<Key "cursors/timedOut">
Type "gauge"
</Key>
<Key "cursors/totalNoTimeout">
Type "gauge"
</Key>
# Global Lock
# The globalLock field reports on MongoDB’s global system lock.
# In most cases the locks document provides more fine grained data that reflects lock use.
<Key "globalLock/totalTime">
Type "gauge"
</Key>
<Key "globalLock/lockTime">
Type "gauge"
</Key>
<Key "globalLock/currentQueue/total">
Type "gauge"
</Key>
<Key "globalLock/currentQueue/readers">
Type "gauge"
</Key>
<Key "globalLock/currentQueue/writers">
Type "gauge"
</Key>
<Key "globalLock/activeClients/total">
Type "gauge"
</Key>
<Key "globalLock/activeClients/readers">
Type "gauge"
</Key>
<Key "globalLock/activeClients/writers">
Type "gauge"
</Key>
# Index Counters
# The indexCounters document reports on index use
<Key "indexCounters/accesses">
Type "gauge"
</Key>
<Key "indexCounters/hits">
Type "gauge"
</Key>
<Key "indexCounters/misses">
Type "gauge"
</Key>
<Key "indexCounters/resets">
Type "gauge"
</Key>
<Key "indexCounters/missRatio">
Type "gauge"
</Key>
# Network Statistics
# The network document reports on network use and state
<Key "network/bytesIn">
Type "gauge"
</Key>
<Key "network/bytesOut">
Type "gauge"
</Key>
<Key "network/numRequests">
Type "gauge"
</Key>
# Operation Counters (opcounters)
# The opcounters document reports the number of operations this MongoDB instance has processed
<Key "opcounters/insert">
Type "gauge"
</Key>
<Key "opcounters/query">
Type "gauge"
</Key>
<Key "opcounters/update">
Type "gauge"
</Key>
<Key "opcounters/delete">
Type "gauge"
</Key>
<Key "opcounters/getmore">
Type "gauge"
</Key>
<Key "opcounters/command">
Type "gauge"
</Key>
# Replication Operation Counters (opcounters)
# The opcountersRepl document reports the number of replicated operations
<Key "opcountersRepl/insert">
Type "gauge"
</Key>
<Key "opcountersRepl/query">
Type "gauge"
</Key>
<Key "opcountersRepl/update">
Type "gauge"
</Key>
<Key "opcountersRepl/delete">
Type "gauge"
</Key>
<Key "opcountersRepl/getmore">
Type "gauge"
</Key>
<Key "opcountersRepl/command">
Type "gauge"
</Key>
# Memory Use Statistics
# The mem field reports on MongoDB’s current memory use
<Key "mem/bits">
Type "gauge"
</Key>
<Key "mem/resident">
Type "gauge"
</Key>
<Key "mem/virtual">
Type "gauge"
</Key>
<Key "mem/supported">
Type "gauge"
</Key>
<Key "mem/mapped">
Type "gauge"
</Key>
<Key "mem/mappedWithJournal">
Type "gauge"
</Key>
# Service Metrics
# The metrics document contains a number of operational metrics that are useful for monitoring the state and workload of a mongod instance.
# <Key "metrics/*/*/*/*">
# Type "gauge"
# </Key>
</URL>
</Plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment