This project utilizes Docker Compose to deploy a comprehensive MongoDB monitoring environment, including the following services: MongoDB, Mongo Express, MongoDB Exporter, Prometheus, and Grafana Open source.
Make sure you have the following tools installed on your machine before getting started:
- Docker: Docker is a platform for developing, shipping, and running applications in containers.
- Docker Compose: Docker Compose is a tool for defining and running multi-container Docker applications.
Additionally, ensure that you have the make
command available. On most Unix-like systems (including Linux and macOS), make
is pre-installed. For Windows users, you can install make
through tools like Cygwin or Make for Windows.
-
Clone this repository on your local machine:
git clone https://github.com/Lionelsan95/prometheus_grafana_monitoring.git
-
Navigate to the project directory:
cd prometheus_grafana_monitoring
The project includes a Makefile with the following commands:
make up
: Start the services using Docker Compose.make up-log
: Start the services with detailed logs using Docker Compose.make up-build
: Start the services and rebuild images using Docker Compose.make down
: Stop the services using Docker Compose.make list
: List available containers using Docker compose.make import-data
: Import data into mongodb so that they can be visible in grafana.
Example usage:
make up
make down
- MongoDB:
mongodb://localhost:27017
- Mongo Express: http://localhost:8081
- Prometheus: http://localhost:9090
- MongoDB Exporer: http://localhost:9216
- Grafana: http://localhost:8186
To stop the services, use the following command:
make down
Certainly! Below is an additional section for your README specifically covering the backoffice and credentials:
Grafana is the monitoring and observability platform used in this project. You can access the Grafana dashboard through your web browser.
- URL: http://localhost:3000
- Default Credentials:
- Username: admin
- Password: admin
Upon accessing Grafana, it's recommended to change the default credentials for security reasons. You can modify the login credentials in Grafana under the "Profile" settings.
Mongo Express is a web-based MongoDB admin interface. It provides a convenient way to interact with your MongoDB instance.
- URL: http://localhost:8081
- Default Credentials:
- Username: root
- Password: jesusmylord
Just like Grafana, it's crucial to update the default credentials for Mongo Express to enhance security. You can modify the login credentials in Mongo Express by navigating to the "Settings" section.
To change credentials for Grafana and Mongo Express:
-
Grafana:
- Log in to Grafana using the default credentials (admin/admin).
- Click on the gear icon (⚙️) in the left sidebar to open the "Settings" menu.
- Navigate to "Profile" and update the login credentials.
-
Mongo Express:
- Log in to Mongo Express using the default credentials (root/jesusmylord).
- Click on the "Settings" icon (⚙️) in the top-right corner.
- Go to the "Users" tab and update the username and password.
Remember to keep your credentials secure and follow best practices for password management. Update the credentials regularly to enhance the security of your MongoDB monitoring setup.
Certainly! Below is an updated section in the README instructing users to configure Prometheus as a data source and import the Grafana dashboard JSON file:
To visualize MongoDB metrics, we provide a pre-configured Grafana dashboard in the grafana
folder named mongo_db_dashboard.json
. Follow these steps to set up the dashboard:
-
Access Grafana:
- Open your web browser and go to http://localhost:3000.
- Log in with the Grafana default credentials (admin/admin).
-
Add Prometheus as a Data Source:
- Click on the "+" icon in the left sidebar to open the "Add your first data source" page.
- Select "Prometheus" from the list of available data sources.
- In the "HTTP" section, set the URL to http://esperluet_prometheus:9090, and click "Save & Test." Ensure that the connection is successful.
-
Import MongoDB Dashboard:
- In the left sidebar, click on the "+" icon and select "Import."
- Click on "Upload .json file" and choose the
mongo_db_dashboard.json
file from thegrafana
folder in the root directory. - Set the "Prometheus" data source in the "Prometheus" field.
- Click "Import" to create the MongoDB dashboard.
-
Explore MongoDB Metrics:
- Open the "Dashboards" section in the left sidebar and select the "MongoDB Dashboard."
- Explore various panels to monitor different MongoDB metrics.
Now, you have a comprehensive Grafana dashboard visualizing MongoDB metrics collected by Prometheus. Adjust the time range and explore different panels to gain insights into the performance of your MongoDB instance.
Feel free to customize the dashboard based on your specific monitoring needs. If you encounter any issues or want to contribute improvements, please open an issue or pull request in the project repository. Happy monitoring!
Feel free to contribute, report issues, or suggest improvements by opening an issue or pull request. Thank you for participating!