Raspberry Pi and JavaScript — A simple site health check monitor — Part 2

Siva
TIL JS
Published in
6 min readAug 21, 2016

--

Photo by Harrison Broadbent on Unsplash

This is part 2 of writing a simple health check monitor with Raspberry Pi and JavaScript. If you have not read part 1, please read that and then continue. You can read part 1 by clicking here

Requirement:

We need to write a program which pings a website at specific intervals and gets the HTTP status. If the status is more than 400 (Normally the HTTP status for a webpage will be 200 or 304 if the site is working fine) then we need to trigger a mail to a specific mail id.

Setting up the project:

  1. Connect the raspberry pi to your computer as mentioned in the previous article
  2. Go to Terminal and type the command arp -a to list the devices connected
  3. Login into the raspberry pi using ssh pi@192.168.2.2 (provided 192.168.2.2 is the IP of your raspberry)
  4. The above command will ask for a password for raspberry Pi. Enter the password for the raspberrypi. (Usually it is ‘raspberry’ if you have not changed the default password)
  5. If the login is successful you will see in the command line pi@raspberrypi:~ $
  6. Create a directory for our project. For example mkdir site-health-check

--

--

Siva
TIL JS

JavaScript lover. Full stack developer. Failed Entrepereneur.