Giter VIP home page Giter VIP logo

freebox-exporter's Introduction

freebox-exporter

Prometheus exporter for the Freebox

Disclaimer: I am not related to Iliad, Free or any of their subsidiaries. I have only created this Prometheus exporter to monitor my own device using some publicly available documentation.

Install

Since Golang 1.16

Having a working Golang >= 1.16 environment using Go modules:

go install github.com/trazfr/freebox-exporter@latest

Older Golang

This package requires at least Golang 1.13. For Golang 1.13:

GO111MODULE=on go get github.com/trazfr/freebox-exporter@latest
GO111MODULE=on go install github.com/trazfr/freebox-exporter

Use

This program is to be run in 2 steps, as you must authorize the exporter to access the Freebox. Once authorized, it may be run from anywhere.

Usage: freebox-exporter [options] <api_token_file>

api_token_file: file to store the token for the API

options:
  -debug
        enable the debug mode
  -hostDetails
        get details about the hosts connected to wifi and ethernet. This increases the number of metrics
  -httpDiscovery
        use http://mafreebox.freebox.fr/api_version to discover the Freebox at the first run (by default: use mDNS)
  -listen string
        listen to address (default ":9091")

Step 1 authorize API

From the Freebox network, generate a token file for the API. The file token.json must not exist:

$ freebox-exporter token.json
Could not find the configuration file token.json
Freebox discovery: mDNS
1 Please accept the login on the Freebox Server
...

You must accept the API on the Freebox device.

Once done, the credentials will be stored in the new file token.json

In case of errors:

If you get the message panic: Access is timeout, you have to be faster to accept the access on the Freebox.

If you get the message panic: MDNS timeout, there may be a firewall preventing you to use mDNS. You may try to get the token using HTTP:

$ freebox-exporter -httpDiscovery token.json
Could not find the configuration file token.json
Freebox discovery: GET http://mafreebox.freebox.fr/api_version
1 Please accept the login on the Freebox Server
...

Step 2 run

Once you have generated the token you may run from anywhere.

$ freebox-exporter token.json
Use configuration file token.json
Listen to :9091

Then you may test it:

$ curl 127.0.0.1:9091/metrics
# HELP freebox_connection_bandwith_bps available upload/download bandwidth in bit/s
# TYPE freebox_connection_bandwith_bps gauge
...

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.