Setting up Uptime Kuma on the Raspberry Pi?

Uptime Kuma is an open-source, self-hosted monitoring tool that allows you to monitor your websites and applications from your own server. It provides useful uptime statistics, alerts, and status pages to help keep your services running smoothly. In this comprehensive guide, we’ll cover how to install and configure Uptime Kuma on a Raspberry Pi to monitor your services.

Setting up Uptime Kuma on the Raspberry Pi?

Requirements and Installation

To set up Uptime Kuma on a Raspberry Pi, you’ll need:

  • A Raspberry Pi (any model should work)
  • Raspberry Pi OS installed
  • Static IP address assigned to the Pi
  • Port 80 and 443 open on router

Installing Uptime Kuma

Log into your Raspberry Pi and update the package manager:

sudo apt update

sudo apt upgrade

Install the prerequisites for Nginx and MySQL:

sudo apt install curl gnupg2 ca-certificates lsb-release debian-archive-keyring

Add the Uptime Kuma repository:

curl -fsSL https://repos.uptimekuma.com/uptimekuma.key | sudo gpg –dearmor -o /usr/share/keyrings/uptimekuma-archive-keyring.gpg

echo “deb [signed-by=/usr/share/keyrings/uptimekuma-archive-keyring.gpg] https://repos.uptimekuma.com stable main” | sudo tee /etc/apt/sources.list.d/uptimekuma.list

sudo apt update

Install Uptime Kuma:

sudo apt install uptime-kuma

Once installed, Uptime Kuma will run automatically. You can access the web UI at http://your_pi_ip:3001. The default login credentials are:

  • Username: admin
  • Password: admin

Be sure to change this password immediately after logging in!

Securing Uptime Kuma

To prevent unauthorized access, it’s highly recommended to secure access to the Uptime Kuma dashboard.

Using SSL/TLS

Install Certbot and generate SSL certificates:

sudo snap install core; sudo snap refresh core

sudo snap install –classic certbot

sudo ln -s /snap/bin/certbot /usr/bin/certbot

sudo certbot certainly –standalone

Enabling Authentication

In the Uptime Kuma dashboard, go to the Settings page and check the box for “Enable authentication to access the dashboard” to restrict access to logged in users only.

Using a Reverse Proxy

Setting up a reverse proxy server with Nginx or Apache provides protection by obscuring the existence of the dashboard and providing another layer of authentication.

Below is a sample Nginx configuration:

server 

        listen 80;

        listen [::]:80;

        server_name example.com;

        location 

        proxy_pass http://127.0.0.1:3001;

This proxies all requests to Uptime Kuma running on port 3001 while making services externally accessible on port 80 instead.

Managing Monitors

Adding monitors is simple within the Uptime Kuma dashboard. You can monitor the following:

  • HTTP(s) URLs
  • DNS servers
  • TCP ports
  • ICMP/Ping
  • Keyword (checks if a keyword exists on a webpage)

To add, click “+ Add Monitor” and fill in the details:

  • Friendly Name: A display name to easily identify the monitor
  • URL/IP Address: The website/server to monitor
  • Monitoring Type: HTTP(s), Ping, Port, DNS, or Keyword
  • Configure additional settings like monitoring interval, alerts, and response time thresholds per service.

You can group related monitors into Status Pages to display their overall uptime stats.

Configuring Notifications

Uptime Kuma supports alerts through multiple channels like Email, Slack, Discord, Telegram bots and more.

To set up notifications:

  1. In the Uptime Kuma dashboard, click on “Alert Media” in the left sidebar
  2. Click “+ New Alert Media”
  3. Select alert channel
  4. Fill in required credentials and connection details
  5. Click “Test” to verify the integration
  6. Go to “Settings” and select channels to receive uptime notifications

You can configure alerts based on:

  • URL down
  • Slow responsetimes
  • SSH connection failures
  • High ping, latency, packet loss
  • HTTP errors
  • Missing text content

Customize notifications to track metrics that are critical for your services.

Creating Status Pages

Status Pages provide a public view of your application’s uptime data.

To set one up:

  1. Go to “Status Pages” and click “+ Add New Page”
  2. Enter page name and icon
  3. Select monitors to display stats for
  4. Customize the page with brand colors, messages, content and social accounts
  5. Publish the status page

Status Pages are hosted on your server via a custom subdomain. You can embed these easily on your website and provide stakeholders with uptime transparency.

Optimizing for Raspberry Pi Hardware

To manage performance overhead on the limited Raspberry Pi hardware, here are some optimization tips:

Reduce Monitoring Frequency

Check non-critical services every 5 minutes instead of 1 minute intervals.

Monitor From a Remote Server

