opkg fails to install luci-app-statistics

tdicola:
So this is pretty cool

Yes, it is! 8) I've been playing with collectd a little bit. Displaying it this way is MUCH easier than writing web pages to call rrdcgi.

Collecting memory and disk space is interesting, but I really wanted to be able to collect and display sensor data collected from a sketch. The collectd python plugin sounded like a good solution, but that plugin doesn't appear to be available for the Yun? (At least not through opkg, or at least not that I could find.)

I just found this post where you are using python with the exec plugin. I wanted to avoid exec because it spawns a new process on each sample, at least that's what I heard. But by putting a loop in it, it seems you've found a way around this overhead. Nice.

I handled getting the data from the sketch a little differently than you, I used the Bridge library. The sketch reads a set of temperature sensors, and uses Bridge.put() calls to save the current values. Then the python script periodically uses the Bridge to get() the values and send them to collectd. This is my python script:

#!/usr/bin/python

# A python script designed to be run by the exec module of collectd.
# It uses the Bridge library to "get" values that were "put" by the sketch.
# This script assumes that there will be a value 'tempCnt' that indicates
# how many temperature values there are to read. The actual values are
# named 'tempF_1', 'tempF_2', etc.

import os
import sys
import time
sys.path.insert(0, '/usr/lib/python2.7/bridge/')

from bridgeclient import BridgeClient as bridgeclient
bridge = bridgeclient()

# Read hostname environment variable set by collectd exec plugin.
hostname = os.environ.get('COLLECTD_HOSTNAME', 'localhost')

while True:
    #Gather temperatures
    count = int(bridge.get('tempCnt'))
    if count > 0:
        for c in range(count):
            # Form the name and get the value from the bridge
            key = 'tempF_{0}'.format(c+1)
            temp = bridge.get(key)

            # Make sure a value was actually read
            if (temp != None):
                #output value to be sent to collectd exec plugin
                print 'PUTVAL "{0}/exec-{1}/gauge" {2}:{3}'.format(hostname, key, 0, temp)

    sys.stdout.flush()

    # give up processing time to not bog down the CPU and limit the update rate
    time.sleep(10)

Just another way of approaching it. It may be a little more overhead using the Bridge, but it doesn't require parsing data on the python end. And, for my application, I also wanted to be able to remotely retrieve the current data values without having to tap into the collectd stream: using the bridge gives you the ability to access "http:arduino.local/data/get" to retrieve all bridge data values -- for free with no extra code needed!