• Stars
    star
    769
  • Rank 59,078 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created over 11 years ago
  • Updated about 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Manage and monitor your Raspberry Pi with ease

Ground Control

Ground Control is a Go based daemon that runs on your Pi and lets you manage and monitor it with ease.

See a screenshot of the management UI and my Pi's temperature on Librato.

See FAQ for some common question that got asked on the Hacker News thread.

Update: I just pushed groundcontrol-ui if you want to hack on the UI part of groundcontrol.

Usage

Download the Ground Control package, or build from source (see Development).

Then, transfer it to your Pi.

$ scp groundcontrol-v0.0.1.tar.gz pi-user@PI_HOST:

or download it directly on your Pi

$ wget http://jondot.github.io/groundcontrol/groundcontrol-0.0.1.tar.gz

On the Pi, extract and change directories.

$ tar zxvf groundcontrol-0.0.1.tar.gz
$ cd groundcontrol-0.0.1/

Run Ground Control with a simple command (you should have config.json.sample there for a quick start).

$ ./groundcontrol -config myconfig.json

You can access the UI from your browser on port 4571.

http://PI_HOST:4571/

For configuration, use groundcontrol.json.sample as a basis and make sure to customize these fields:

  • librato - You can make a free account at Librato and then drop the key and user there.

  • tempodb - You can make a free account at TempoDB and then drop the key and user there.

  • Graphite or hostedgraphite - You can use your own standard Graphite server, or you can make a 14-day trial account at Hosted Graphite and then drop the key as a prefix. Important: for prefix specify a trailing dot . and postfix a leading dot ., if you want them.

Here's a typical graphite config:

  "graphite" : {
    "prefix"  : "prefix-or-key.",
    "postfix" : ".ip-pi",
    "linerec": "localhost:2003"
  },

Make sure to go over the plans (paid and free) and see what fits you best.

Both Librato and TempoDB were included because they have different retention and resolution and features for the free plans.

Next up, set up your "controls". This is where you input a label, and an "on", "off", "once" commands to automatically build a GUI around it.

Here is an example of having an xbmc control. It allows for shutting down and turning on XBMC.

  "controls" : {
    "xbmc": {
      "on" : "/etc/init.d/xbmc start",
      "off" : "/etc/init.d/xbmc stop"
    }
  }

init.d

You might want to use an init.d or upstart script to keep groundcontrol up at all times.

An default init.d script is included here support/init.d/groundcontrol.

Place your groundcontrol folder at:

/opt/groundcontrol/

And configuration should be at:

/etc/groundcontrol.json

You can edit your support/init.d/groundcontrol if you want to modify these paths.

After you've verified /etc/init.d/groundcontrol start to be working, to set up the default run order you can use:

$ update-rc.d groundcontrol defaults

FAQ

Q: Is this specific to the RaspberryPi?
A: Nope. Mechanically, it was built to work on any Unix like environment - just in case. However, the fact that Go makes such a slim resource profile, and a cross-compilation toolkit that works well makes it perfect for it (takes very little resource).

Q: Why was this made?
A: So here we go:

  • For fun (as said here)
  • Scratching my own itch - I needed a way to remotely run commands though a nice UI, and a way to see how my Pi is doing when I'm not at home.
  • For lack of better tooling - every thing I evaluated needed a combination of things, no other tool gave me all-in-one. This made the resources bloated. With GC, you get a few megabytes of memory usage.
  • To prove to myself that Go can be as great for development on the Pi as Python (which many people use there) I also like the idea of Internet of Things http://en.wikipedia.org/wiki/Internet_of_Things

Q: Does it need root?
A: Not necessarily. Since it runs shell commands for you exposed through REST, it boils down to whether your commands require root (example for these is starting/stopping services)

Q: Does it work on Windows?
A: No. For health collection it uses the production grade library sigar which support unixy environments. Thankfully, there was a go port of it.

Q: Can you do the same thing with other tools
A: Yes. I would opt for Collectd with a good set of plugins and which is C based. You'll have to make sure there's a plugin for your choice of metrics database. Then write some kind of Web endpoint in Python to execute shell commands. However as I mentioned before, sum up the resources of those, and you'll get a bigger consumption.

More Details

There's plenty more to Ground Control under the hood, let's list out a few things.

