Code Monkey home page Code Monkey logo

rpi-tig's Introduction

rpi-tig

Dockerized Telegraf/InfluxDB/Grafana for Rpi

I just wanted a fire-and-forget way to quickly monitor a new Pi, this is it. On a Raspbian Buster image, simply:

apt-get install docker.io docker-compose

... clone this repository, and do a single ./start.sh. You should be set. After a couple of minutes (it's a Raspberry Pi after all), you will get the following:

  • A telegraf instance gathering system stats, with statsd available on the local host for external log input
  • InfluxDB storing the telegraf data
  • Grafana already configured to talk to the InfluxDB instance, and preconfigured with a default system dashboard

I made a moderate effort to at least randomize the Influx database password at first run, and Grafana will remind you to change the admin password. That said, if you put this in production as is, it's really on you. There are many things that should still be done before considering this secure in any way...

Included dashboards

The grafana instance is automatically provisioned with a couple of dashboard that are useful for me, and in any case are hopefully interesting examples of what grafana + influx can do.

  • System stats: a Raspberry Pi centric system monitoring dashboard
  • goestools: monitors the statistics of a goestools receiver
  • ax25 clients: traffic statistics of an Amateur Radio AX25 stack (see additional info below)

AX25 dashboard

Look in the utils directory for the files you should install on your Pi to spawn a listen process that is logged to /var/log and picked by Telegraf.

Notes

  • telegraf inside a Docker container will not be able to monitor your network interfaces, obviously
  • This stack works remarkably well on a Pi 3B+ (and 4, of course). I've had it monitor devices for months at a time with zero issues
  • Thanks to docker-compose/Docker, the stack will survive a reboot
  • Provisioned dashboards on Grafana cannot be saved, so they really should be used as templates, and saved as a new Dashboard if you want to edit/modify them
  • Feel free to contribute PRs with useful dashboards if you have some

rpi-tig's People

Contributors

elafargue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rpi-tig's Issues

Install on Another System

is it possible to install this on another pi and remotely connect to the pi that has the stated on it? If so how do I go about doing that?

Regards,

Bad Gateway

I have installed this on a Pi 3 with 0 issue.
I then installed it on a pi for and I get a Bad Gateway when testing the database and dont get any data.
Any ideas?
Thanks

InfluxDB dependency seems to be failing

Doing an initial install on my RPi4 running my goesproc system, and seeing this:

pi@wxrx:~/src/rpi-tig $ ./start.sh
Changing ownership of grafana files to what the Docker image expects
Starting TIG stack in the background
Pulling influxdb (influxdb:1.8.4-alpine)...
1.8.4-alpine: Pulling from library/influxdb
ERROR: no matching manifest for linux/arm/v7 in the manifest list entries
Waiting for InfluxDB to come up...Error: No such container: influxdb
.Error: No such container: influxdb
.Error: No such container: influxdb
....

Not sure what happened (Docker is not my strong suit), but it looks like something changed with influxdb's image that doesn't sit well with the Raspi architecture.
And thoughts on a solution?

-John

Stays on "Waiting for InfluxDB to come up......." endlessly

I'm running this on a Raspberry Pi 4 with 8GB or RAM, booting from a m2 SSD drive (so the Pi is actually quite rapid).

Steps to reproduce:

  1. Clone repository as requested
  2. Edit the env.grafana and env.influxdb files to update passwords as recommended (kept them simple for testing, so no risk of unescaped characters etc.)
  3. Ran ./start.sh and waited. Docker pulls the images and creates the containers, but the terminal just sits at Waiting for InfluxDB to come up... forever.

I can access Grafana's UI by visiting http://PI-IP-ADDRESS:3000 and can login, but only with the default admin:admin combination (so it looks like the variables from the env.grafana aren't being pulled through yet. I also tried the monitor:mynewpassword but that failed to login.

I then thought it might be a permissions issue, so updated the docker-compose.yml to include:

user: "0"

Which should then run the containers as the root user on my Pi, but the same issue - constant waiting for InfluxDB to come up.

Checking the logs of the grafana/influxdb container seems to show that Telegraf is getting a 401 error (unauthorised), approximately every 10 seconds. The logs for the telegraf container shows "Failed to write metric" and mirrors the 401 error code shown in grafana/influxdb.

Upon closer inspection, I saw that there's a telegraf.conf file that also needs updating to use the password, so I tried again after updating that, but the waiting message still continues endlessly.

Docker install

Not sure why, but I could not get
apt-get install docker.io docker-compose
to run, I tried it on and extra PI with a fresh install of raspberian as well, ended up using this route and it all worked.

  1. Install Docker
    curl -sSL https://get.docker.com | sh

  2. Add permission to Pi User to run Docker Commands
    sudo usermod -aG docker pi

Reboot here or run the next commands with a sudo

  1. Test Docker installation
    docker run hello-world

  2. IMPORTANT! Install proper dependencies
    sudo apt-get install -y libffi-dev libssl-dev
    sudo apt-get install -y python3 python3-pip
    sudo apt-get remove python-configparser

  3. Install Docker Compose
    sudo pip3 install docker-compose

Issues With InfluxDB

@elafargue I am having some issues. I don't think the start commands are working correctly as when I go into the docker container, it throws an error saying there is no database. I auth, then I do, SHOW DATABASES, and it shows telegraf and _internal. I say use telegraf, but it still doesn't work. After a reboot, it goes back to nothing as well

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.