MeetMe / newrelic-plugin-agent

Multi-Plugin python-based Agent for NewRelic's Platform
BSD 3-Clause "New" or "Revised" License
425 stars 265 forks source link

not authorized on db to execute command { serverStatus: 1 }, but my user is full admin #559

Open marcelomiklos opened 5 years ago

marcelomiklos commented 5 years ago

Hi guys, In plugin execution for mongoDB module configuration, the show me this error, but my user have admin access full and in execution from cli of mongoDB the command is executed with success:

newrelic-plugin-agent -c /etc/newrelic/newrelic-plugin-agent.cfg -f

INFO 2018-12-12 20:31:49,862 6316 MainProcess MainThread newrelic_plugin_agent.agent init L55 : Agent v1.3.0 initialized, Linux-3.13.0-77-generic-x86_64-with-glibc2.4 (Ubuntu 12.04 precise) CPython v2.7.3 INFO 2018-12-12 20:31:49,863 6316 MainProcess MainThread helper.controller run L251 : newrelic-plugin-agent v2.4.1 started INFO 2018-12-12 20:31:49,863 6316 MainProcess MainThread newrelic_plugin_agent.agent start_plugin_polling L263 : Enabling plugin: mongodb Traceback (most recent call last): File "/usr/local/bin/newrelic-plugin-agent", line 9, in load_entry_point('newrelic-plugin-agent==1.3.0', 'console_scripts', 'newrelic-plugin-agent')() File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 337, in main helper.start(NewRelicPluginAgent) File "/usr/local/lib/python2.7/dist-packages/helper/init.py", line 174, in start obj.start() File "/usr/local/lib/python2.7/dist-packages/helper/controller.py", line 266, in start self.run() File "/usr/local/lib/python2.7/dist-packages/helper/controller.py", line 253, in run self.process() File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 118, in process self.start_plugin_polling() File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 280, in start_plugin_polling self.config.application.get(plugin)) File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 108, in poll_plugin thread.run() File "/usr/lib/python2.7/threading.py", line 504, in run self.target(*self.args, self.__kwargs) File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 308, in thread_process obj.poll() File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/plugins/mongodb.py", line 259, in poll self.get_and_add_server_stats() File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/plugins/mongodb.py", line 254, in get_and_add_server_stats self.add_server_datapoints(client.db.command('serverStatus')) File "/usr/local/lib/python2.7/dist-packages/pymongo/database.py", line 614, in command codec_options, session=session, kwargs) File "/usr/local/lib/python2.7/dist-packages/pymongo/database.py", line 514, in _command client=self.__client) File "/usr/local/lib/python2.7/dist-packages/pymongo/pool.py", line 579, in command unacknowledged=unacknowledged) File "/usr/local/lib/python2.7/dist-packages/pymongo/network.py", line 150, in command parse_write_concern_error=parse_write_concern_error) File "/usr/local/lib/python2.7/dist-packages/pymongo/helpers.py", line 155, in _check_command_response raise OperationFailure(msg % errmsg, code, response) pymongo.errors.OperationFailure: not authorized on db to execute command { serverStatus: 1 }

If me disable the auth mode in mongoDB, the execution of agent not show errors:

INFO 2018-12-13 17:07:35,665 17150 MainProcess MainThread newrelic_plugin_agent.agent start_plugin_polling L263 : Enabling plugin: mongodb INFO 2018-12-13 17:07:41,677 17150 MainProcess MainThread newrelic_plugin_agent.plugins.base finish L140 : MongoDB poll successful, completed in 6.01 seconds INFO 2018-12-13 17:07:41,678 17150 MainProcess MainThread newrelic_plugin_agent.agent send_components L220 : Sending 63 metrics to NewRelic INFO 2018-12-13 17:07:43,907 17150 MainProcess MainThread newrelic_plugin_agent.agent process L133 : Stats processed in 8.24 seconds, next wake in 51 seconds