云原生之使用docker部署uptime-kuma服务器监控面板

时间:2023-02-10 15:26:24

(云原生之使用docker部署uptime-kuma服务器监控面板)

一、uptime-kuma介绍

uptime-kuma是一款开源的、多功能的服务器监控面板 。

二、检查docker环境

1.检查docker状态

[root@jeven ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2022-12-02 04:34:05 CST; 5 days ago
     Docs: https://docs.docker.com
 Main PID: 10004 (dockerd)
    Tasks: 136
   Memory: 3.1G
   CGroup: /system.slice/docker.service
           ├─  8186 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8987 -container-ip 172.17.0.3 -container-port 3001
           ├─  8192 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8987 -container-ip 172.17.0.3 -container-port 3001
           ├─ 10004 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
           ├─ 65292 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8777 -container-ip 172.17.0.4 -container-port 80
           ├─ 65298 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8777 -container-ip 172.17.0.4 -container-port 80
           ├─117192 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 453 -container-ip 192.168.240.2 -container-port 443
           ├─117198 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 453 -container-ip 192.168.240.2 -container-port 443
           ├─117211 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8161 -container-ip 192.168.240.2 -container-port 81
           ├─117217 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8161 -container-ip 192.168.240.2 -container-port 81
           ├─117229 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8061 -container-ip 192.168.240.2 -container-port 80
           ├─117235 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8061 -container-ip 192.168.240.2 -container-port 80
           ├─122772 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 443 -container-ip 172.24.0.2 -container-port 443
           ├─122778 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 443 -container-ip 172.24.0.2 -container-port 443
           ├─122792 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8023 -container-ip 172.24.0.2 -container-port 80
           ├─122797 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8023 -container-ip 172.24.0.2 -container-port 80
           ├─125465 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8133 -container-ip 192.168.16.2 -container-port 80
           ├─125470 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8133 -container-ip 192.168.16.2 -container-port 80
           ├─126264 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8276 -container-ip 172.17.0.2 -container-port 80
           └─126270 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8276 -container-ip 172.17.0.2 -container-port 80

Dec 07 16:07:08 jeven dockerd[10004]: time="2022-12-07T16:07:08.423088936+08:00" level=info msg="Layer sha256:64d536caa03db14629265c6a5553...eaned up"
Dec 07 16:07:08 jeven dockerd[10004]: time="2022-12-07T16:07:08.504084245+08:00" level=info msg="Layer sha256:64d536caa03db14629265c6a5553...eaned up"
Dec 07 16:15:28 jeven dockerd[10004]: time="2022-12-07T16:15:28.183055538+08:00" level=info msg="Container failed to exit within 10s of si...124cf8fc2
Dec 07 16:15:28 jeven dockerd[10004]: time="2022-12-07T16:15:28.230585659+08:00" level=info msg="ignoring event" container=d0fd0c5a50e921c...skDelete"
Dec 07 16:21:23 jeven dockerd[10004]: time="2022-12-07T16:21:23.742077933+08:00" level=info msg="Container failed to exit within 10s of si...dab894fb5
Dec 07 16:21:23 jeven dockerd[10004]: time="2022-12-07T16:21:23.797450110+08:00" level=info msg="ignoring event" container=13b4daa70e01805...skDelete"
Dec 07 22:27:25 jeven dockerd[10004]: time="2022-12-07T22:27:25.797566666+08:00" level=info msg="Pull session cancelled"
Dec 07 22:27:26 jeven dockerd[10004]: time="2022-12-07T22:27:26.872707017+08:00" level=error msg="Not continuing with pull after error: co...canceled"
Dec 07 22:30:25 jeven dockerd[10004]: time="2022-12-07T22:30:25.868361013+08:00" level=info msg="ignoring event" container=64f382767f860bd...skDelete"
Dec 07 22:38:51 jeven dockerd[10004]: time="2022-12-07T22:38:51.981442249+08:00" level=info msg="ignoring event" container=544a3ed21fddcd3...skDelete"
Hint: Some lines were ellipsized, use -l to show in full.
[root@jeven ~]# 

2.检查docker版本

[root@jeven kuma]# docker version
Client: Docker Engine - Community
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.17.11
 Git commit:        100c701
 Built:             Mon Jun  6 23:05:12 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Jun  6 23:03:33 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.6
  GitCommit:        10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc:
  Version:          1.1.2
  GitCommit:        v1.1.2-0-ga916309
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

三、下载uptime-kuma镜像

[root@jeven kuma]# docker pull louislam/uptime-kuma:1
1: Pulling from louislam/uptime-kuma
1: Pulling from louislam/uptime-kuma
4b7b4a8876e2: Pull complete 
e05e9bb59438: Pull complete 
911c1003bc81: Pull complete 
00d25b468f79: Pull complete 
acbb79e9e26e: Pull complete 
846ef4780c5d: Pull complete 
d4ca0209da08: Pull complete 
a1370fa12225: Pull complete 
5c67314e6b08: Pull complete 
fcd07c4be961: Pull complete 
Digest: sha256:a84767d7934f833010b886f3dfc57b9d23ca69e85e48f378b28b5c25c5043e1d
Status: Downloaded newer image for louislam/uptime-kuma:1
docker.io/louislam/uptime-kuma:1




四、部署uptime-kuma

1.创建数据目录

[root@jeven ~]# mkdir -p /data/kuma/data
[root@jeven ~]# cd /data/kuma/
[root@jeven kuma]# 

2.创建uptime-kuma容器

[root@jeven kuma]# docker run -d --name kuma --restart=always -p 3001:3001 -v /data/kuma/data:/app/data -v /var/run/docker.sock:/var/run/docker.sock  louislam/uptime-kuma:1
09a9c130381326f7b41681fd59e0f6376247a1130fb33aff73505014b86b1c4b



3.查看uptime-kuma容器状态

[root@jeven kuma]# docker ps
CONTAINER ID   IMAGE                                   COMMAND                  CREATED         STATUS                            PORTS                                                                                                                 NAMES
09a9c1303813   louislam/uptime-kuma:1                  "/usr/bin/dumb-init …"   8 seconds ago   Up 7 seconds (health: starting)   0.0.0.0:3001->3001/tcp, :::3001->3001/tcp                                                                             kuma


4.查看uptime-kuma容器日志

[root@jeven kuma]# docker logs kuma 
==> Performing startup jobs and maintenance tasks
==> Starting application with user 0 group 0
Welcome to Uptime Kuma
Your Node.js version: 16
2022-12-07T15:27:35.692Z [SERVER] INFO: Welcome to Uptime Kuma
2022-12-07T15:27:35.692Z [SERVER] INFO: Node Env: production
2022-12-07T15:27:35.692Z [SERVER] INFO: Importing Node libraries
2022-12-07T15:27:35.693Z [SERVER] INFO: Importing 3rd-party libraries
2022-12-07T15:27:36.114Z [SERVER] INFO: Creating express and socket.io instance
2022-12-07T15:27:36.115Z [SERVER] INFO: Server Type: HTTP
2022-12-07T15:27:36.116Z [SERVER] INFO: Importing this project modules
2022-12-07T15:27:36.161Z [NOTIFICATION] INFO: Prepare Notification Providers
2022-12-07T15:27:36.202Z [SERVER] INFO: Version: 1.18.5
2022-12-07T15:27:36.289Z [DB] INFO: Data Dir: ./data/
2022-12-07T15:27:36.289Z [SERVER] INFO: Connecting to the Database
2022-12-07T15:27:36.423Z [DB] INFO: SQLite config:
[ { journal_mode: 'wal' } ]
[ { cache_size: -12000 } ]
2022-12-07T15:27:36.430Z [DB] INFO: SQLite Version: 3.38.3
2022-12-07T15:27:36.431Z [SERVER] INFO: Connected
2022-12-07T15:27:36.432Z [DB] INFO: Your database version: 10
2022-12-07T15:27:36.432Z [DB] INFO: Latest database version: 10
2022-12-07T15:27:36.432Z [DB] INFO: Database patch not needed
2022-12-07T15:27:36.433Z [DB] INFO: Database Patch 2.0 Process
2022-12-07T15:27:36.446Z [SERVER] INFO: Load JWT secret from database.
2022-12-07T15:27:36.448Z [SERVER] INFO: Adding route
2022-12-07T15:27:36.519Z [SERVER] INFO: Adding socket handler
2022-12-07T15:27:36.519Z [SERVER] INFO: Init the server
2022-12-07T15:27:36.536Z [SERVER] INFO: Listening on 3001
2022-12-07T15:27:36.811Z [AUTH] INFO: Login by token. IP=192.168.3.11
2022-12-07T15:27:36.814Z [AUTH] INFO: Username from JWT: admin
2022-12-07T15:27:36.817Z [AUTH] INFO: Successfully logged in user admin. IP=192.168.3.11
2022-12-07T15:27:37.386Z [MONITOR] WARN: Monitor #2 'docker-status': Failing: Cannot read properties of null (reading '_dockerType') | Interval: 60 seconds | Type: docker | Down Count: 0 | Resend Interval: 0
2022-12-07T15:27:47.833Z [AUTH] INFO: Login by token. IP=192.168.3.11
2022-12-07T15:27:47.833Z [AUTH] INFO: Username from JWT: admin
2022-12-07T15:27:47.835Z [AUTH] INFO: Successfully logged in user admin. IP=192.168.3.11
2022-12-07T15:27:52.058Z [MONITOR] INFO: Get Monitor: 2 User ID: 1
2022-12-07T15:28:09.550Z [MANAGE] INFO: Resume Monitor: 2 User ID: 1
2022-12-07T15:28:09.554Z [MONITOR] WARN: Monitor #2 'docker-status': Failing: Cannot read properties of null (reading '_dockerType') | Interval: 60 seconds | Type: docker | Down Count: 0 | Resend Interval: 0
2022-12-07T15:28:09.564Z [MONITOR] INFO: Get Monitor: 2 User ID: 1
2022-12-07T15:28:37.619Z [MONITOR] INFO: Get Monitor: 2 User ID: 1
2022-12-07T15:28:56.543Z [MANAGE] INFO: Resume Monitor: 2 User ID: 1
2022-12-07T15:28:56.567Z [MONITOR] INFO: Get Monitor: 2 User ID: 1



五、访问uptime-kuma服务

1.创建账号

云原生之使用docker部署uptime-kuma服务器监控面板

2.访问uptime-kuma首页

云原生之使用docker部署uptime-kuma服务器监控面板

六、添加http监控项

1.添加http监控项

云原生之使用docker部署uptime-kuma服务器监控面板

2.查看监控项状态

云原生之使用docker部署uptime-kuma服务器监控面板

七、添加docker监控项

1.配置docker宿主信息

云原生之使用docker部署uptime-kuma服务器监控面板

云原生之使用docker部署uptime-kuma服务器监控面板

2.添加docker监控项

云原生之使用docker部署uptime-kuma服务器监控面板

3.查看监控项状态

云原生之使用docker部署uptime-kuma服务器监控面板