Skip to content

InfluxDB and Grafana Configuration

aaronsathya edited this page Aug 23, 2024 · 22 revisions

Important

  1. Start the InfluxDB and Grafana Configuration only after all the I2C Sensor Configuration steps have been completed.
  2. Make sure you type cd and hit enter to go to the home folder before the following steps
  1. Clone the MyVivarium RPi-IoT repository into the home folder:

    git clone https://github.com/myvivarium/RPi-IoT.git
    
  2. cd into the multisensors directory:

    cd RPi-IoT/multisensors
    
  3. Run influxdb-multisensor.py:

    python influxdb-multisensor.py
    

    You should begin to start seeing readings every minute from the sensors like this:

    Let the script continue running.

  4. In a new terminal window we will check if the infludb database "multisensors" has readings being sent to it:

    docker exec -it influxdb influx
    
    USE multisensors
    show measurements
    select * from illuminance
    

    You should begin seeing something like this:

    quit
    
  5. Open a browser window and navigate to localhost:3000/login - username is admin and password is admin; change the password when prompted for security reasons. This is the local Grafana application running on the Pi.

  6. Add your first datasource right from the home page links - select influxdb -> scroll down to "HTTP" and enter URL http://influxdb:8086

    Scroll down to the bottom and make sure that the Database is "multisensors", HTTP method is "GET", Min time interval is "2", then click "Save & test". If everything is successful, you will get a "datasource is working. 4 measurements found" message.

    Go to the menu dropdown (three tiny horizontal lines) on the left -> Dashboard -> New -> Import Dashboard -> Copy and paste the contents of "MyVivarium-Grafana-Dashboard.txt" [Link] into "Import via dashboard JSON model" box and click on "Load".

    When the Dashboard has been created, click the three dots on the top right of each panel and change the data source to influxdb with the appropriate measurement and hit "Save". Even though you may see "Temperature" or "Humidity" show up on the dashboard by default, you still have to manually change it for the dashboard to detect the values. Save the dashboard when successful and then provide a comment when prompted after saving.

    Proceed to repeat the dashboard setup for each sensor.

    Verify the sensors are working - example - try to block light entry to the illuminance sensor and notice any change in the readings

Once the above steps are completed, you can proceed to Service File Configuration