sebest / collectd-mongodb Goto Github PK
View Code? Open in Web Editor NEWA Collectd plugin to monitor MongoDB (Collectd 4.x)
License: MIT License
A Collectd plugin to monitor MongoDB (Collectd 4.x)
License: MIT License
I just wanted to let you know that I've confirmed that this works with Collectd 5.2.0 and MongoDB 2.4.5. You may want to update the README.
Thanks!
Plugin is not compatible with pymongo 3.0 + as the only way to connect to mongo database is using MongoClient not by Connection(which is removed in 3.0 + ). And the link which is provided to install pymongo in documentation point to the master branch which is 3.0.1 version
I think I have everything configured correctly, but I had to add the following line to my config, or so I thought.
ModulePath "/usr/local/lib64/python2.6/site-packages/pymongo"
In /var/log/messages I see
python plugin: Error importing module "mongodb".
Unhandled python exception in importing module: ImportError: cannot import name Connection
I initially tried by just including the path to the plugin itself, but that was also failing with
Unhandled python exception in importing module: ImportError: No module named pymongo
Any ideas what I might be missing?
Hi,
We would like to evaluate your code to monitor MongoDB but are not sure what you code is licensed under.
Thanks,
The documentation says you can use the config option "Database", but this option isnt' available. The code suggests to use "Databases" but this doesn't work too:
Starting statistics collection and monitoring daemon: collectdUnhandled python exception in loading module: TypeError: cannot concatenate 'str' and 'tuple' objects
My config looks like this:
# This file autogenerated by Chef
# Do not edit, changes will be overwritten
<LoadPlugin python>
Globals true
</LoadPlugin>
<Plugin python>
ModulePath "/usr/lib/collectd"
Import "mongodb"
<Module "mongodb">
Databases "admim" "mydb"
</Module>
</Plugin>
I added mongodb.py to my collectd.conf file as shown here and it actually appears to be working but I am a bit concerned about this error I get when starting collectd. I did install mogodb.py in a different location than the one in the example, it's at /etc/collectd.d/mongodb.py. Here's the error:
[root@mongo6 collectd]# /etc/init.d/collectd restart
Stopping collectd: [ OK ]
Starting collectd: Parse error in file /etc/collectd.d/mongodb.py', line 1301 near
': syntax error, unexpected EOL
yyparse returned error #1
configfile: Cannot read file /etc/collectd.d/mongodb.py'. Parse error in file
/etc/collectd.d/mongodb.pyc', line 1318 near >': syntax error, unexpected CLOSEBRAC yyparse returned error #1 configfile: Cannot read file
/etc/collectd.d/mongodb.pyc'.
.():():.=.=.=.=[,].=.=.=.=.=.=(,,,,=)::='%-%'%(.,):=(.)=.()[ OK ]=.=[,].()():=(=.,=.,=)=[.[]]..:.(.,.)=.('')=['']=()
So you can see that it starts and it does appear to be working as I have stats (that I don't quite trust because of the error) in graphite. Any ideas what's going on here?
system info:
[root@mongo6 collectd]# cat /etc/issue
Amazon Linux AMI release 2014.09
Kernel \r on an \m
[root@mongo6 collectd]# uname -a
Linux mongo6 3.10.42-52.145.amzn1.x86_64 #1 SMP Tue Jun 10 23:46:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@mongo6 collectd]# rpm -q python
python-2.6-2.26.amzn1.noarch
[root@mongo6 collectd]# rpm -q collectd
collectd-5.4.1-1.5.amzn1.x86_64
[root@mongo6 collectd]# rpm -qa|grep -i mongo
mongodb-org-mongos-2.6.5-1.x86_64
mongodb-org-shell-2.6.5-1.x86_64
mongodb-org-tools-2.6.5-1.x86_64
mongodb-org-server-2.6.5-1.x86_64
mongodb-org-2.6.5-1.x86_64
Please update your plugin to support newest pymongo >= 4.3.3, because collectd issues different errors related to abandoned functionality.
To get stable work of the "collectd-mongodb" plugin I had to freeze pymongo == 3.13 version which seems to be obsolete.
Thanks !
For available, current, and total connections, I get 0 unless I change connections
to value:GAUGE:0:U
. This is happening in collectd 5.4.1. Not sure how the behavior is in version 4.
Once I make the switch, I see the correct values reflected from db.serverStatus()
now being stored in graphite.
Wouldn't it be a nice feature to let collectd know about all databases instead of a selection.
Maybe by a config entry.
This plugin opens a connection for every read. Would it make sense to leave it open? It seems like there'd be less overhead that way.
I think I have configured the plugin correctly in collectd. However I'm not sure what to put into the /usr/share/collectd/types.db
file, so that I won't get:
Unhandled python exception in read callback: TypeError: Dataset total_operations not found
in the logs at /var/log/messages
Any help would be much appreciated, thanks :)
Hi,
Added this plugin and the data seems to be coming in for this, however noticed on the connection value its bringing back 00.1 as the figure, not sure how you can have 00.5 of a connection I would have thought this would be a total any ideas?
Details:
[{"target": "mongodb-01.livemongo001_live_dc1_server.mongo.27017.connections.connections.value", "datapoints": [[0.0, 1398867120], [0.0, 1398867180], [0.0, 1398867240], [0.0, 1398867300], [null, 1398867360]]}, {"target": "mongodb-01.livemongo002_live_dc1_server.mongo.27017.connections.connections.value", "datapoints": [[0.0, 1398867120], [0.0, 1398867180], [0.016664999999999999, 1398867240], [0.0, 1398867300], [null, 1398867360]]}, {"target": "mongodb-01.livemongo003_live_dc1_server.mongo.27017.connections.connections.value", "datapoints": [[0.0, 1398867120], [0.016667999999999999, 1398867180], [0.016664000000000002, 1398867240], [0.0, 1398867300], [null, 1398867360]]}, {"target": "mongodb-01.livemongo004_live_dc2_server.mongo.27017.connections.connections.value", "datapoints": [[0.0, 1398867120], [0.016667000000000001, 1398867180], [0.0, 1398867240], [0.0, 1398867300], [0.0, 1398867360]]}, {"target": "mongodb-01.livemongo005_live_dc2_server.mongo.27017.connections.connections.value", "datapoints": [[0.0, 1398867120], [0.0, 1398867180], [0.0, 1398867240], [0.0, 1398867300], [0.0, 1398867360]]}]
I have fetched the latest code from this repo but I get an error message.
This is my config:
# This file autogenerated by Chef
# Do not edit, changes will be overwritten
<LoadPlugin python>
Globals true
</LoadPlugin>
<Plugin python>
ModulePath "/usr/lib/collectd"
Import "mongodb"
<Module "mongodb">
</Module>
</Plugin>
MongoDB is working as you can see here:
root@db11:/var/log# mongo
MongoDB shell version: 2.4.6
connecting to: test
> db.stats()
{
"db" : "test",
"collections" : 0,
"objects" : 0,
"avgObjSize" : 0,
"dataSize" : 0,
"storageSize" : 0,
"numExtents" : 0,
"indexes" : 0,
"indexSize" : 0,
"fileSize" : 0,
"nsSizeMB" : 0,
"dataFileVersion" : {
},
"ok" : 1
}
Here are the error messages of collectd:
Jan 8 06:20:54 precise64 collectd[9176]: Unhandled python exception in init callback: TypeError: 'Database' object is not callable. If you meant to call the 'alive' method on a 'Connection' object it is failing because no such method exists.
Jan 8 06:20:54 precise64 collectd[9176]: Initialization complete, entering read-loop.
Jan 8 06:20:54 precise64 collectd[9176]: Unhandled python exception in read callback: TypeError: Dataset total_connections not found
Jan 8 06:20:54 precise64 collectd[9176]: read-function of plugin `python.mongodb' failed. Will suspend it for 20 seconds.
Jan 8 06:21:14 precise64 collectd[9176]: Unhandled python exception in read callback: TypeError: Dataset total_connections not found
Instead of using a username/password authentication mechanism mongo supports key based authentication. This really should be supported as enterprises rely on key based auth in leu of old style username/pw auth.
Thank you for your consideration.
I've come across your plugin and am very interested in using it. But not knowing collectd and its plugins much I have no idea how to use it. Was wondering if you could perhaps include a small section to describe the installation/usage process?
Thanks :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.