The brickd exporter is a Prometheus exporter which connects to a Tinkerforge brickd and exports the values from the connected bricks and bricklets.
Data from the brickd is collected in the background. Currently callbackPeriod is set to 10,000 ms, which can be changed in the config.
go version 1.11 or later (go modules are used in this repo).
Clone the repository via go get github.com/vetinari/brickd_exporter
or git and cd into the directory.
Then build the brickd_exporter binary with the following commands.
$ go build
When no --config.file /path/to/brickd.yml
is given, the default config is:
collector:
log_level: info
callback_period: 10s
ignored_uids: []
listen:
address: :9639
metrics_path: /metrics
brickd:
address: localhost:4223
Any of these values can be set. Use the default brickd.address
when the bricks are connected
on local USB port.
collector.log_level
can be set to debug
to see the devices discovered and their values received
from the callbacks.
Start with --config.file /path/to/brickd.yml
to pass a config file.
Bricks:
Bricklets:
- Barometer Bricklet
- Barometer Bricklet v2.0
- Humidity Bricklet
- Humidity Bricklet v2.0
- Outdoor Weather Bricklet
Adding more is easy, see Contributing
If you would like to contribute code or documentation, follow these steps:
- Clone a local copy.
- Make your changes on a uniquely named branch.
- Comment those changes.
- Test those changes
- Make sure the code is go formatted (hint:
gofmt -w $file
) - Push your branch to a fork and create a Pull Request.
- add register function, check the existing ones in collector/bricks.go / collector/bricklets.go as examples.
- add the functions to the
NewCollector
, example of existing ones:
brickd.Devices = map[uint16]RegisterFunc{
master_brick.DeviceIdentifier: brickd.RegisterMasterBrick,
humidity_bricklet.DeviceIdentifier: brickd.RegisterHumidityBricklet,
}
- don't forget to update the imports
- test new devices and create a pull request (see above).