A Fancy Self-Hosted Monitoring Tool

Installation

Install dependencies: sudo, git, MariaDB, Node.JS Clone the repository:

# cd /home
# git clone https://github.com/louislam/uptime-kuma.git
# cd uptime-kuma/

Run the setup:

# npm run setup

Install pm2 and systemd unit:

# npm install pm2 -g
# pm2 install pm2-logrotate
# pm2 startup

Start Uptime Kuma:

# pm2 start /home/uptime-kuma/ecosystem.config.js --name uptime-kuma

Start Uptime Kuma on reboot:

# pm2 save

self-signed certificate in certificate chain

If you have a custom CA certificate, include it in the system CA certificates file and tell Uptime Kuma to use it.

Edit ecosystem.config.js and add env_production section:

module.exports = {
    apps: [
        {
            name: "uptime-kuma",
            script: "./server/server.js",
            env_production: {
                NODE_ENV: "production",
                NODE_EXTRA_CA_CERTS: "/etc/ssl/certs/ca-certificates.crt"
            }
        },
    ],
};

/etc/ssl/certs/ca-certificates.crt is valid for Debian systems

Next, we have to stop the existing PM2 service, remove it and add it back:

# pm2 stop uptime-kuma
[PM2] Applying action stopProcessId on app [uptime-kuma](ids: [ 2 ])
[PM2] [uptime-kuma](2) ✓
┌────┬──────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name             │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├────┼──────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 2  │ uptime-kuma      │ default     │ 2.5.4   │ fork    │ 0        │ 0      │ 0    │ stopped   │ 0%       │ 0b       │ root     │ disabled │
└────┴──────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
Module
┌────┬──────────────────────────────┬───────────────┬──────────┬──────────┬──────┬──────────┬──────────┬──────────┐
│ id │ module                       │ version       │ pid      │ status   │ ↺    │ cpu      │ mem      │ user     │
├────┼──────────────────────────────┼───────────────┼──────────┼──────────┼──────┼──────────┼──────────┼──────────┤
│ 0  │ pm2-logrotate                │ 3.0.0         │ 330      │ online   │ 0    │ 0%       │ 43.8mb   │ root     │
└────┴──────────────────────────────┴───────────────┴──────────┴──────────┴──────┴──────────┴──────────┴──────────┘

# pm2 delete uptime-kuma
[PM2] Applying action deleteProcessId on app [uptime-kuma](ids: [ 2 ])
[PM2] [uptime-kuma](2) ✓
┌────┬──────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name             │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
└────┴──────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
Module
┌────┬──────────────────────────────┬───────────────┬──────────┬──────────┬──────┬──────────┬──────────┬──────────┐
│ id │ module                       │ version       │ pid      │ status   │ ↺    │ cpu      │ mem      │ user     │
├────┼──────────────────────────────┼───────────────┼──────────┼──────────┼──────┼──────────┼──────────┼──────────┤
│ 0  │ pm2-logrotate                │ 3.0.0         │ 330      │ online   │ 0    │ 0%       │ 43.8mb   │ root     │
└────┴──────────────────────────────┴───────────────┴──────────┴──────────┴──────┴──────────┴──────────┴──────────┘

# pm2 start /home/uptime-kuma/ecosystem.config.js --name uptime-kuma --env production
[PM2][WARN] Applications uptime-kuma not running, starting...
[PM2] App [uptime-kuma] launched (1 instances)
┌────┬──────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name             │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├────┼──────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 3  │ uptime-kuma      │ default     │ 2.5.4   │ fork    │ 301093   │ 0s     │ 0    │ online    │ 0%       │ 17.1mb   │ root     │ disabled │
└────┴──────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
Module
┌────┬──────────────────────────────┬───────────────┬──────────┬──────────┬──────┬──────────┬──────────┬──────────┐
│ id │ module                       │ version       │ pid      │ status   │ ↺    │ cpu      │ mem      │ user     │
├────┼──────────────────────────────┼───────────────┼──────────┼──────────┼──────┼──────────┼──────────┼──────────┤
│ 0  │ pm2-logrotate                │ 3.0.0         │ 330      │ online   │ 0    │ 0%       │ 43.8mb   │ root     │
└────┴──────────────────────────────┴───────────────┴──────────┴──────────┴──────┴──────────┴──────────┴──────────┘

# pm2 save
[PM2] Saving current process list...
[PM2] Successfully saved