diff --git a/apps/amprobe/README.md b/apps/amprobe/README.md new file mode 100644 index 00000000..093d497e --- /dev/null +++ b/apps/amprobe/README.md @@ -0,0 +1,29 @@ +# Amprobe + +![MIT License](https://img.shields.io/badge/License-MIT-green.svg) ![Go Reference](https://pkg.go.dev/badge/github.com/shirou/gopsutil/v3.svg) + +## 简介 + +`Amprobe` 是一款轻量级主机及 `Docker` 容器监控工具,它可以轻松的帮助我们完成以下几方面的工作: + +- 监控主机的 CPU、内存、磁盘 IO、网络 IO情况 +- 监控部署于主机上 Docker 容器的运行状态、CPU、内存使用情况 +- 实时查看 Docker 容器的日志,并支持日志下载 +- 针对管理员用户提供简单的 Docker 容器、镜像运维操作 +- 操作日志记录 + +安装文档:[文档 | Amprobe (amuluze.com)](https://amprobedoc.amuluze.com/) + +## 注意 + +配置文件在应用数据目录的`data/configs`文件夹下,默认账户的设置也在里面,注意修改。 + +默认存在两个账户。 + +- 管理员账户 + - admin + - 123456 + +- 普通账户 + - amprobe + - 123456 diff --git a/apps/amprobe/data.yml b/apps/amprobe/data.yml new file mode 100644 index 00000000..620091df --- /dev/null +++ b/apps/amprobe/data.yml @@ -0,0 +1,19 @@ +name: Amprobe +tags: + - 实用工具 +title: 一款轻量级主机及 Docker 容器监控工具 +description: 一款轻量级主机及 Docker 容器监控工具 +additionalProperties: + key: amprobe + name: Amprobe + tags: + - Tool + shortDescZh: 一款轻量级主机及 Docker 容器监控工具 + shortDescEn: A lightweight host and Docker container monitoring tool + type: tool + crossVersionUpdate: true + limit: 0 + recommend: 0 + website: https://github.com/amuluze/amprobe + github: https://github.com/amuluze/amprobe + document: https://amprobedoc.amuluze.com diff --git a/apps/amprobe/latest/.env.sample b/apps/amprobe/latest/.env.sample new file mode 100644 index 00000000..fbd13921 --- /dev/null +++ b/apps/amprobe/latest/.env.sample @@ -0,0 +1,3 @@ +CONTAINER_NAME="amprobe" +DATA_PATH="./data" +PANEL_APP_PORT_HTTP="40235" diff --git a/apps/amprobe/latest/data.yml b/apps/amprobe/latest/data.yml new file mode 100644 index 00000000..79f2fa2d --- /dev/null +++ b/apps/amprobe/latest/data.yml @@ -0,0 +1,17 @@ +additionalProperties: + formFields: + - default: 40235 + edit: true + envKey: PANEL_APP_PORT_HTTP + labelEn: Port + labelZh: 端口 + required: true + rule: paramPort + type: number + - default: "./data" + disabled: true + envKey: DATA_PATH + labelEn: Data Directory + labelZh: 数据目录 + required: true + type: text diff --git a/apps/amprobe/latest/data/configs/config.dev.toml b/apps/amprobe/latest/data/configs/config.dev.toml new file mode 100644 index 00000000..445f2dcf --- /dev/null +++ b/apps/amprobe/latest/data/configs/config.dev.toml @@ -0,0 +1,78 @@ +[Fiber] +# http监听地址 +Host = "0.0.0.0" +# http监听端口 +Port = 8000 +# http优雅关闭等待超时时长(单位秒) +ShutdownTimeout = 30 +SeverHeader = "probe" +AppName = "probe" +Prefork = false + +# 数据库文件存放位置的配置 +# 需要监控的磁盘设备配置 +# 定时任务执行间隔配置 +[Gorm] +# 是否开启调试模式 +Debug = true +# 数据库类型(目前支持的数据库类型:postgres) +DBType = "sqlite" +# 设置连接可以重用的最长时间(单位:秒) +MaxLifetime = 7200 +# 设置数据库的最大打开连接数 +MaxOpenConns = 150 +# 设置空闲连接池中的最大连接数 +MaxIdleConns = 50 +# 数据库表名前缀 +TablePrefix = "s_" +# 是否启用自动映射数据库表结构 +EnableAutoMigrate = true + +[DB] +# 连接地址 +Host = "" +# 连接端口 +Port = "" +# 用户名 +User = "" +# 密码 +Password = "" +# 数据库 +DBName = "/Users/amu/Desktop/amprobe" +# SSL模式 +SSLMode = "" + +[Disk] +# 需要监控的磁盘设备,可以根据 lsblk 命令查看 +Devices = ["disk3s1s1"] + +[Ethernet] +# 需要监控的网口,可以通过 ifconfig 命令查看 +Names = ["en0"] + +[Task] +# 主机监控数据的采集频率 +Interval = 30 # 单位 s + +[Logger] +File = "/Users/amu/Desktop/probe.log" +Level = "debug" +RotationTime = "1" # 每天切分一个日志文件 +MaxAge = "7" # 最多保留 7 天的日志 + +[Auth] +# 是否启用 +Enable = true +# 签名方式(支持:HS512/HS384/HS512) +SigningMethod = "HS512" +# 签名key +SigningKey = "amprobe" +# 过期时间(单位秒) +Expired = 7200 +# key 前缀 +Prefix = "auth_" + + +[InitData] +Enable = true +InitConfigFile = "./configs/init.yaml" \ No newline at end of file diff --git a/apps/amprobe/latest/data/configs/config.toml b/apps/amprobe/latest/data/configs/config.toml new file mode 100644 index 00000000..28438468 --- /dev/null +++ b/apps/amprobe/latest/data/configs/config.toml @@ -0,0 +1,78 @@ +[Fiber] +# http监听地址 +Host = "0.0.0.0" +# http监听端口 +Port = 8000 +# http优雅关闭等待超时时长(单位秒) +ShutdownTimeout = 30 +SeverHeader = "probe" +AppName = "probe" +Prefork = false + +# 数据库文件存放位置的配置 +# 需要监控的磁盘设备配置 +# 定时任务执行间隔配置 +[Gorm] +# 是否开启调试模式 +Debug = true +# 数据库类型(目前支持的数据库类型:postgres) +DBType = "sqlite" +# 设置连接可以重用的最长时间(单位:秒) +MaxLifetime = 7200 +# 设置数据库的最大打开连接数 +MaxOpenConns = 150 +# 设置空闲连接池中的最大连接数 +MaxIdleConns = 50 +# 数据库表名前缀 +TablePrefix = "s_" +# 是否启用自动映射数据库表结构 +EnableAutoMigrate = true + +[DB] +# 连接地址 +Host = "" +# 连接端口 +Port = "" +# 用户名 +User = "" +# 密码 +Password = "" +# 数据库 +DBName = "/app/probe" +# SSL模式 +SSLMode = "" + +[Disk] +# 需要监控的磁盘设备,可以根据 lsblk 命令查看 +Devices = ["vda2"] + +[Ethernet] +# 需要监控的网口,可以通过 ifconfig 命令查看 +Names = ["eth0"] + +[Task] +# 主机监控数据的采集频率 +Interval = 30 # 单位 s + +[Logger] +File = "/app/probe.log" +Level = "debug" +RotationTime = "1" # 每天切分一个日志文件 +MaxAge = "7" # 最多保留 7 天的日志 + +[Auth] +# 是否启用 +Enable = true +# 签名方式(支持:HS512/HS384/HS512) +SigningMethod = "HS512" +# 签名key +SigningKey = "amprobe" +# 过期时间(单位秒) +Expired = 7200 +# key 前缀 +Prefix = "auth_" + + +[InitData] +Enable = true +InitConfigFile = "/app/configs/init.yaml" \ No newline at end of file diff --git a/apps/amprobe/latest/data/configs/init.yaml b/apps/amprobe/latest/data/configs/init.yaml new file mode 100644 index 00000000..8e6e497e --- /dev/null +++ b/apps/amprobe/latest/data/configs/init.yaml @@ -0,0 +1,9 @@ +users: + - username: admin + password: 123456 + status: 1 + is_admin: 1 + - username: amprobe + password: 123456 + status: 1 + is_admin: 0 diff --git a/apps/amprobe/latest/data/nginx/nginx.conf b/apps/amprobe/latest/data/nginx/nginx.conf new file mode 100644 index 00000000..509a6a6c --- /dev/null +++ b/apps/amprobe/latest/data/nginx/nginx.conf @@ -0,0 +1,53 @@ +worker_processes 1; +daemon off; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + sendfile on; + keepalive_timeout 65; + + server { + listen 80; + #server_name amprobe.amuluze.com; # 服务器地址或绑定域名 + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; + } + + location /api/ { + rewrite ^/api/(.*)$ /$1 break; #必须的写这个,使用nginx的rewrite对uri进行重写 下面这行也要改为api + proxy_pass http://127.0.0.1:8000/; #跨域转发路由地址 + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + location /ws/ { + # rewrite ^/wsUrl/(.*)$ /$1 break; #拦截标识去除 + proxy_pass http://127.0.0.1:8000/ws/; + + proxy_http_version 1.1; + + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } + + # 错误页配置 + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + } +} diff --git a/apps/amprobe/latest/data/supervisor/nginx.conf b/apps/amprobe/latest/data/supervisor/nginx.conf new file mode 100644 index 00000000..1d7d9c21 --- /dev/null +++ b/apps/amprobe/latest/data/supervisor/nginx.conf @@ -0,0 +1,8 @@ +[program:nginx] +command=/usr/sbin/nginx -c /etc/nginx/nginx.conf +directory=/etc/nginx +autostart=true +autorestart=true +redirect_stderr=true +priority=10 +stdout_logfile=/app/nginx.log diff --git a/apps/amprobe/latest/data/supervisor/server.conf b/apps/amprobe/latest/data/supervisor/server.conf new file mode 100644 index 00000000..7d8853e3 --- /dev/null +++ b/apps/amprobe/latest/data/supervisor/server.conf @@ -0,0 +1,16 @@ +[program:server] +directory=/app +command=/app/amprobe run -c /app/configs/config.toml +autostart=true +startsecs=10 +autorestart=true +startretries=3 +user=root +priority=999 +stopsignal=INT +redirect_stderr=true +stdout_logfile_maxbytes=200MB +stdout_logfile_backups = 100 +stdout_logfile=/app/app.log +stopasgroup=false +killasgroup=false diff --git a/apps/amprobe/latest/docker-compose.yml b/apps/amprobe/latest/docker-compose.yml new file mode 100644 index 00000000..be3db083 --- /dev/null +++ b/apps/amprobe/latest/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3' +services: + amprobe: + image: amuluze/amprobe:v1.3.3 + container_name: ${CONTAINER_NAME} + restart: always + ports: + - "${PANEL_APP_PORT_HTTP}:80" + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - /proc:/host/proc:ro + - /sys:/host/sys:ro + - /dev:/host/dev:ro + - ./data/configs:/app/configs + - ./data/nginx/nginx.conf:/etc/nginx/nginx.conf + - ./data/supervisor:/etc/supervisor/conf.d + labels: + createdBy: "Apps" + +networks: + 1panel-network: + external: true diff --git a/apps/amprobe/logo.png b/apps/amprobe/logo.png new file mode 100644 index 00000000..9433d15e Binary files /dev/null and b/apps/amprobe/logo.png differ