Set up Uptime Kuma on a separate Linux server to offload monitoring tasks. This avoids resource contention on the Pi.

Allocate More RAM to MySQL

By default MySQL uses about 20% of available RAM. For heavier workloads, allocate up to 50% RAM in /etc/mysql/my.cnf:

max_allowed_packet=8M

innodb_buffer_pool_size=128M

Use an External/Network Drive for Storage

Use an attached USB drive or mount a network drive via CIFS/NFS instead of the SD card for storing status pages media and backups.

Backing up Data

Since all monitor data is stored in the MySQL database, it is vital to schedule regular backups.

You can backup data manually from the dashboard or automatically to cloud storage using cron jobs. Avoid storing backups on the SD card which is prone to corruption. Consider setting up remote replication to another MySQL server for redundancy.

Test restores on a staging instance periodically to ensure your backup process is solid.

Conclusion

Uptime Kuma provides an extremely useful on-prem monitoring solution for Raspberry Pi users and self-hosted environments. With its automatic service checks, abundant notification channels and status pages, you can effectively track your website and application uptime.

Optimizing performance based on the limited Raspberry Pi resources will allow you to reliably run Uptime Kuma in the long-term. Regular backups are crucial for avoiding catastrophic data loss scenarios.

Overall, Uptime Kuma on the Pi delivers tremendous value for personal use and business-critical uptime monitoring needs alike. The ability to host it yourself using open-source software keeps costs low while providing flexibility to customize as required.

Key Takeaways

  • Uptime Kuma provides free and self-hosted uptime monitoring
  • Easy to install on Raspberry Pi using apt
  • Supports monitoring HTTP sites, DNS, TCP ports and more
  • Alerts available via Email, Slack, Telegram etc.
  • Create public Status Pages for uptime transparency
  • Optimize MySQL and storage for best performance
  • Enable security measures like SSL and authentication
  • Backup data regularly to cloud storage

Frequently Asked Questions

  1. What are the hardware requirements to run Uptime Kuma?
    Uptime Kuma has modest hardware requirements and can run on a single-board computer like the Raspberry Pi or a small Linux VPS with just 1GB RAM and 1 vCPU. Storage needs depend on the amount of monitors and data retention policies.

  2. Does Uptime Kuma have mobile apps?
    Yes, Uptime Kuma provides both Android and iOS mobile apps to view your dashboard, monitors and fire alerts from anywhere.

  3. Can I monitor endpoints behind a firewall or VPN?
    Yes, Uptime Kuma can monitor any private IP, host and port by installing the agent software on a server on the target network. This allows probing endpoints behind firewalls securely.

  4. How many monitors can be added in the free plan?
    Uptime Kuma doesn’t enforce hard limits on the open-source software. You are limited only by your server resources. The hosted Basic plan allows up to 25 monitors while higher tiers have 1000+ monitors capability.

  5. Can I set up SMS alerts for downtime?
    Yes, Uptime Kuma supports SMS notifications via gateways from major providers like Twilio, Clickatell and MessageBird. You need to sign up for an account with them and integrate it.

  6. What type of monitors can I set up?
    Uptime Kuma supports HTTP, HTTPS, ping, port, DNS, and keyword monitoring types. This allows you to monitor websites, servers, APIs, databases and more from a single dashboard.

  7. Can I monitor the Raspberry Pi itself?
    Yes, you can set up a PING monitor to track Raspberry Pi availability and latency. This allows detecting SD card failures and network issues promptly.

  8. Does Uptime Kuma support monitoring behind CDNs?
    Yes, Uptime Kuma can effectively monitor origin servers behind content delivery networks by using the CDN’s origin IP instead of the domain name in monitors. This tracks true server uptime ignoring CDN caching.

  9. Can I monitor the local network and devices?
    Absolutely, just add monitors using the local IP addresses and hostnames of devices like NAS boxes, smart home hubs, WiFi routers etc. This gives visibility into home network availability.

  10. How do I migrate Uptime Kuma to another Pi?
    Migration can be done by backing up MySQL data and restoring it on a fresh Uptime Kuma instance on another Raspberry Pi. You’ll need to recreate monitors and alert media channels after migrating.

  11. Can I run Uptime Kuma safely on my Kubernetes cluster?
    Yes, there is an official Uptime Kuma Helm chart that allows easily deploying it to your Kubernetes infrastructure for scalable and resilient monitoring.

  12. How many websites can I monitor on the Raspberry Pi 4?
    You can effectively monitor 50-100 external endpoints on an RPi 4 with 4GB RAM without running into performance problems depending on monitoring frequency. For larger needs, a dedicated server works better.

Leave a Comment