Uptime Kuma on Amazon EC2 — An Open-source Monitoring Tool

In this article we will look how we can install and configure Uptime Kuma an open-source monitoring tool on Amazon EC2

Unni P
4 min readApr 30, 2023

Introduction

  • An open-source self-hosted monitoring tool
  • Monitor uptime for HTTP, HTTPS, DNS etc
  • SSL certificate information
  • Notifications via Email, Slack, Discord etc
  • 20 seconds interval
  • Support for proxy and multi factor authentication

Prerequisites

  • Setup an EC2 instance of type t2.micro
  • Ubuntu 22.04 LTS as AMI
  • 10 GB of hard disk space
  • Open port 22 for SSH and 3001 for Uptime Kuma
  • Install and configure Docker
  • Need a temporary webpage with SSL enabled

Installation

Login to your EC2 instance

$ ssh -i uptime-kuma.pem ubuntu@54.234.8.87

Create a Docker volume for Uptime Kuma

$ docker volume create uptime-kuma

$ docker volume ls
DRIVER VOLUME NAME
local uptime-kuma

Start the container and verify the status

$ docker container run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1
Unable to find image 'louislam/uptime-kuma:1' locally
1: Pulling from louislam/uptime-kuma
3689b8de819b: Pull complete
4178a276654a: Pull complete
b46162c13de5: Pull complete
4d3ac03f17d8: Pull complete
b935255dae7e: Pull complete
792f129a81f3: Pull complete
4110002867ba: Pull complete
390f8662c74f: Pull complete
9dd174cf6e30: Pull complete
4f4fb700ef54: Pull complete
703bad70ccf2: Pull complete
Digest: sha256:cf61d3262b29e1c48cc2ac284c9264227bbc46168f408e5f4c4d6301f0629e41
Status: Downloaded newer image for louislam/uptime-kuma:1
fcdfcc5a5d1470ca3b1dd1e23d29a4975d909e2a5ab2f53e1e2bef0fa4a58665
$ docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fcdfcc5a5d14 louislam/uptime-kuma:1 "/usr/bin/dumb-init …" About a minute ago Up About a minute (healthy) 0.0.0.0:3001->3001/tcp, :::3001->3001/tcp uptime-kuma

Open http://54.234.8.87:3001 in your browser
Initially we need to setup username and password for accessing the dashboard

Once done, we will redirect to the dashboard

Configuration

I have already configured a Nginx website and enabled SSL using Let’s Encrypt

We need to setup Notifications in order to get notified whenever a host is down or a certificate is going to expire

If we are using Email (SMTP) as notification type then we need to do configuration in our Gmail account

  • Enable multi factor authentication
  • Create app password

From the dashboard, navigate to SettingsNotificationsSetup Notification and configure as below in order to receive email notifications

  • Notification Type: Email (SMTP)
    Friendly Name: Alerts
    Hostname: smtp.gmail.com
    Port: 587
    Security: None/STARTTLS (25, 587)
  • Username: <your-email-id>
    Password: <app-password>
    From Email: <your-email-id>
    To Email: <your-email-id>
  • Custom Subject: {{NAME}} {{STATUS}}
    Default enabled: Enable

Once the required information is entered click Test and Save button and you will receive a test mail in your inbox

Lets add our URL to monitor by clicking the Add New Monitor button and fill the details and click Save button

From the dashboard we can see the uptime, response time of our URL and certificate expiry date

Now make a downtime by stopping the Nginx service and we can see our URL is showing status as DOWN and will receive an email in your inbox

Lets start the Nginx service and now our URL status is showing as UP and will receive an email in your inbox

As you see from the above status, Let’s Encrypt certificate is going to expire in 89 days.
Lets configure Uptime Kuma to receive an alert for certificate expiry

Navigate to SettingsNotificationsTLS Certificate Expiry
By default we will get certificate expiry notifications in 7, 14 and 21 days but we are going configure it as 89 days because my certificate will expire in 89 days and click Save button and wait for to receive an email in your inbox

Special Thanks

A Cloud Guru Cloud Sandbox (AWS) and Cloud Servers

--

--

Unni P
Unni P

Written by Unni P

SysAdmin turned into DevOps Engineer | Collaboration and Shared Responsibility