Temperature Monitoring

Ground control will read a file containing a temperature reading to update its own health records.

This is made so the mechanism is flexible -- you can use Ground Control on any machine (not just a Pi) as long as it will expose a temperature reading in a file-like device.

Controls

You can add and remove controls (commands that your Ground Control can run) by editing or specifying them with your configuration file..

Here's a full description of the format:

{
  "control_name": {
    "on" : "cmd for on, normally a 'start' for a service",
    "off" : "cmd for off, normally a 'stop' for a service",
    "status" : "A command that returns the status of the process",
    "once" : "a one time command, a cleanup, a shutdown etc."
  }
}

By convention control_name is snake_case and we turn it into "Control Name" on the UI.

The name should be nice for using in a REST API, in this case the commands turn into:

POST controls/control_name/on
POST controls/control_name/off
POST controls/control_name/once
GET controls/control_name/status

The on, off, and once commands are async, and we return a 202 OK for success. The status command are async, and we return a 200 OK for success.

And you can easily build an app (mobile?) yourself that makes use of those.

Development

Here's a short guide if you want to experiment with Ground Control yourself.

In each case, start off by taking a Ground Control repo clone.

Compiling

Set up dependencies and build:

$ go get github.com/jondot/gosigar
& go build

Cross Compiling

You probably want to build on your own (much more powerful) system rather than on the Pi itself to save time.

In my case I'll be compiling a Go binary on a Mac (OSX, x64), for a Raspberry PI (Linux, ARMv5/6).

Here's how to do it on a Mac and brew:

$ brew install go --devel --cross-compile-all    # I usually take --devel with Go, drop if you don't.

If you've got ZShell, or a nice alias-supporting shell, this is a nice alias:

alias go-pi='GOARCH=arm GOARM=5 GOOS=linux go'

and then I just

$ go-pi build

If you don't want to use an alias then this is the command to cross-compile for the Pi:

$ GOARCH=arm GOARM=5 GOOS=linux go build

Implementation Details

Ground control surrounds around several concepts:

  • Reporter - an entity that takes a Health, and reports it to somewhere.
  • Health - the entity that's responsible to gather all of the important health metrics.
  • Control - a switchboard-like entity that runs commands on request.

They are sorted by the level of fun/hackability you can get from it, but YMMV :).

Note, that go-metrics for example, could have replaced the entire reporter stack here using its various pluggable reporters, however, it only supports integers out of the box.

At the worst case, go-metrics itself can be implemented as a reporter (in fact it will be an aggregate reporter of reporters :).

Contributing

Fork, implement, add tests, pull request, get my everlasting thanks and a respectable place here :).

Copyright

Copyright (c) 2013 Dotan Nahum @jondot. See MIT-LICENSE for further details.

More Repositories

1

awesome-react-native

Awesome React Native components, news, tools, and learning material!
JavaScript
33,342
star
2

hygen

The simple, fast, and scalable code generator that lives in your project.
JavaScript
5,610
star
3

graphene

Graphene is a realtime dashboard & graphing toolkit based on D3 and Backbone.
CSS
2,881
star
4

react-flight

The best way to build animation compositions for React.
JavaScript
2,825
star
5

awesome-devenv

A curated list of awesome tools, resources and workflow tips making an awesome development environment.
2,622
star
6

sneakers

A fast background processing framework for Ruby and RabbitMQ
Ruby
2,246
star
7

goweight

A tool to analyze and troubleshoot a Go binary size.
Go
1,687
star
8

rust-how-do-i-start

Hand curated advice and pointers for getting started with Rust
1,055
star
9

ReactNativeKatas

This is a project that lets you participate in a fully-immersive, hands-on, and fun learning experience for React Native.
JavaScript
947
star
10

awesome-weekly

An "awesome" type curated list of quality weekly subscription newsletters from the software world
890
star
11

blade

Better asset workflow for iOS developers. Generate Xcode image catalogs for iOS / OSX app icons, universal images, and more.
Go
818
star
12

rn-snoopy

Snoopy is a profiling tool for React Native, that lets you snoop on the React Native Bridge.
JavaScript
523
star
13

react-native-slowlog

A high-performance timer based profiler for React Native that helps you track big performance problems.
JavaScript
374
star
14

awesome-rust-llm

