本文主要是介绍【打工日常】使用docker部署轻量的运维监控工具,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、Uptime-Kuma介绍
Uptime-Kuma是一个轻量级的自动化运维监控工具,最为引人注目的特点是其出色的监控Dashboard面板。部署简单,工具轻量又强大。而且,Uptime-Kuma是开源免费的,并支持基于Docker的部署方式。它支持网站、容器、数据库等存活检测,并支持通过邮件等方式进行告警,对于有自己的服务器并且提供访问的管理员可以实现告警推送,如果是企业级需要更强大的可以通过zabbix、prometheus、grafana等实现。
二、本次实践介绍
本次实践简介
本次实践部署环境为个人测试环境
本地环境规划
本次实践环境规划:docker快速拉取docker-ui镜像,然后后台启动docker-ui镜像
镜像命名 | IP地址 | 容器镜像版本 | 操作系统版本 |
---|---|---|---|
uptime-kuma | localhost | latest | ubuntu 22.04 |
三、检查本地Docker环境
检查本地Docker版本
检查Docker版本:docker versionroot@WellDone:/home/goodjob# docker version
Client: Docker Engine - CommunityVersion: 25.0.0API version: 1.44Go version: go1.21.6Git commit: e758fe5Built: Thu Jan 18 17:09:49 2024OS/Arch: linux/amd64Context: defaultServer: Docker Engine - CommunityEngine:Version: 25.0.0API version: 1.44 (minimum version 1.24)Go version: go1.21.6Git commit: 615dfdfBuilt: Thu Jan 18 17:09:49 2024OS/Arch: linux/amd64Experimental: falsecontainerd:Version: 1.6.27GitCommit: a1496014c916f9e62104b33d1bb5bd03b0858e59runc:Version: 1.1.11GitCommit: v1.1.11-0-g4bccb38docker-init:Version: 0.19.0GitCommit: de40ad0
root@WellDone:/home/goodjob#
检查Docker服务状态
检查Docker服务状态,确保Docker服务正常运行。
systemctl status dockerroot@WellDone:/home/goodjob/Downloads# systemctl status docker
● docker.service - Docker Application Container EngineLoaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)Active: active (running) since Wed 2024-01-24 08:54:31 CST; 1 day 4h ago
TriggeredBy: ● docker.socketDocs: https://docs.docker.comMain PID: 1549 (dockerd)Tasks: 65Memory: 419.5MCPU: 38.874sCGroup: /system.slice/docker.service├─ 1549 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock├─ 2010 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 6379 -container-ip 172.17.0.2 -container-port 6379├─ 2016 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 6379 -container-ip 172.17.0.2 -container-port 6379├─ 2029 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 5432 -container-ip 172.17.0.3 -container-port 5432├─ 2036 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 5432 -container-ip 172.17.0.3 -container-port 5432├─123083 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8888 -container-ip 172.17.0.4 -container-port 8080└─123095 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8888 -container-ip 172.17.0.4 -container-port 80801月 24 08:54:31 WellDone dockerd[1549]: time="2024-01-24T08:54:31.067895045+08:00" level=info msg="API listen on /run/docker.sock"
1月 24 08:54:31 WellDone systemd[1]: Started Docker Application Container Engine.
1月 24 16:13:48 WellDone dockerd[1549]: time="2024-01-24T16:13:48.185008219+08:00" level=info msg="ignoring event" container=8ad99af82d8a41dd661d>
1月 24 16:13:48 WellDone dockerd[1549]: time="2024-01-24T16:13:48.189484205+08:00" level=warning msg="ShouldRestart failed, container will not be>
1月 24 21:58:08 WellDone dockerd[1549]: time="2024-01-24T21:58:08.024915139+08:00" level=info msg="ignoring event" container=27fd28e2993f31b170b8>
1月 24 21:58:08 WellDone dockerd[1549]: time="2024-01-24T21:58:08.029986730+08:00" level=warning msg="ShouldRestart failed, container will not be>
1月 25 10:46:16 WellDone dockerd[1549]: time="2024-01-25T10:46:16.329180722+08:00" level=info msg="Container failed to exit within 10s of signal >
1月 25 10:46:16 WellDone dockerd[1549]: time="2024-01-25T10:46:16.350757439+08:00" level=info msg="ignoring event" container=b1223add00f36bbb3246>
1月 25 10:49:21 WellDone dockerd[1549]: time="2024-01-25T10:49:21.993755983+08:00" level=info msg="Container failed to exit within 10s of signal >
1月 25 10:49:22 WellDone dockerd[1549]: time="2024-01-25T10:49:22.015822650+08:00" level=info msg="ignoring event" container=edb0e153b45dbe62acd8>
lines 1-28/28 (END)
四、部署Uptime-Kuma镜像
下载Uptime-Kuma镜像
docker pull louislam/uptime-kumaroot@WellDone:/usr/local/docker-win# docker pull louislam/uptime-kuma
Using default tag: latest
latest: Pulling from louislam/uptime-kuma
faac0b388980: Pull complete
477d7c8346e1: Pull complete
de38bf6b573d: Pull complete
091406d4b39a: Pull complete
35203e649f95: Pull complete
38c138423805: Pull complete
70984f4f56dc: Pull complete
8334848a8c10: Pull complete
eced218a4ab6: Pull complete
b8c49ad5fa2c: Pull complete
4f4fb700ef54: Pull complete
75bf460180b9: Pull complete
Digest: sha256:c326fd83d8da2d8fff3feb0e47433546139513bd823d9accc12977176b05b31f
Status: Downloaded newer image for louislam/uptime-kuma:latest
docker.io/louislam/uptime-kuma:latestroot@WellDone:/home/goodjob# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
louislam/uptime-kuma latest b23ac695b1b4 2 months ago 434MB
创建容器
使用docker快速创建Uptime-Kuma的容器。
完整创建过程:1.使用docker-cli启动一个Uptime-Kuma的容器。docker run -d --name uptime-kuma -p 9001:3001 -v /usr/local/uptime-kuma/data:/app/data -v /usr/share/zoneinfo/Asia/Shanghai:/usr/share/zoneinfo/Etc/UTC louislam/uptime-kuma:latest2.使用docker-compose启动一个Uptime-Kuma的容器version: "3"
services:uptime-kuma:container_name: uptime-kumaimage: louislam/uptime-kumaports:- 9001:3001volumes:- /usr/local/uptime-kuma/data:/app/data- /usr/share/zoneinfo/Asia/Shanghai:/usr/share/zoneinfo/Etc/UTCrestart: always3.容器启动正常,访问
http://ip:9001
检查容器运行状态
检查容器的运行状态,确保服务的正常运行。
docker ps
root@WellDone:/home/goodjob# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
uptime-kuma louislam/uptime-kuma "/usr/bin/dumb-init …" uptime-kuma About a minute ago Up About a minute (healthy) 0.0.0.0:9001->3001/tcp, :::9001->3001/tcp
五、访问Uptime-Kuma页面
访问Uptime-Kuma首页 访问地址:http://localhost:9001
这篇关于【打工日常】使用docker部署轻量的运维监控工具的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!