MongoDB Discovery flow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
We have a requirement to discover the MongoDB Database. Can anyone please explain the complete flow of it like which probe or pattern it use and how we will trigger it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @Adarsh_raj ,
1. How ServiceNow Discovers MongoDB
MongoDB is discovered using Pattern-based Discovery (not legacy probes/scripts).
ServiceNow delivers Database → MongoDB patterns out-of-the-box.
2. Key Pattern Used
* Pattern Name:
MongoDB
* (found under Discovery Patterns → Application → Database)
* Type: Application Pattern
* Purpose: Connects to MongoDB using provided credentials, retrieves DB version, databases list, and other configuration details.
3. How the Pattern is Triggered
The MongoDB discovery pattern is not run in isolation — it is triggered as part of the Horizontal Discovery flow:
1. IP Address Scanned
* Discovery schedule runs, scanning IP ranges.
2. Port Scan Probe
* Identifies MongoDB’s default port (27017 TCP) or your custom port.
3. Classification Phase
* MongoDB Classification identifies the host as a MongoDB service if the port response matches.
4. Identification & Connection
* If classification passes, ServiceNow triggers the MongoDB Pattern from the Application step.
5. Data Retrieval
* The pattern queries MongoDB using the credentials to pull:
* Version info
* Database names
* Replica set info
* Configuration parameters
6. CMDB Population
* Results are normalized into CIs like:
* cmdb_ci_db_instance (Database Instance)
* cmdb_ci_database (Database)
* Related relationships (Runs on → Server, Contains → DB)
4. Probes/Patterns Involved
Although MongoDB discovery is pattern-based, internally it uses:
* Port Scan Probe → To detect open MongoDB ports.
* MongoDB Pattern → To connect and retrieve details.
5. Prerequisites
Credentials
* Type: MongoDB Credential (newer releases) or Basic Auth with MongoDB driver
* Requires:
* Host/IP
* Port (27017 default)
* Username & password with readAnyDatabase or equivalent role.
* Ensure account has listDatabases privilege.
Firewall / Network
* Open TCP port 27017 (or custom MongoDB port) between MID Server and MongoDB host.
* MID Server must have access to the MongoDB driver.
MID Server Requirements
* Ensure MID Server Java version supports MongoDB driver used in your release.
* Verify MID Server has Application Pattern Discovery capability enabled.
6. How to Trigger a Test Discovery
* Create a Discovery Schedule for the MongoDB server’s IP.
* Assign a MID Server that can reach it.
* Attach the MongoDB credentials to the schedule.
* Run Discovery and check:
* ECC Queue → Pattern triggered.
* Discovery Log → MongoDB classification success.
* Pattern Debug → If needed.
7. Troubleshooting Tips
* If classification fails:
* Confirm port is open and listening.
* Test MongoDB login from MID Server host using:
mongo --host <ip> --port 27017 -u <user> -p <pass>
* If pattern runs but no DBs are discovered:
* Check permissions — listDatabases is mandatory.
* Check if the database is using authentication mode.
Please appreciate the efforts of community contributors by marking appropriate response as Mark my Answer Helpful or Accept Solution this may help other community users to follow correct solution in future.
Thank You
AJ - TechTrek with AJ - ITOM Trainer
LinkedIn:- https://www.linkedin.com/in/ajay-kumar-66a91385/
YouTube:- https://www.youtube.com/@learnitomwithaj
Topmate:- https://topmate.io/aj_techtrekwithaj (Connect for 1-1 Session)
ServiceNow Community MVP 2025