Announcement

Collapse
No announcement yet.

Logging PRi feeder status

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Logging PRi feeder status

    So recently, I've had a few stability issues with my Raspberry Pi. I wanted to log fr24feed status, CPU temperature and up time. I did not want to log this to the Pi's sd card, as this would decrease the life of the card. So I have created a simple bash script to log this data to a spreadsheet in my Google Drive.

    I use https://ifttt.com to handle to output from the script.

    It works like a charm, and using the collected data, I have identified the problem which is now resolved.

    I've created a github project for this script, and I plan to add more features in the future. Hopefully someone will fork the project and add some useful feature. https://github.com/paul30003/fr24mon/

    I run this as a cron job every 30 minutes and I have collected some very useful data over the past few weeks.

    Code:
    #!/usr/bin/env bash
    ###########################################################################
    # Originally written by: Paul Fryer, 2016
    # https://github.com/paul30003/fr24mon/
    # License: GPL (>= 2.1) [http://www.gnu.org/licenses/gpl.html]
    ###########################################################################
    
    PIDFILE=/var/run/fr24feed.pid
    
    trigger="your ifttt trigger event name"
    
    secret="your ifttt secret key"
    
    
    # Test if FR24FEED is running
    
    if [ -e "$PIDFILE" ]
    
    then
     status_msg="FR24FEED Running"
    
    else
     status_msg="FR24FEED Stopped"
    fi
    
    # Get Pi Data
    
    tempC=`/opt/vc/bin/vcgencmd measure_temp`
    
    running=`uptime -p`
    
    # Send to IFTTT
    
    json="{\"value1\":\"${tempC:5}\",\"value2\":\"${status_msg}\",\"value3\":\"${running:2}\"}"
    
    curl -X POST -H "Content-Type: application/json" -d "${json}" https://maker.ifttt.com/trigger/${trigger}/with/key/${secret}
    T-EGMC85 - SEN
Working...
X