omni-lchen / zabbix-mongodb

MIT License
58 stars 73 forks source link

TypeError: 'Database' object is not callable #8

Closed rytvish closed 6 years ago

rytvish commented 6 years ago

I am only getting the number of process in the zabbix............. image

root@ip-172-31-13-41:/usr/local/bin# ./mongodb-stats.sh Traceback (most recent call last): File "/usr/local/bin/zabbix-mongodb.py", line 208, in MongoDB.getOplog() File "/usr/local/bin/zabbix-mongodb.py", line 85, in getOplog db.authenticate(self.mongo_user, self.mongo_password) File "/usr/local/lib/python2.7/dist-packages/pymongo/database.py", line 1241, in call self.name, self.client.class.name)) TypeError: 'Database' object is not callable. If you meant to call the 'authenticate' method on a 'MongoClient' object it is failing because no such method exists. 1

Environment Details: OS: ubuntu 16.04 Mongo Version : 3.2 Zabbix agent version 3.4

zabbix-mongodb.py configuration: class MongoDB(object): def init(self): self.mongo_host = "127.0.0.1" self.mongo_port = 27017 self.mongo_db = ["admin", ] self.mongo_user = "admin" self.mongo_password = "admin123" self.conn = None self.dbnames = None self.__metrics = []

rytvish commented 6 years ago

I disabled the below two lines to resolve the issue and the data is coming now.............

 #MongoDB.getOplog()
#MongoDB.getMaintenance()
franciscopaniskaseker commented 6 years ago

Same issue. I commented that lines and now is working.