Skip to content

coreindustries/raspberry_ping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

raspberry_ping

Use the Raspberry Pi to record ping times to https://cosm.com

Uses the child_process to run a system-level ping, then parses the results and sends to Cosm for storage and charting.

Install

To install, first ensure you have git, node and npm installed on your Pi:

sudo apt-get install git nodejs npm

Then

git clone https://github.com/coreindustries/raspberry_ping.git

Ensure you're in the directory with index.js, then run:

npm install

Edit index.js to add your Cosm api key, data feed, and URL to monitor

    cosm_api_key = 'enter key here',        // update this
    cosm_data_feed = 'enter feed id here',  // update this
    url = 'google.com',                     // update this
    check_frequency = 5,                    // seconds

Run from the same directory where index.js resides:

nodejs index.js

This script can also run on other variations of Unix, inluding OSX. However you'll have to update the regex to parse the ping response, since each platform has a slightly different ping output. I've included the regex for OS X as a comment.

You'll also need to update the array position of the value to send to Cosm

stream.addPoint(p[6]);  // make this 5, if used on a mac

To install a system boot, here's some documentation: http://www.stuffaboutcode.com/2012/06/raspberry-pi-run-program-at-start-up.html

About

Use the Raspberry Pi to record ping times to Cosm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published