-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
61 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,71 @@ | ||
# Basic Monitoring System with Grafana and Prometheus | ||
|
||
This project sets up a basic monitoring system using Grafana and Prometheus with Docker. | ||
This project sets up a monitoring system using Grafana and Prometheus with Docker. It includes CI/CD configuration with GitHub Actions to ensure the services are always up-to-date and functioning correctly. | ||
|
||
## Features | ||
|
||
- **Prometheus**: Collects and stores metrics. | ||
- **Grafana**: Visualizes the metrics collected by Prometheus. | ||
- **Node Exporter**: Provides OS metrics for Prometheus. | ||
- **Alertmanager**: Manages alerts sent by Prometheus. | ||
- **CI/CD with GitHub Actions**: Automates the deployment and testing of the system. | ||
|
||
## Prerequisites | ||
|
||
- Docker and Docker Compose installed on the system. | ||
- A Docker Hub account. | ||
- Environment variables configured for Docker Hub and Grafana authentication. | ||
|
||
## Configuration | ||
|
||
### Environment Variables | ||
|
||
Create a `.env` file in the root of the project with the following variables: | ||
GF_SECURITY_ADMIN_USER=admin | ||
GF_SECURITY_ADMIN_PASSWORD=admin | ||
|
||
## Instructions | ||
|
||
1. Clone the repository. | ||
2. Navigate to the project folder. | ||
3. Run `docker-compose up`. | ||
4. Access Grafana at `http://localhost:3000` | ||
3. Create a .env file in the root directory with the necessary environment variables. | ||
4. Run docker-compose up -d to start the services. | ||
5. Access Prometheus at http://localhost:9090. | ||
6. Access Grafana at http://localhost:3000 and use the credentials defined in the .env file. | ||
|
||
## CI/CD | ||
|
||
The CI/CD pipeline is defined in .github/workflows/ci-cd.yml and performs the following actions: | ||
|
||
- Builds and pushes Docker images. | ||
- Deploys the system using Docker Compose. | ||
- Checks that the services are running correctly. | ||
- Checks that the out of the box dashboards are working with data from the datasource(prometheus). | ||
|
||
|
||
### Setting Up GitHub Secrets | ||
|
||
To set up GitHub secrets for the CI/CD pipeline, follow these steps: | ||
|
||
1. Navigate to your forked repository on GitHub. | ||
2. Go to **Settings** > **Secrets and variables** > **Actions**. | ||
3. Add the following secrets: | ||
- `DOCKER_USERNAME`: Your Docker Hub username. | ||
- `DOCKER_PASSWORD`: Your Docker Hub password. | ||
- `GF_SECURITY_ADMIN_USER`: Your Grafana admin username. | ||
- `GF_SECURITY_ADMIN_PASSWORD`: Your Grafana admin password. | ||
|
||
|
||
## Monitoring | ||
|
||
- Prometheus: Access Prometheus at http://localhost:9090. | ||
- Grafana: Access Grafana at http://localhost:3000 and use the credentials defined in the .env file. | ||
|
||
## Contributions | ||
|
||
Contributions are welcome. Please open an issue or submit a pull request. | ||
|
||
## Files | ||
## License | ||
|
||
- `docker-compose.yml`: Docker Compose configuration. | ||
- `prometheus/prometheus.yml`: Prometheus configuration. | ||
- `grafana/provisioning/datasources/datasource.yaml`: Grafana datasource for Prometheus. | ||
- `grafana/provisioning/dashboards/dashboard.yaml`: Grafana dashboard configuration. | ||
- `grafana/dashboards/dashboard.yml`: Out of the box dashboard to check if Prometheus is up. | ||
This project is licensed under the MIT License. | ||
|