🦀 A curated list of Rust tools, libraries, and frameworks for working with LLMs, GPT, AI
220
star
15

crunch

A fast to develop, fast to run, Go based toolkit for ETL and feature extraction on Hadoop.
Go
210
star
16

moxy

The programmable mock proxy
Ruby
120
star
17

webnull

web/null eats your HTTP
CoffeeScript
104
star
18

padrino-warden

A Padrino module that provides authentication for your Padrino application through Warden
Ruby
100
star
19

tauri-tray-app

A Tauri tray app starter 🦀
TypeScript
94
star
20

roundtrip

Simple tracking and metrics for your business processes in real-time
Ruby
89
star
21

awesome-aha

Awesome list for "Aha!" moments related to programming and computer science. Accelerate your learning.
82
star
22

nina

The friendly web microframework that performs!. Nina is a feature complete web microframework for the .Net platform, inspired by Sinatra
C#
70
star
23

frenzy_bunnies

RabbitMQ JRuby based worker framework on top of march_hare (hot_bunnies)
Ruby
70
star
24

redux-stack

Redux Stack is a library that helps you build modular, structured, and cleaner redux apps
JavaScript
67
star
25

storybook-cartesian

Automatically generate stories for all of your component variants
TypeScript
63
star
26

vitals

Flexible StatsD instrumentation for Rails, Rack, Grape and more
Ruby
51
star
27

version_bumper

Bump your versions
Ruby
47
star
28

logbook

Log your memories onto virtual logbooks made of Gists
Ruby
43
star
29

mediumize

Automatically post (and cross-post) your markdown style blog posts to your Medium account from Jekyll, Middleman, Hugo and others.
Ruby
40
star
30

nchurn

.Net based churn analyzer for your build
C#
37
star
31

awesome-designops

Awesome DesignOps is an awesome style list that curates the best design ops news, tools, tutorials, articles and more.
JavaScript
37
star
32

scatter

Ruby
35
star
33

benchmark-ipsa

An iterations per second enhancement to Benchmark that includes memory allocations
Ruby
32
star
34

go-cli-starter

A Go based command line interface starter app (CLI)
Go
32
star
35

fattyproject

Go
32
star
36

react-native-network-boot

An alternative way of bootstrapping development network bundling for React Native
JavaScript
31
star
37

awesome-beginners

A list that curates resources to help you teach your kids, wives, husbands, family or friends how to code
29
star
38

gulpjs-phaser

CSS
29
star
39

xtaskops

Goodies for working with the xtask concept in Rust
Rust
29
star
40

PrimerApp

JavaScript
25
star
41

groundcontrol-ui

JavaScript
25
star
42

attrs-serde

A serialization addon for attrs.
Python
24
star
43

passage

Personal, tiny, flexible, OpenID provider
Ruby
22
star
44

pgpipeline

A Scrapy pipeline module to persist items to a postgres table automatically.
Python
21
star
45

hygen-CRA

Perl 6
21
star
46

redux-duet

Redux action and handlers together, alleviate boilerplate.
JavaScript
20
star
47

langchain-llm-katas

This is a an open-source project designed to help you improve your skills with AI engineering using LLMs and the langchain library
Python
18
star
48

vscode-hygen

This extension bundles Hygen into VSCode and offers seamless code generator functionality right into your editor.
TypeScript
18
star
49

pcwr

Pragmatic Concurrency With Ruby
Ruby
17
star
50

castbox

A chromecast 1.0 emulator
Go
17
star
51

formation

A generic functional middleware infrastructure for Python.
Python
17
star
52

elb-dash

A self-updating ELB status board / dashboard built with React, Coffeescript and Node.js.
CoffeeScript
16
star
53

make-vscode-more-like-vim

Make VSCode more like vim
15
star
54

qtools

qtools are a set of tools to greatly ease your MSMQ operations, monitoring and deployment
C#
15
star
55

hygen-add

hygen-add is one of the tools in the Hygen toolbelt which allows you to add pre-made generator packages to your project.
JavaScript
14
star
56

deep-learning-parameters-cheatsheet

14
star
57

elasticsearch-balance

Visualize the data distribution of your Elastic Search cluster using a Treemap
JavaScript
13
star
58

darkness

