Ciao: A Self Hosted Site Status Monitor with Email Notifications
I recently covered Monitorr, a dashboard for seeing whether sites of importance for you are up or down. A great piece of software, but it lacked any notification system. This missing piece meant you really had to monitor Monitorr in order to know if a site was up or down at any given time.
This brings us to Ciao. Ciao is a very clean looking system status monitor that provides the ability to view a simple, clean dashboard; but also offers a notification system via Email, as well as the option to use Webhooks in systems like RocketChat, Telegram, Slack, etc.
Our Installation Today
What you'll need:
- Docker-CE
- The proper SMTP information for your Email provider
- The Command to pull and start Ciao.
Docker-CE
I have several videos on how to install Docker-CE, Docker-Compose, and other base level software packages that I use in most of my videos. Today, we just need the Docker-CE portion.
If you're running Linux (and more specifically Ubuntu 18.04 or 20.04), I have a scrpt that will install Docker-CE, Docker-Compose, and all their dependencies.
#!/bin/bash
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
## for ubuntu 18.04
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
## for ubuntu 20.04
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install docker-ce -y
## now set user as part of docker group
sudo usermod -aG docker ${USER}
## install docker-compose
sudo apt install docker-compose -y
Create a directory called Ciao, then create a file inside that directory called "docker-install.sh" and copy the above text, then paste it into the file.
mkdir ciao
cd ciao
nano docker-install.sh
Paste the above code into it, and remove either the Ubuntu 18.04 part, or the Ubuntu 20.04 part. If you're running 18.04, remove 20.04, and vice-versa.
Save the script with CTRL+O, then press Enter / Return, and exit nano with CTRL+X.
Now we can run the script like this:
. ./docker-install.sh
Enter your sudo password when prompted.
Let it finish, then reboot or log out and back in to allow your user to be added to the docker group. This just makes it so you don't have to type "sudo" before every docker command.
Install Ciao
Now we can get down to business, and install Ciao. We'll be setting it up with our install command to be able to send emails when a status changes for a site we are monitoring, so we need to include a few special environment varaibles.
The command looks like this:
docker run --name ciao -p 8090:3000 -e SECRET_KEY_BASE="sensitive_secret_key_base" -e SMTP_ADDRESS=smtp.yourhost.com -e SMTP_EMAIL_FROM="ciao@yourhost.com" -e SMTP_EMAIL_TO="you@yourhost.com" -e SMTP_PORT=587 -e SMTP_DOMAIN=smtp.yourhost.com -e SMTP_AUTHENTICATION=plain -e SMTP_ENABLE_STARTTLS_AUTO=true -e SMTP_USERNAME=ciao -e SMTP_PASSWORD="sensitive_password" -v /opt/ciao/data:/app/db/sqlite brotandgames/ciao
While the above is easier to edit in the terminal, it's easier to look at like this:
docker run -d --name ciao \
-p 8090:3000 \ -
-e SECRET_KEY_BASE="sensitive_secret_key_base" \
-e SMTP_ADDRESS=smtp.yourhost.com \
-e SMTP_EMAIL_FROM="ciao@yourhost.com" \
-e SMTP_EMAIL_TO="you@yourhost.com" \
-e SMTP_PORT=587 \
-e SMTP_DOMAIN=smtp.yourhost.com \
-e SMTP_AUTHENTICATION=plain \
-e SMTP_ENABLE_STARTTLS_AUTO=true \
-e SMTP_USERNAME=ciao \
-e SMTP_PASSWORD="sensitive_password" \
-v /opt/ciao/data:/app/db/sqlite \
brotandgames/ciao
So let's break down this massive command.
docker run -d --name ciao
Gives the command to create a container called "ciao" and run it in the background so we can close the terminal without killing the app.
-p 8090:3000
says mapr my host machine port 8090 to the container port 3000. You can change the host machine port to any port you have free, just don't change the container port.
-e SECRET_KEY_BASE="sensitive_secret_key_base"
generates a secret key for your data...but if you omit this whole piece, then Ciao will autogenerate a key for you. it's nothing you need to know for any reason.
Next we have multiple lines that deal with our email.
-e SMTP_ADDRESS=smtp.yourhost.com \
-e SMTP_EMAIL_FROM="ciao@yourhost.com" \
-e SMTP_EMAIL_TO="you@yourhost.com" \
-e SMTP_PORT=587 \
-e SMTP_DOMAIN=smtp.yourhost.com \
-e SMTP_AUTHENTICATION=plain \
-e SMTP_ENABLE_STARTTLS_AUTO=true \
-e SMTP_USERNAME=ciao \
-e SMTP_PASSWORD="sensitive_password" \
Everything above requires that you know the SMTP information for the email service you intend to use.
WARNING: I highly discourage the use of GMail for SMTP purposes. It is painful to setup and get working.
SMTP_ADDRESS => The server name for your smtp email server.
SMTP_EMAIL_FROM => the user the email should be from when you get an notification.
SMTP_EMAIL_TO => The email the notification should go to. (this can be the same as the SMTP_EMAIL_FROM).
SMTP_PORT => Ports are normally, 25 (no encryption), 465 (SSL), 587 (TLS).
SMTP_DOMAIN => This will likely be the same as the SMTP_ADDRESS.
SMTP_AUTHENTICATION => Authentication method that should be used.
SMTP_ENABLE_STARTTLS_AUTO => this needs to be true if your email provide indicates you use StartTLS.
SMTP_USERNAME = the username for the account that will be sending the email...sometimes a username alone, sometimes the full email address.
SMTP_PASSWORD = the password for the account that will be sending the email.
Finally, we have the last 2 lines:
-v /opt/ciao/data:/app/db/sqlite
is the mapping of the host folder /var/ciao/data to /app/db/sqlite. I recommend creating this folder specifically.
cd /var
sudo mkdir -p ciao/data
And finally, brotandgames/ciao
tells docker which image to pull down and use.
Before you run.
Make sure to replace all of the environment variable placeholders with the proper information for your SMTP server and user. If you don't want email notifications, then remove all of those lines with SMTP in it.
Also, create the /var/ciao/data folder structure before you run it.
Run the command
Now, we run the command. It will pull down the latest version of ciao, and setup our email as it starts the container application.
Open your favorite web browser (Firefox, Chromium, Chrome, Edge, etc), and go to the IP of your server on port 8090 (unless you changed the port in the command, and in that case, use that port).
For me it is http://192.168.7.125:8090
You should be presented with the Ciao interface, and you can start adding sites to monitor.
If you want to test the email funcationality, you should use a site you can control, and bring up and down.
To set the scheduled timing of the checks you need to use CRON syntax, but I just used their default example of * /15 * * * *
for every 15 minutes. You can change this to something smaller to test the system, then set it back to something like every 15 or 30 minutes when you're done.
You can try * /2 * * * *
, then set it back to 15 once you know email is working.
Troubleshooting
If you hit issues, the best place to look is the docker log for your container. The command to use is
docker logs <container name>
so in this case we would use
docker logs ciao
Look for any errors or warnings that may deal with email, smtp, message, etc.
Once you're all up and running, you can setup as many sites as you want on different schedules.