Magazine

How to Control Website and App with Uptime Kuma

Posted on the 19 September 2022 by Top10

Uptime Kuma is a trendy monitoring tool that you can use to monitor websites and applications in real time.

Features Uptime Kuma

  • Monitors the uptime of HTTP websites, TCP ports, and Docker containers and extracts information such as DNS records.
  • Sends notifications via email (SMTP), Telegram, Discord, Microsoft Teams, Slack, Promo SMS, Gotify and over 90 notification services.
  • Supports multiple languages.
  • Provides multiple status pages.
  • Provides proxy support.
  • Displays information about the SSL certificate.
  • Maps a status page to a domain.

In this guide, you will learn how to install Uptime Kuma standalone monitoring tool and how you can monitor websites with this tool.

To demonstrate, we will install the Uptime Kuma Monitoring tool on Ubuntu 20.04. The same instructions also work with RHEL based distributions and Debian derivatives.

Step 1: Installing Node.JS on Linux

To get started, log into your server and update your local package index.

$ sudo apt update
$ sudo dnf update

Since Uptime Kuma is written in Node.JS, you need to install Node.JS before proceeding. We will install the latest LTS version, which at the time of writing this guide is Node.JS 16.x.

First, add the Nodesource repository to your system. To do this, switch to the root user.

$ sudo su

Then add the Nodesource 16.x repository to your system using the following curl command as shown below.

$ curl -sL  | sudo bash -   [OnDebian systems] $ curl -sL | sudo bash -   [OnRHEL systems]

The command downloads an installation script that updates the package lists, adds the Nodesource signing key, and creates an apt and dnf list file for the Nodesource 16.x repository.

After adding the Nodesource repository, install Node.JS using the package manager as shown below.

$ sudo apt install nodejs -y   [OnDebian systems] $ sudo dnf install nodejs -y   [OnRHEL systems]

Once installed, confirm the installed version of NodeJS as shown.

$ node --version 

V16.17.0

Step 2Installing Uptime Kuma on Linux

Once Node.JS is installed, you can proceed to install the Uptime Kuma monitoring tool. First, clone the Uptime Kuma repository from GitHub.

# git clone

Then go to the Uptime Kuma directory.

# cd uptime-kuma/

Then configure the monitoring tool with the following command:

# npm run setup
How to control website and app with Uptime Kuma
How to control website and app with Uptime Kuma

Step 3: Run Uptime Kuma with pm2

PM2 is a production process manager for NodeJS applications that provides load balancing and helps keep applications running indefinitely and restart them without any service interruption or downtime.

To install the PM2 daemon, run the following command while still in the uptime-kuma directory.

# npm install [email protected] -g
How to control website and app with Uptime Kuma
How to control website and app with Uptime Kuma

Then start the pm2 daemon as shown below.

# pm2 start npm --name uptime-kuma -- run start-server -- --port=3001 --hostname=127.0.0.1

The command generates the following output.

How to control website and app with Uptime Kuma
How to control website and app with Uptime Kuma

You can view PM2 logs as shown.

# pm2 logs
How to control website and app with Uptime Kuma
How to control website and app with Uptime Kuma

Then enable the Node.js app to run after a reboot.

# pm2 startup
How to control website and app with Uptime Kuma
How to control website and app with Uptime Kuma

Then save the application state as shown.

# pm2 save
How to control website and app with Uptime Kuma
How to control website and app with Uptime Kuma

Step 4: Set up Apache as a reverse proxy for Uptime-Kuma.

You then need to install the Apache website and then configure it to be used as a reverse proxy for Uptime Kuma.

$ sudo apt install apache2 -y   [OnDebian systems] $ sudo dnf install httpd -y     [OnRHEL systems]

Once installed, enable the following modules that the monitoring tool will require on Debian based systems.

# a2enmod ssl proxy proxy_ajp proxy_wstunnel proxy_http rewrite deflate headers proxy_balancer proxy_connect proxy_html

Then create a virtual host file for Uptime Kuma.

$ sudo nano /etc/apache2/sites-available/uptime-kuma.conf   [OnDebian systems] $ sudo vi /etc/httpd/conf.d/uptime-kuma.conf                [OnRHEL systems]

Paste the following lines of code. For the ServerName directive, specify your server's FQDN or public IP address.

<VirtualHost *:80>
  ServerName kuma.example.com
  ProxyPass / 
  RewriteEngine on
  RewriteCond %{HTTP:Upgrade} websocket [NC]
  RewriteCond %{HTTP:Connection} upgrade [NC]
  RewriteRule ^/?(.*) "ws://localhost:3001/$1" [P,L]
</VirtualHost>

Save the file and exit.

Then enable the Apache virtual host for Uptime Kuma as shown on Debian based systems.

$ sudo a2ensite uptime-kuma

Then restart the Apache web service for the changes to take effect.

$ sudo systemctl restart apache2   [OnDebian systems] $ sudo systemctl restart httpd     [OnRHEL systems]

Step 5Access Uptime Kuma from the web interface

After installing and fully configuring Uptime Kuma, launch your browser and navigate to your server's domain name or public IP address.

OR

The web interface will look like shown and you will need to create an administrator account. Therefore, provide a username and password and click "Create" to create an administrator account.

How to control website and app with Uptime Kuma
How to control website and app with Uptime Kuma

This will allow you to log into the Uptime Kuma control panel. To start monitoring a website, click the Add New Monitor button. Fill in the information about the site you want to track.

How to control website and app with Uptime Kuma
How to control website and app with Uptime Kuma

Shortly thereafter, Uptime Kuma will start tracking your site and provide various uptime metrics, as shown in the picture.

How to control website and app with Uptime Kuma
How to control website and app with Uptime Kuma

That's all! We successfully installed and configured Uptime Kuma and were able to monitor the website.

Publication author


Back to Featured Articles on Logo Paperblog