Quickly Set Up TCP/HTTP Monitoring with Docker: uptime-kuma

Publish: 2021-09-27 | Modify: 2021-09-27

There are many monitoring tools available on the market, such as UptimeRobot, Monitor Bao, and Alibaba Cloud Monitor, but the free versions have limitations on the number of monitors and request frequency. Once you exceed a certain limit, you must purchase the commercial version, which is not cheap. For individual users, we can actually use idle VPS to build our own monitoring system. Today, let me introduce uptime-kuma.

uptime-kuma

What is uptime-kuma?

uptime-kuma is an open-source monitoring tool similar to "Uptime Robot". It has a simple interface and supports TCP/PING/HTTP monitoring. It also supports multiple languages, including Chinese.

Deploying uptime-kuma with Docker

The author provides a Docker installation method, and this article will also use the Docker method. Just execute the following commands:

# Create a storage volume
docker volume create uptime-kuma
# Pull and run uptime-kuma
docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1

Using uptime-kuma

After deployment, we can access uptime-kuma through http://ip:3001 (remember to open port 3001 in the security group). The first time you access it, you need to set up an admin account and password according to the prompts.

uptime-kuma-login

After entering the backend, you can add monitors of the corresponding types as needed. It supports TCP/PING/HTTP, etc.

uptime-kuma-monitor

uptime-kuma also supports various alert methods. You can set them according to your needs.

uptime-kuma-alert

It also supports a status page similar to "Uptime Robot". You need to add it to the "status-page" section, so that visitors can view the monitoring status through the "status-page".

uptime-kuma-status-page

Nginx Reverse Proxy

If you don't want to access it through IP + port, you can also configure Nginx reverse proxy to use a domain name for access. Here is an example of the configuration used by Xiaoz, for reference only:

server {
  listen 443 ssl http2;
  server_name sub.domain.com;
  ssl_certificate     /path/to/ssl/cert/crt;
  ssl_certificate_key /path/to/ssl/key/key;

  ssl_session_timeout 1d;
    ssl_session_cache shared:MozSSL:10m;  # about 40000 sessions
    ssl_session_tickets off;

    # modern configuration
    ssl_protocols TLSv1.3;
    ssl_prefer_server_ciphers off;

    # OCSP stapling
    ssl_stapling on;
    ssl_stapling_verify on;

  location / {
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass         http://localhost:3001/;
    proxy_http_version 1.1;
    proxy_set_header   Upgrade $http_upgrade;
    proxy_set_header   Connection "upgrade";
  }
}

For other web servers, please refer to the official documentation: https://github.com/louislam/uptime-kuma/wiki/Reverse-Proxy

Conclusion

Although uptime-kuma may not be as powerful as commercial software, it is simple and easy to use. It fully meets regular monitoring needs and is suitable for self-built TCP/HTTP monitoring. If you are interested, you can give it a try.

uptime-kuma project repository: https://github.com/louislam/uptime-kuma


Comments