Watchmen Website Monitor on Raspberry Pi

Posted by {"display_name"=>"greg", "login"=>"greg", "email"=>"", "url"=>""} on March 30, 2017 · 3 mins read

Watchmen is lightweight node.js based website and service monitoring tool. This is a cheatsheet to setup Wachmen on a Raspberry Pi.

I'm running Watchmen on a Raspberry Pi with Raspbian and I'm starting it via Systemd.

Since Watchmen runs on node.js start by installing node:

Install Latest Node

sudo apt remove nodejs # to remove old version of node if installed
curl -sL | sudo -E bash -
sudo apt install nodejs
node -v

If you're running on an older ARMv6 based Pi (Pi 1 or Pi Zero), use these commands to install node:

sudo dpkg -i node_archive_armhf.deb
node -v

Install Redis

More detailed instructions can be found here.

sudo apt-get update
sudo apt-get install -y redis-server

In the startup config file /etc/systemd/system/ change the following line to match the Watchmen install directory location:

ExecStart=/usr/bin/redis-server /etc/redis/redis.conf


ExecStart=/usr/bin/redis-server /home/pi/watchmen/redis.conf

Start and check the status of the redis server:

sudo systemctl daemon-reload
sudo systemctl start redis-server
redis-cli ping  or  redis-cli -p 1216 ping
sudo systemctl status redis-server

Install git & Watchmen

sudo apt -y install git
git clone
cd watchmen
npm install

Edit the redis.conf File

Edit the redis.conf file in the watchmen directory and update the home directory to the location where you've just installed Watchmen.

You may also need to change the redis port.  The default Watchmen configuration expects to find redis at port 1216.

Manual Start

Let's start everything manually to make sure it works:

redis-server redis.conf
node run-monitor-server.js
node run-web-server.js

You should now be able to browse to the Watchmen home page at http://localhost:3000. After doing that stop the two Watchmen node processes.

Setup Environment Variables

Set any Watchmen environment variables you need to be set at runtime in the .env file in the Watchmen home directory. For instance:


Setup Foreman

Install foreman to help with setup Watchmen as a server under Systemd.

sudo npm install -g foreman

Now start Watchmen manually using Foreman and then confirm that you can browse to http://localhost:3000

nf start

Create the systemd startup files:

sudo nf export --app watchmen--user root -t systemd -o /lib/systemd/system/

The following files are created in /lib/systemd/system:

watchmen-monitor-1.service   # Starts run-monitor-server.js      # Requires, Wants watchmen-monitor-1.service              # Wanted-by, Wants
watchmen-web-1.service       # Starts run-web-server.js          # Requires, Wants watchmen-web-1.service

Enable the Service:

sudo systemctl enable

You need to tell Systemd about the new configuration files:

sudo systemctl daemon-reload

You can then start Watchmen with the command:

sudo systemctl start

Debug Output

Console messages under Systemd with Raspbian are written to /var/log/daemon.log

MQTT with Watchmen

I use MQTT with Watchmen to integrate website monitoring with my IoT tools. I wrote a plugin on to do this which you can find on github here.