Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- added info logging for configuration parameters (most of them)

- fixed formatting issue for plugin_instance name
- db was being left out of recursive_submit() recursion calls
  • Loading branch information...
commit 548f45f684defff61fa5dd35a45840b60f5224da 1 parent fa27b8c
Nick Lloyd authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 mongodb.py
View
10 mongodb.py
@@ -154,20 +154,26 @@ def config(self, obj):
for node in obj.children:
if node.key == "Port":
self.mongo_port = int(node.values[0])
+ collectd.info("mongodb plugin: Port " + self.mongo_port)
elif node.key == "Host":
self.mongo_host = node.values[0]
+ collectd.info("mongodb plugin: Host " + self.Host)
elif node.key == "User":
self.mongo_user = node.values[0]
elif node.key == "Password":
self.mongo_password = node.values[0]
elif node.key == "Databases":
self.mongo_dbs = node.values
+ collectd.info("mongodb plugin: Databases " + self.mongo_dbs)
elif node.key == "ConnectionPoolStatus":
self.includeConnPoolMetrics = node.values
+ collectd.info("mongodb plugin: ConnectionPoolStatus " + self.ConnectionPoolStatus)
elif node.key == "ServerStats":
self.includeServerStatsMetrics = node.values
+ collectd.info("mongodb plugin: ServerStats " + self.ServerStats)
elif node.key == "DBStats":
self.includeDbstatsMetrics = node.values
+ collectd.info("mongodb plugin: DBStats " + self.DBStats)
else:
collectd.warning("mongodb plugin: Unkown configuration key %s" % node.key)
@@ -176,7 +182,7 @@ def submit(self, instance, type, value, db=None):
# actually a recursive submit call to dive deeper into nested dict data
# since the leaf value in the nested dicts is the type, we check on the type type :-)
if db:
- plugin_instance = "%s-%d" % (self.mongo_port, db)
+ plugin_instance = "%s-%s" % (self.mongo_port, db)
else:
plugin_instance = str(self.mongo_port)
v = collectd.Values()
@@ -198,7 +204,7 @@ def recursive_submit(self, type_tree, data_tree, instance_name=None, db=None):
else:
next_instance_name = type_name
if data_tree.has_key(type_name):
- self.recursive_submit(type_value, data_tree[type_name], next_instance_name)
+ self.recursive_submit(type_value, data_tree[type_name], next_instance_name, db=db)
else:
# may want to log this but some mongodb setups may not have anything to report
pass
Please sign in to comment.
Something went wrong with that request. Please try again.