2

Some posts show you can use db.currentOp(true) to show active connections, but when I do that I get this error

{ "ok" : 0, "errmsg" : "Using $all for currentOp is disallowed in this atlas tier", "code" : 8000, "codeName" : "AtlasError" }

Is there another way to view active connections to a MongoDB Atlas Cluster? What tier allows you to use this command?

4
  • What tier are you using?
    – Mani
    Mar 26, 2019 at 23:44
  • Free Tier, we're moving to M10 during deployment though
    – A_toaster
    Mar 26, 2019 at 23:47
  • @A_toaster, What IP address, you want to view? I mean to say that Public IP or Private IP. Mar 28, 2019 at 9:27
  • @MdHaidarAliKhan Public IP. there are some remote devices connecting to the db and I'd like to see where they are coming from
    – A_toaster
    Mar 28, 2019 at 22:31

3 Answers 3

4

If I understand correctly, this is about how to view ip addresses that got connected to your mongoDB Atlas cluster, I would say you can see number of connections established to a cluster by just logging into your Atlas mongoDB cloud dashboard (Atlas login). But if you want details on connections established, then you can download logs for that particular cluster as a file, You can navigate to it as given below, but you might only see this option for paid versions, Technically db.currentOp(true) should work, but for some reason it didn't, not sure why, maybe unsupported !! (mongoDB-unsupported-commands) :

enter image description here

1

MongoDB Atlas Free tier, In the Cluster Overview page you should be able to the see the number active connections to the cluster as shown below.

enter image description here

UPDATE

Since Atlas Free Tier doesn't allow to run db.currentOp(), The one other way is to check the MongoDB log files for active connection IP Address. In the log file look for the latest entry like below

2019-03-28T09:42:49.795-0700 I NETWORK  [listener] connection accepted from 192.168.1.1:62408 #1 (1 connection now open)

This will give you the number of active connections and from which are IP address the connection is made. Also, to check the connections is closed or not

2019-03-28T09:51:48.797-0700 I NETWORK  [conn7] end connection 192.168.1.1:62408 (0 connections now open)
0

How can you view the IP addresses of active MongoDB Atlas connections?

As per MongoDB documentation here the IP address has been added in Atlas cluster will appears under the Check the IP Whitelist section under the Security tab.

For example in screenshot It has been chosen as IP Whitelist as Any to Any ( i.e IP address is 0.0.0.0/0). If you shall chose your current IP address in IP Whitelist then it will show your current Public IP address.

enter image description here

After Edit

Suppose that during the Security IP Whitelist configuration time,I have been added my IP Address through the ADD IP Address button as it's appear on the right top corner of the Cluster window screen such as

enter image description here

After adding my Public IP (37.186.35.171/32)is appears like that

enter image description here

And the status of the connection is shows as ACTIVE status. Even I have logged two times from the Atlas cluster and again login to the cluster as it's always IP Address is appearing as 37.186.35.171/32. Which I have been red highlighted through arrow in the screenshot.

10
  • 1
    The IP Whitelist page show from which are all IP Address or IP address rage this cluster will accept the connections. For example, if I add 0.0.0.0 to the IP Whitelist it will accept connection from all IP address range but it won't show you specifically from which IP Address I am connected from.
    – Mani
    Mar 28, 2019 at 16:35
  • @Mani, The IP address 0.0.0.0/0 I have been taken because it's allow ANY to ANY connections. Even i have written on the same line if you shall configure your current IP Address then it will auto take your current Public IP Address. Mar 28, 2019 at 17:20
  • 1
    Yes, you are correct. What I am trying to say here is, the IP white list page will not help you to identify the active connection's IP Adress values. Consider I have added an IP address added to the IP Whitelist group but I haven't connected to the cluster from the IP address, still, the IP Adress will be displayed in the IP Whitelist page.
    – Mani
    Mar 28, 2019 at 17:25
  • @Mani,Consider I have added an IP address added to the IP Whitelist group but I haven't connected to the cluster from the IP address, still, the IP Adress will be displayed in the IP Whitelist page. YES Because Public IP and their subnet mask will be always remain intact there in IP Whitelist. Mar 28, 2019 at 17:31
  • 2
    The question here is How can you view the IP addresses of active MongoDB Atlas connections? and I am trying to say IP Whitelist page may not help to answer the question.
    – Mani
    Mar 28, 2019 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.