Install Uptime Kuma for Website Monitoring

Install Uptime Kuma untuk Monitoring Website

  • Install Node.JS v.18
# Untuk Debian/Ubuntu base
curl -sL https://deb.nodesource.com/setup_18.x | sudo bash -
apt install nodejs -y

# Untuk RedHat/CentOS base
curl -sL https://rpm.nodesource.com/setup_18.x | sudo bash -
yum install nodejs -y
  • Install Uptime Kuma
git clone https://github.com/louislam/uptime-kuma.git && cd uptime-kuma
npm run setup
  • Jalankan Uptime Kuma dengan PM2
npm install pm2@latest -g
  • Jalankan PM2 sebagai background proses dengan port 3001
pm2 start npm --name uptime-kuma -- run start-server -- --port=3001 --hostname=127.0.0.1

<output>
                Start and Daemonize any application:
                $ pm2 start app.js

                Load Balance 4 instances of api.js:
                $ pm2 start api.js -i 4

                Monitor in production:
                $ pm2 monitor

                Make pm2 auto-boot at server restart:
                $ pm2 startup

                To go further checkout:
                http://pm2.io/
                        -------------
[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2] PM2 Successfully daemonized
[PM2] Starting /usr/bin/npm in fork_mode (1 instance)
[PM2] Done.
┌─────┬────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name           │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0   │ uptime-kuma    │ default     │ N/A     │ fork    │ 2192     │ 0s     │ 0    │ online    │ 0%       │ 27.4mb   │ root     │ disabled │
└─────┴────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
  • Enable aplikasi Node.JS auto start saat boot
pm2 startup
pm2 save
  • Setting Apache Reverse
# Untuk Debian/Ubuntu base
apt install apache2 -y 

# Untuk RedHat/CentOS base
yum install httpd -y
  • Aktifkan module apache yang diperlukan untuk monitoring
a2enmod ssl proxy proxy_ajp proxy_wstunnel proxy_http rewrite deflate headers proxy_balancer proxy_connect proxy_html
  • Buat virtual host untuk Uptime Kuma
# Untuk Debian/Ubuntu base
nano /etc/apache2/sites-available/uptime-kuma.conf  

# Untuk RedHat/CentOS base
nano /etc/httpd/conf.d/uptime-kuma.conf 
  • Ganti ServerName dengan nama domain anda
<VirtualHost *:80>
  ServerName kuma.sys-ops.id

  ProxyPass / http://localhost:3001/
  RewriteEngine on
  RewriteCond %{HTTP:Upgrade} websocket [NC]
  RewriteCond %{HTTP:Connection} upgrade [NC]
  RewriteRule ^/?(.*) "ws://localhost:3001/$1" [P,L]
</VirtualHost>
  • Aktifkan virtual host uptime-kuma
a2ensite uptime-kuma
  • Restart service apache
# Untuk Debian/Ubuntu base
systemctl restart apache2

# Untuk RedHat/CentOS base
systemctl restart httpd
  • Akses Uptime Kuma dengan nama domain anda (kuma.sys-ops.id)
  • Buat user untuk mengakses Uptime Kuma
  • Add New Monitor untuk menambahkan website yang akan di monitoring
  • Monitor Type: HTTP(s) > URL: https://nama_domain_anda > Heartbeat Interval: 30 > Retries: 5 > Method: Get > Save
  • Tampilan Dashboard Uptime Kuma

herdiana3389

A system administrator with skills in system administration, virtualization, linux, windows, networking, cloud computing, container, etc.