Skip to content

CaptainIgl00/grafana-influxdb-docker-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Real-Time Data Visualization Stack

Logo InfluxDB      Logo Docker      Logo Grafana

Licence Last Version

Description

This project sets up a complete monitoring environment using Docker Compose to orchestrate InfluxDB and Grafana. It allows for collecting, storing, and visualizing real-time metric data. The configuration includes automatic initialization of InfluxDB and automatic configuration of Grafana with pre-configured data sources and dashboards.

Table of Contents

Prerequisites

  • Docker installed on your machine.
  • Docker Compose installed (version 3.7 or higher recommended).

Installation

  1. Clone the Repository
git clone https://github.com/CaptainIgl00/grafana-influxdb-docker-compose.git
cd grafana-influxdb-docker-compose
  1. Modify the .env file with your own information
INFLUXDB_DATABASE=db
INFLUXDB_USERNAME=user
INFLUXDB_ORG=org
INFLUXDB_PASSWORD=userpassword
INFLUXDB_TOKEN='token'

GRAFANA_USERNAME=admin
GRAFANA_PASSWORD=adminpassword

Note: Make sure to replace the values with your own information. Avoid using special characters such as quotes in the passwords to prevent interpretation issues.

  1. Run the Docker Compose file
docker-compose up -d
  1. Access Grafana at http://localhost:3000 and InfluxDB at http://localhost:8086

Usage

In order to add custom dashboards, you can use the Grafana interface.

  1. Create or Export a Dashboard

    • Create a new dashboard in Grafana.
    • Export it as JSON via Share > Export > Save to file.
  2. Add the Dashboard to the Project

    • Place the exported JSON file into the grafana-dashboards/ folder.
  3. Next time you start the project, the dashboard will be automatically added to Grafana.

Project Structure

grafana-influxdb-docker-compose/
├── docker-compose.yml           # Docker Compose file
├── .env                         # InfluxDB and Grafana credentials
├── grafana-dashboards/          # Folder for custom dashboards
│    └── Example Dashboard.json  # Example dashboard
│
└── grafana-provisioning/        # Folder for Grafana provisioning
    ├── datasources/
    │   └── datasource.yml       # Configures InfluxDB as the default data source
    │
    └── dashboards/
        └── dashboard.yml        # Automatically loads dashboards from grafana-dashboards/

Troubleshooting

Connection Issues with InfluxDB

  • Verify that the environment variables are correctly defined in the .env file.

  • Ensure that the init-influxdb service ran successfully by checking the logs:

docker-compose up

Dashboards or Data Sources Not Loaded

  • Check that the provisioning files are correctly placed in grafana-provisioning/datasources/ and grafana-provisioning/dashboards/.

  • Review Grafana logs for any errors:

docker-compose logs -f grafana-influxdb-docker-compose-grafana-1
  • Make sure that the InfluxDB token doesn't contain special characters that could be badly interpreted.

Environment Variables Not Expanded in YAML Files

  • Ensure that variables are referenced using the ${VARIABLE} syntax in the provisioning YAML files.

  • The environment variables must be exported within the Grafana container. You can verify them with:

docker exec -it grafana-influxdb-docker-compose-grafana-1 env | grep GF_

Contributing

Contributions are welcome! If you find bugs or have suggestions for improvement, feel free to open an issue or a pull request.

License

This project is licensed under the GPL-3.0 License. See the LICENSE file for details.

Releases

No releases published

Packages

No packages published