Session expiration issue when using atlas auth login for manual monitoring.

I am working with a client who has a MongoDB Atlas project and has provided me access to their project. I am manually monitoring the database by connecting to their Atlas environment.

Initially, I used the command:
atlas auth login
It worked fine, and I was able to authenticate successfully. However, after some time, I encountered the following error:
session expired, try login, run atlas auth login

I would like to understand:

  1. What is the default session expiration time when using atlas auth login?
  2. Is there any way to increase this session duration?
  3. Are there alternative ways to prevent frequent session expirations while using the Atlas CLI for monitoring?

Looking forward to guidance on this.

1 Like

Hi @Rexcily_Rijo_R ! Per Can I setup timeout for Atlas web console?

my understanding is default is 12 hours but not configurable.

What monitoring do you need to do? Have you taken a look at some of the options MongoDB provides?

2 Likes

Hey Ryan,

Thanks for your response! Since the default timeout is 12 hours and not configurable, is there any way to extend it or keep the session active for a longer time

1 Like

Hey Rexcily,

You could potentially handle the timeout and then reconnect. However in the case of monitoring, it would be more helpful to have this handled programmatically rather than with the atlas cli.

What are you trying to monitor? CPU, Memory, Oplog, etc?

-Ryan

2 Likes

Hey Ryan,

Yes agreed, but it’s old monitoring code and will take some effort to modify that. Currently monitoring the cpu, memory through the atlas cli.

1 Like

Hey Rexcily,

I believe you’ll have to modify that monitoring code in some way, either to handle reconnecting or to migrate the monitoring to Atlas.

I would lean towards Atlas, though I don’t know how that fits in with the rest of your monitoring. Please do share how you end up going forward.