Raspberry Pi and JavaScript — A simple site health check monitor — Part 2
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:
- Connect the raspberry pi to your computer as mentioned in the previous article
- Go to Terminal and type the command arp -a to list the devices connected
- Login into the raspberry pi using ssh pi@192.168.2.2 (provided 192.168.2.2 is the IP of your raspberry)
- 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)
- If the login is successful you will see in the command line pi@raspberrypi:~ $
- Create a directory for our project. For example mkdir site-health-check