JRuby with Swing WriteRoom/Darkroom-like editor.
Java
13
star
59

heatmapdotnet

Heatmap generator for .Net
C#
13
star
60

blade-sample

Swift
13
star
61

rawsort

A simple but powerful RAW photo import tool built to have amazing performance and integrate with photography workflows.
Rust
13
star
62

hypermatch

A fast, sandboxed micro matching engine with serializable rules.
JavaScript
12
star
63

cottonballs

Your own mock, fluffy version of GCM for testing purposes
CoffeeScript
12
star
64

packs

An open-source BoxJS/CSS/Etc clone, suitable for hosting at Heroku
JavaScript
12
star
65

rrgen

Rust
11
star
66

10bisbar

A bitbar plugin that helps you do the math for your 10bis account
Go
11
star
67

primer-bind

Go
11
star
68

dg

Check a folder for dirty git repositories, forgotten branches and commits
Rust
11
star
69

lidar

A take on ThoughtWorks' Radar. You can use this tool and system to make your very own technological Radar.
JavaScript
11
star
70

statsd-stack

A statsd Sprinkle stack
Ruby
11
star
71

react-rust-chrome-starter

Chrome extension template with Rust 🦀 and React using Vite and tailwind
TypeScript
11
star
72

celeste

An all-in-one tool for the repository maintainer.
JavaScript
10
star
73

statsd-cli

Simple Statsd command line interface
Ruby
10
star
74

jill

Jill is your README.md assistant
Ruby
10
star
75

dazzling

Dazzling is a project website generator based on Gatsby and React that's simple, quick, and extensible.
JavaScript
10
star
76

logolang.org

Retro LOGO with a modern twist. Built with Rust+WASM 🦀
TypeScript
10
star
77

firebase-simple-storage

An unofficial Go based client for Firebase storage that preserves security (goes through Firebase and not Google Cloud Storage).
Go
10
star
78

signup

Easy and lightweight signup service
Go
9
star
79

keymaps

Shell
9
star
80

gravy

Sweet sauce for your Gravatars: realtime gravatar manipulation with Node.JS
9
star
81

autobrew

Automate homebrew formula publishing for your CLI tools, regardless of programming language.
Go
9
star
82

webogram

Snap your web pages through Instagram inspired filters. You can use this to generate wallpapers for phone and desktop, icons, and book covers
JavaScript
9
star
83

goddamn-javascript-babel

A zero config package that gives you a bleeding edge Javascript, with the latest proposals including pipe operator foo |> bar, optional chaining foo?.bar, null coalescing foo ?? bar and more.
JavaScript
9
star
84

arper

A network utility and library for discovering network device via ARP scans, including vendor names.
Go
8
star
85

react-native-fs-walker

A React Native file system walker and file tree debugging tool
JavaScript
8
star
86

hypercontroller

A more civilized controller abstraction for TypeScript and Node.js. Hosts libraries for controllers built using hypergen
TypeScript
8
star
87

es-diag

Elastic Search health checks and problem discovery toolkit
Ruby
8
star
88

pocket-emails

A compact tool that sends digest emails from your Pocket account with Mailgun.
JavaScript
8
star
89

dash

Communicate to the mass with Dash on your TV/LCD/Plasma
JavaScript
8
star
90

armor

WIP - a pragmatic Go microservice framwork
Go
8
star
91

react-native-bundles

Hand-picked bundles of React Native libraries and components that go well together for any kind of app
8
star
92

react-redux-classconnect

JavaScript
7
star
93

react-native-group-image

A <GroupImage /> component for React Native. A group image will be responsive towards the amount of images it needs to display
JavaScript
7
star
94

serverless-zen

A serverless starter project focusing on uncompromising local development experience without serverless fatigue.
TypeScript
7
star
95

dotlinker

Use dotrunner and dotlinker to build a fantastically aesthetic macOS dotfiles set up.
Python
7
star
96

dotfiles

configuration files.
Vim Script
7
star
97

outpostapp

Flexible file upload app
JavaScript
7
star
98

appium-solo

Appium simplified: Run E2E tests with a dedicated appium instance per device.
JavaScript
6
star
99

stylomatic

Zero configuration for typescript, react, and more
JavaScript
6
star
100

mongomon

A Python mongodb monitor and profiler for development.
Python
6
star