komari-agent

command module
v0.0.0-...-8cd9214 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 2 Imported by: 0

README

komari-agent

配置方式

agent 参数可以通过命令行参数、环境变量或 JSON 配置文件传入。

最小启动示例:

./komari-agent --endpoint "https://example.com" --token "your-token"

使用环境变量:

export AGENT_ENDPOINT="https://example.com"
export AGENT_TOKEN="your-token"
./komari-agent

使用 JSON 配置文件:

./komari-agent --config ./config.json

config.json 示例:

{
  "endpoint": "https://example.com",
  "token": "your-token",
  "interval": 3,
  "disable_auto_update": false,
  "disable_web_ssh": false,
  "ignore_unsafe_cert": false
}

配置优先级从低到高为:默认值、命令行参数、环境变量、JSON 配置文件。

常用配置项:

表中支持版本表示该参数本身首次在发布 tag 中出现;环境变量和 JSON 配置文件方式从 1.1.33 起支持,早于最早 tag 的参数记为 0.0.9

JSON 字段 环境变量 命令行参数 说明 支持版本
endpoint AGENT_ENDPOINT --endpoint, -e 面板地址 0.0.9
token AGENT_TOKEN --token, -t agent token 0.0.9
interval AGENT_INTERVAL --interval, -i 数据采集间隔,单位秒 0.0.9
disable_auto_update AGENT_DISABLE_AUTO_UPDATE --disable-auto-update 禁用自动更新 0.0.9
disable_web_ssh AGENT_DISABLE_WEB_SSH --disable-web-ssh 禁用远程控制 0.0.9
ignore_unsafe_cert AGENT_IGNORE_UNSAFE_CERT --ignore-unsafe-cert, -u 忽略不安全证书 0.0.9
include_nics AGENT_INCLUDE_NICS --include-nics 仅统计指定网卡,逗号分隔 0.0.22
exclude_nics AGENT_EXCLUDE_NICS --exclude-nics 排除指定网卡,逗号分隔 0.0.22
include_mountpoints AGENT_INCLUDE_MOUNTPOINTS --include-mountpoint 仅统计指定挂载点,分号分隔 0.1.0
month_rotate AGENT_MONTH_ROTATE --month-rotate 流量统计每月重置日期,0 为禁用 0.1.0
auto_discovery_key AGENT_AUTO_DISCOVERY_KEY --auto-discovery 自动发现密钥 1.0.40
custom_dns AGENT_CUSTOM_DNS --custom-dns 自定义 DNS 服务器 1.0.80
enable_gpu AGENT_ENABLE_GPU --gpu 启用详细 GPU 监控 1.0.80
protocol_version AGENT_PROTOCOL_VERSION --protocol-version 上报协议版本,默认 2 1.2.10
disable_compression AGENT_DISABLE_COMPRESSION --disable-compression 禁用 v2 传输压缩 1.2.10
prefer_ip_version AGENT_PREFER_IP_VERSION --prefer-ip-version 优先使用 IP 版本,可选 46 未发布

完整参数可运行:

./komari-agent --help

详见 cmd/flags/flags.gocmd/root.go

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
protocol
v1
v2

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL