Documentation
¶
Index ¶
- Constants
- type BackupReport
- type BasicInfoParams
- type CPUReport
- type ConnectionsReport
- type DiskReport
- type Event
- type EventParams
- type ExecParams
- type FileOperation
- type FileResult
- type GPUDetailReport
- type GPUDeviceInfo
- type IPAddress
- type IPFamily
- type LoadReport
- type MeshMode
- type MeshTraceAccepted
- type MeshTraceJobSnapshot
- type MeshTraceParams
- type Message
- type MessageParams
- type NetworkReport
- type NextTraceParams
- type NextTraceResult
- type NodeEndpoint
- type PingParams
- type PingResultParams
- type PullParams
- type RPCError
- type RamReport
- type Report
- type ReportParams
- type Request
- type Response
- type TaskResultParams
- type TerminalRequestParams
- type TraceHop
- type TraceProtocol
- type TraceSummary
- type UnlockItem
- type UnlockParams
Constants ¶
View Source
const ( Version = "2.0" MethodAgentReport = "agent.report" MethodAgentBasicInfo = "agent.basicInfo" MethodAgentPingResult = "agent.pingResult" MethodAgentTaskResult = "agent.taskResult" MethodAgentExec = "agent.exec" MethodAgentPing = "agent.ping" MethodAgentMessage = "agent.message" MethodAgentEvent = "agent.event" MethodAgentTerminal = "agent.terminal.request" MethodAgentPull = "agent.pull" MethodAgentFile = "agent.file" MethodAgentFileResult = "agent.file.result" MethodAgentUnlock = "agent.unlock" )
View Source
const ( MethodNetworkTestNextTrace = "networkTest.nextTrace" MethodNetworkTestIperf3 = "networkTest.iperf3" MethodNetworkTestMeshTrace = "networkTest.meshTrace" MethodNetworkTestGetMeshTraceJob = "networkTest.getMeshTraceJob" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackupReport ¶
type BackupReport struct {
// AgeSeconds 距最后一次【成功】备份的秒数;-1 表示无法确定
//(状态文件缺失或不可解析),此时 Ok 必为 0。
AgeSeconds int64 `json:"age_seconds"`
// Ok 为 1 表示最近一次备份成功,0 表示失败或状态未知。
Ok int `json:"ok"`
// Message 是可选的人类可读说明(例如失败原因),便于排查。
Message string `json:"message,omitempty"`
}
BackupReport 是备份新鲜度上报。
动机:备份「有没有在跑」和「最后一次成功是什么时候」往往没有人看, 直到真需要恢复时才发现已经坏了几个月。把最后成功时间变成可监控的指标, 就能用与主机指标相同的方式设阈值/基线告警。
type BasicInfoParams ¶
type BasicInfoParams struct {
Info map[string]interface{} `json:"info"`
}
type ConnectionsReport ¶
type DiskReport ¶
type EventParams ¶
type ExecParams ¶
type FileOperation ¶
type FileOperation struct {
UUID string `json:"uuid"`
RequestID string `json:"request_id"`
Op string `json:"op"`
Args map[string]any `json:"args,omitempty"`
}
FileOperation is metadata-only. File contents travel through the dedicated HTTP transfer endpoint rather than through JSON-RPC.
type FileResult ¶
type GPUDetailReport ¶
type GPUDetailReport struct {
Count int `json:"count"`
AverageUsage float64 `json:"average_usage"`
DetailedInfo []GPUDeviceInfo `json:"detailed_info"`
}
type GPUDeviceInfo ¶
type LoadReport ¶
type MeshTraceAccepted ¶
type MeshTraceJobSnapshot ¶
type MeshTraceJobSnapshot struct {
JobID string `json:"job_id"`
Status string `json:"status"`
Total int `json:"total"`
Done int `json:"done"`
Failed int `json:"failed"`
Running int `json:"running"`
Results []NextTraceResult `json:"results"`
StartedAt time.Time `json:"started_at"`
UpdatedAt time.Time `json:"updated_at"`
FinishedAt *time.Time `json:"finished_at"`
Error string `json:"error"`
}
type MeshTraceParams ¶
type MeshTraceParams struct {
SourceNodeIDs []string `json:"source_node_ids"`
TargetNodeIDs []string `json:"target_node_ids"`
Mode MeshMode `json:"mode"`
IPFamily IPFamily `json:"ip_family"`
Protocol TraceProtocol `json:"protocol"`
MaxHops int `json:"max_hops"`
TimeoutMs int `json:"timeout_ms"`
MaxConcurrency int `json:"max_concurrency"`
PerAgentLimit int `json:"per_agent_limit"`
}
type MessageParams ¶
type NetworkReport ¶
type NextTraceParams ¶
type NextTraceParams struct {
TaskID string `json:"task_id"`
SourceID string `json:"source_id"`
TargetID string `json:"target_id"`
TargetHost string `json:"target_host"`
IPFamily IPFamily `json:"ip_family"`
Protocol TraceProtocol `json:"protocol"`
MaxHops int `json:"max_hops"`
TimeoutMs int `json:"timeout_ms"`
RawOutput bool `json:"raw_output"`
}
type NextTraceResult ¶
type NextTraceResult struct {
TaskID string `json:"task_id"`
SourceID string `json:"source_id"`
TargetID string `json:"target_id"`
TargetHost string `json:"target_host"`
IPFamily IPFamily `json:"ip_family"`
Protocol TraceProtocol `json:"protocol"`
StartedAt time.Time `json:"started_at"`
FinishedAt time.Time `json:"finished_at"`
DurationMs int `json:"duration_ms"`
OK bool `json:"ok"`
Error string `json:"error"`
Summary TraceSummary `json:"summary"`
Hops []TraceHop `json:"hops"`
Raw json.RawMessage `json:"raw"`
RawText string `json:"raw_text"`
ExitCode int `json:"exit_code"`
Truncated bool `json:"truncated"`
}
type NodeEndpoint ¶
type PingParams ¶
type PingResultParams ¶
type PullParams ¶
type Report ¶
type Report struct {
UUID string `json:"uuid,omitempty"`
CPU CPUReport `json:"cpu"`
Ram RamReport `json:"ram"`
Swap RamReport `json:"swap"`
Load LoadReport `json:"load"`
Disk DiskReport `json:"disk"`
Network NetworkReport `json:"network"`
Connections ConnectionsReport `json:"connections"`
GPU *GPUDetailReport `json:"gpu,omitempty"`
Uptime int64 `json:"uptime"`
Process int `json:"process"`
// Backup 是可选的备份新鲜度上报。agent 未配置备份状态文件时为 nil,
// 因此不影响未使用该功能的部署,也不会写入任何 point。
Backup *BackupReport `json:"backup,omitempty"`
Message string `json:"message"`
Method string `json:"method,omitempty"`
UpdatedAt time.Time `json:"updated_at"`
}
func (Report) BoundedPayload ¶ added in v0.1.13
BoundedPayload limits retained strings and GPU cardinality before queueing.
type ReportParams ¶
type Response ¶
type TaskResultParams ¶
type TerminalRequestParams ¶
type TerminalRequestParams struct {
RequestID string `json:"request_id"`
}
type TraceProtocol ¶
type TraceProtocol string
const ( TraceProtocolICMP TraceProtocol = "icmp" TraceProtocolTCP TraceProtocol = "tcp" TraceProtocolUDP TraceProtocol = "udp" )
type TraceSummary ¶
type UnlockItem ¶ added in v0.1.9
type UnlockItem struct {
ID string `json:"id"`
Name string `json:"name"`
Kind string `json:"kind"`
Status string `json:"status"`
Region string `json:"region,omitempty"`
Basis string `json:"basis"`
Detail string `json:"detail,omitempty"`
}
UnlockItem 是单个服务的结论。字段与 agent/unlock.Result 一一对应;服务端与探针是 两个独立模块,所以这里重新声明而不是共享类型 —— 线上形状就是这个结构体。
type UnlockParams ¶ added in v0.1.9
type UnlockParams struct {
EgressIP string `json:"egress_ip,omitempty"`
EgressRegion string `json:"egress_region,omitempty"`
ProbedAt time.Time `json:"probed_at"`
Results []UnlockItem `json:"results"`
}
UnlockParams 是 agent.unlock 的负载:探针从自己的出口测得的解锁结论。
为什么由探针测而不是服务端测:解锁取决于【发起请求的那个 IP】,服务端在别的机房, 只能测到它自己。出口地址随结果一起上来,因为它不总是节点自己的地址 —— 本机群里 有主机是经由另一台节点出网的。
Click to show internal directories.
Click to hide internal directories.