realtime flukso sensor data to own database

We know we can query the flukso server via the API, but not for real-time data, i.e. the 1 secs readings.

We would like to having all 1 secs readings from all fluksos go to our own DB. Unfortunately, the fluksos are not on the same subnet (the IP of the DB is fixed and can be contacted from the flukso shell, we however cannot contact the fluksos easily from the DB server).
Soo... or we wait for Mosquitto on the Flukso (but how will we contact this MQTT server without having an IP?), or we implement a push strategy, such as:
+ on the flukso, execute "wget -q -O - http://localhost:8080/sensor/my_sensor_id?version=1.0&interval=minute&unit=watt" with cron every so many seconds, and append the new part to a csv like file
+ again with cron (from time to time), post the file with wget to a web interface which stores it in our DB (we could also do with a mysql client, but this probably won't be provided by a default flukso)

I 'm hoping/searching for an easier path (because this one is quirky). Hence, feel free to comment or post suggestions.

icarus75's picture


"the IP of the DB is fixed and can be contacted from the flukso shell, we however cannot contact the fluksos easily from the DB server"

What's sitting in between these two networks that prevents you from accessing the FLM's? Is it some kind of NAT device?

fablab-leuven's picture

Yes, it is a kind of NAT (= a laptop running hostapd (a soft access point) alongside a dhcp server + NAT, the configuration was done according to: http://nims11.wordpress.com/2012/04/27/hostapd-the-linux-way-to-create-v... )

After reading up on MQTT/Mosquitto, I believe it would be more appropriate to directly talk MQTT from the FLM to a MQTT broker installed next to the database server (=setting MQTT bridge on the FLM). In retrospect, this is exactly what the new flukso server will be accepting (see new FLM architecture at http://www.flukso.net/files/presentations/flukso.20121026.architecture.pdf).

Soo... exactly when should I privately msg my FLM serial for an Mosquitto upgrade ? ;)

icarus75's picture

MQTT support is in the pipeline. I'm working on stringing all pieces together. A release date hasn't been fixed yet. But it shouldn't be too far off.

fablab-leuven's picture

For my use-case which features only a couple of FLMs, I'd look into tunneling MQTT over ssh (with FLM client certificates, no password, see also http://mqtt.org/wiki/doku.php/ssh_tunnels). However, I presume this is less interesting for the Flukso.net server, hence my guess is you'll be doing this via the Mosquitto's mosquitto_tls_set function (http://mosquitto.org/api/files/mosquitto-h.html#mosquitto_tls_set). If you could comment, then I can start already looking into ways to bring our architecture in line with yours (meaning I have to do less works ;) Thanks !

icarus75's picture

Mosquitto does indeed have TLS support. But you have to compile it with OpenSSL. The FLM uses CyaSSL. It's a crypto library with much a lower memory footprint. So there's still some work left to make these two dance together.