Skip to content

ccremer/fronius-exporter

Repository files navigation

Fronius Exporter

Build Releases License

About

Scrapes a Fronius Photovoltaic power installation and converts sensor data to Prometheus metrics. It has been tested with Fronius Symo 8.2-3-M (Software version 3.14.1-10).

Grafana

Installing

Binary

  1. Download latest binary from the Releases page

  2. chmod +x fronius-exporter && mv fronius-exporter /usr/local/bin/

Package

Comes with systemd unit file.

  1. Download latest package from the Releases page

  2. sudo dpkg -i fronius-exporter_linux_amd64.deb (Debian/Ubuntu)

  3. sudo rpm -i fronius-exporter_linux_amd64.rpm (CentOS)

  4. sudo systemctl daemon-reload

  5. Edit the settings in /etc/default/fronius-exporter

  6. sudo systemctl enable fronius-exporter

  7. sudo systemctl restart fronius-exporter

Docker

  1. docker run -d --name fronius-exporter -p "8080:8080" ghcr.io/ccremer/fronius-exporter --help

Helm Chart

  1. helm repo add ccremer https://ccremer.github.io/charts

  2. helm install fronius ccremer/fronius-exporter

Usage

fronius-exporter --symo.url http://symo.ip.or.hostname

Upon each call to /metrics, the exporter will do a GET request on the given URL, and translate the JSON response to Prometheus metrics format.

Configuration

fronius-exporter can be configured with CLI flags. Call the binary with --help to get a list of options.

💡

All flags are also configurable with Environment variables.

  • Replace the - char with _ in the names and uppercase the names

  • Replace the . delimiter with __

  • CLI flags take precedence

Following calls are equivalent
fronius-exporter --symo.url http://...
SYMO__URL=http://... fronius-exporter

As a client API

See Example

Developing

Requirements

  • Go

  • Docker

Building

Run make help to see available goals

Platform related builds are handled by goreleaser:

export GOOS=linux
export GOARCH=arm64
export IMAGE_REPOSITORY=ccremer/fronius-exporter
goreleaser build --snapshot --clean --single-target

On the other hand you can also use the actual make build in combination with docker buildx

export GOOS=linux
export GOARCH=arm64
export IMAGE_REPOSITORY=ccremer/fronius-exporter

make build
# you now have a binary with arm64 arch

docker buildx build --platform linux/arm64 -t $IMAGE_REPOSITORY --push .

Test metrics

If you don’t have a Symo device at hand, you can fake one:

# In its own terminal
python3 -m http.server 8081

# In another terminal
go run . -v --symo.url http://localhost:8081/pkg/fronius/testdata/example_1.json

# Yet another terminal or browser
curl -L http://localhost:8080/metrics