Reporting the system stats of a Raspberry PI to COSM with python

less than 1 minute read

COSM is a online data store of sensor data for the internet of things. You can use Cosm to store sensor data (light, temp, heat, etc…) from your internet enabled device (Arduino, Raspberry PI, etc) online and produce pretty graphs of the values as they change. Recently Chipkin Automation Systems (The company I work for) added COSM as one of the supported drivers on their CAS Gateway device.

This got me to thinking of how I could track system stats from my Raspberry PI with python and record the stats on COSM.

I have written about sending data to COSM with a Raspberry PI before in my Raspberry PI and the GPIO pins post.  Adafruit also has a great tutorial on this as well Send Raspberry Pi Data to COSM.

This code snippet will get the system stats (CPU, Ram, Disk Space) from the Raspberry PI, We can then send these values to COSM. I then added in the eeml class to talk to the COSM servers. I also added reading a light sensor that is connected to an Arduino talking pyfirmata.

Full source code can be found on my github account.

Light graph

 

 

 

Leave a comment