I’ve added a node per MongoDB - Percona Monitoring and Management and I get metrics, but I never get any Query analytics for mongo nodes. It works great for mysql / rds, but doesn’t even show up for mongo.
It adds the host and I see agents running and I get metrics, but I never get any query analytics. I can’t even add a mongodb filter.
I’ve seen a few errors in the log around: Cannot get node type to check if this is a mongos: connection(<node>:21337[-11]) failed to write: context canceled
But I don’t see anything explicitly failing, and the agent seems to be running, I just don’t see any query analytics and I am at a bit of a loss at this point.
Could I be mistaken and username/pass should be the pmm_mongdb user? And then just leave out the agent_password altogether?
Running on this version:
ProjectName: pmm-admin
Version: 2.25.0
PMMVersion: 2.25.0
Timestamp: 2021-12-13 09:38:36 (UTC)
FullCommit: 4b81157ad02975c417daef2600cb0dcd3907ffa1
Hi, you should not need to provide the agent password to add the MongoDB Service. Only provide the mongodb user credentials that you created for pmm to connect to your mongodb. Also please double check that you have the profiler enabled and that the profile collection is being populated. If that is ok, it is most likely a permission issue.
Ok, I recreated the agent with just the pmm creds to monitor the instance.
Updated the agent to use the correct username and password
Profiling is enabled, e.g. show profile in the mongo shell works and returns data
I’ve logged into the mongo instance as pmm user/pmm password and can run show profile
So I don’t think its a permissions issue.
I see some errors in pmm-agent.log
INFO[2022-02-08T20:38:36.454+00:00] time="2022-02-08T20:38:36Z" level=error msg="Cannot get node type to check if this is a mongos: connection(mongo-host:21337[-506]) failed to write: context canceled" agentID=/agent_id/3f5579d2-eea9-4eeb-b2a7-d328cd2c0c86 component=agent-process type=mongodb_exporter
INFO[2022-02-08T20:38:41.452+00:00] time="2022-02-08T20:38:41Z" level=error msg="cannot get replSetGetStatus: connection() error occured during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism \"SCRAM-SHA-256\": connection(mongo-host:21337[-507]) incomplete read of message header: context canceled" agentID=/agent_id/3f5579d2-eea9-4eeb-b2a7-d328cd2c0c86 component=agent-process type=mongodb_exporter
INFO[2022-02-08T20:38:41.452+00:00] time="2022-02-08T20:38:41Z" level=error msg="Cannot get node type to check if this is a mongos: connection(mongo-host:21337[-506]) failed to write: context canceled" agentID=/agent_id/3f5579d2-eea9-4eeb-b2a7-d328cd2c0c86 component=agent-process type=mongodb_exporter
INFO[2022-02-08T20:39:01.452+00:00] time="2022-02-08T20:39:01Z" level=error msg="cannot run getDiagnosticData: connection(mongo-host:21337[-509]) incomplete read of full message: context canceled" agentID=/agent_id/3f5579d2-eea9-4eeb-b2a7-d328cd2c0c86 component=agent-process type=mongodb_exporter
INFO[2022-02-08T20:39:01.453+00:00] time="2022-02-08T20:39:01Z" level=error msg="Cannot get node type to check if this is a mongos: connection(mongo-host:21337[-506]) failed to write: context canceled" agentID=/agent_id/3f5579d2-eea9-4eeb-b2a7-d328cd2c0c86 component=agent-process type=mongodb_exporter
INFO[2022-02-08T20:39:01.453+00:00] time="2022-02-08T20:39:01Z" level=error msg="cannot get replSetGetStatus: connection(mongo-host:21337[-506]) failed to write: context canceled" agentID=/agent_id/3f5579d2-eea9-4eeb-b2a7-d328cd2c0c86 component=agent-process type=mongodb_exporter
INFO[2022-02-08T20:39:01.454+00:00] time="2022-02-08T20:39:01Z" level=error msg="cannot get replSetGetStatus: connection(mongo-host:21337[-506]) failed to write: context canceled" agentID=/agent_id/3f5579d2-eea9-4eeb-b2a7-d328cd2c0c86 component=agent-process type=mongodb_exporter
INFO[2022-02-08T20:39:01.454+00:00] time="2022-02-08T20:39:01Z" level=error msg="cannot run getDiagnosticData: connection(mongo-host:21337[-508]) failed to write: context canceled" agentID=/agent_id/3f5579d2-eea9-4eeb-b2a7-d328cd2c0c86 component=agent-process type=mongodb_exporter
INFO[2022-02-08T20:39:01.454+00:00] time="2022-02-08T20:39:01Z" level=error msg="error while checking mongodb connection: connection(mongo-host:21337[-506]) failed to write: context canceled. mongo_up is set to 0" agentID=/agent_id/3f5579d2-eea9-4eeb-b2a7-d328cd2c0c86 component=agent-process type=mongodb_exporter
INFO[2022-02-08T20:39:01.454+00:00] time="2022-02-08T20:39:01Z" level=error msg="Cannot get node type to check if this is a mongos: connection(mongo-host:21337[-508]) failed to write: context canceled" agentID=/agent_id/3f5579d2-eea9-4eeb-b2a7-d328cd2c0c86 component=agent-process type=mongodb_exporter
INFO[2022-02-08T21:36:31.453+00:00] time="2022-02-08T21:36:31Z" level=error msg="Cannot get node type to check if this is a mongos: connection(mongo-host:21337[-510]) failed to write: context canceled" agentID=/agent_id/3f5579d2-eea9-4eeb-b2a7-d328cd2c0c86 component=agent-process type=mongodb_exporter
INFO[2022-02-08T22:30:57.508+00:00] time="2022-02-08T22:30:57Z" level=error msg="Cannot get node type to check if this is a mongos: connection(mongo-host:21337[-4]) failed to write: context canceled" agentID=/agent_id/a163ba2b-a96f-470c-915d-4aa1f84966c6 component=agent-process type=mongodb_exporter
[pmm-host][me ~]$ nc -zv mongo-host 21337
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to <ip_address>:21337.
Ncat: 0 bytes sent, 0 bytes received in 0.07 seconds.
Is there a way to inspect if the QAN is even running?
Hi, you can check if QAN is up by running pmm-admin status. mongodb_profiler_agent should be in running state.
From the output above it seems the agent is having issues connecting to mongodb with the provided credentials.
Yeah agents are running, is it possible the passwords are getting interpolated in a funny way? Should they be wrapped in single quotes if they have special characters in bash?
Thanks for your help, well QAN metrics started to show up, we’re not entirely sure why, other than either the profiler wasn’t picking up the metrics we thought it should, or there was some networking stuff invisibly busted.
Either way I did have a followup question. It looks like the configuration is not setup so it can do explains on the actual query. Is this intentional? If I try to run an explain it will fail saying it doesn’t have reads enabled on the db and thus fails. We understand that just curious if that was the intention in the documentation as I don’t see anything that says to expect this behavior.
Glad to hear it is working now. Does the explain not work even for find() statements? I seem to recall running into cases where explain does not work for statements that write (insert, update) unless the mongodb user is given the perms to actually execute the write operation even if it does not need it theoretically.
Also I assume you double-checked the required perms. Check this one to make sure you have properly set the custom explainRole:
The mongodb server has pmm installed (client, server, etc.) and the dashboard is seen in the browser.
The “MongoDB Instances Overview” dashboard shows the Node and Service names correctly:
But, the “PMM Query Analytics” dashboard does Not show the node and the service names:
Seems if i enabling profiling in mongo shell prompt [ db.setProfilingLevel(2, {“slowms”: 0, “sampleRate”: 1.0}) ], the node does Not get listed in QAN. But, if i permanently add the same profiling levels in /etc/mongod.conf file, and restart mongod service, then the node gets listed in QAN.
@Anil_Joshi from Percona support team helped me with this.