How to Monitor MongoDB Servers with Nagios XI

Monitoring your MongoDB server is essential for maintaining peak performance, quickly identifying issues, and ensuring seamless database operations. With Nagios XI, you can streamline this process using the MongoDB Server Configuration Wizard, making it easier to track key metrics and detect potential problems before they impact your system. In this guide, we’ll walk you through the step-by-step process of configuring MongoDB monitoring in Nagios XI to help you maintain a reliable and efficient database environment.
Prerequisites
Before starting, ensure your environment meets these requirements:
- MongoDB Authentication Enabled: Authentication must be enabled on your MongoDB server. Refer to Enable Authentication.
- User with
clusterAdmin
Role: A user with theclusterAdmin
role in theadmin
database is required to retrieve server statistics. Refer to Manage Users and Roles. - Remote Access Configuration: Ensure MongoDB is configured to accept remote connections (
bindIp
must be set appropriately). Refer to Configuration Options. - Firewall Rules: Configure firewall settings to allow Nagios XI to communicate with MongoDB:
- Linux: Configure iptables
- Windows: Configure netsh
Verify connectivity from the Nagios XI server:
telnet <mongo-ip> 27017
Configuring MongoDB Monitoring in Nagios XI
Follow these steps to set up MongoDB monitoring using the Nagios XI MongoDB Server Configuration Wizard.
Step 1: Access the Wizard
- Log in to Nagios XI.
- Navigate to Configure > Configuration Wizards.
- Search for MongoDB Server and select it.

Step 2: Enter Server Details
- Enter the IP address or hostname of your MongoDB server.
- Specify the port (default: 27017) if customized.
- Provide the Username and Password of a user with
clusterAdmin
privileges. - Click Next.

Step 3: Configure Monitoring Parameters
- Confirm the Host Name field matches your MongoDB server.
- Select the metrics to monitor:
- Queries per second
- Memory usage
- Number of databases
- Free connection percentage
- Set warning and critical thresholds (e.g., 80% and 90% for connections).
- If using replication, enable:
- Replication status
- Replication lag (seconds)
- Replication lag percentage
- Click Next.
Step 4: Apply and Verify Configuration
- Review your selections.
- Click Finish to apply the configuration.
- Navigate to Host and Service Details in Nagios XI to verify the new host and service checks.
Troubleshooting
If monitoring fails, check for these common issues:
- Authentication Errors: Ensure correct credentials by testing in the MongoDB shell:
mongo -u <username> -p <password> --authenticationDatabase admin
- Connection Issues: Verify
bindIp
settings and test connectivity:
nc -zv <mongo-ip> 27017
- Firewall Blocks: Confirm open ports:
iptables -L | grep 27017 # Linux
netsh advfirewall show allprofiles # Windows
- Log Errors: Check MongoDB logs for potential issues:
tail -f /var/log/mongodb/mongod.log
Conclusion
Using the MongoDB Server Configuration Wizard, Nagios XI simplifies monitoring key MongoDB metrics, ensuring database stability and performance. For additional support, visit the Nagios Support Forum or the Nagios Knowledgebase.
Share:
On this page
Related Articles
- How to Monitor Websensor EM08 in Nagios XI: Step-by-Step Guide for IT Administrators
- Monitoring Windows Event Logs via SNMP in Nagios XI
- How to Integrate MultiTech MTR API with Nagios XI
- Monitoring Java Application Servers with check_jmx in Nagios XI
- Monitoring Unconfigured Objects with Nagios XI: A Comprehensive Guide