告警中心 - 新增统一告警(alert_unified)、监控告警规则(monitor_alert_rule)、指标目录(alert_metric_catalog) - 通知策略与消息分发(alert_notify_policy/dispatch/message)、静默规则 - 告警引擎按阈值/SNMP 拆分(alert_engine_monitor/snmp) 监控采集 - SNMP 常量/模板与历史指标(snmp templates/constants、snmp_metrics_history、snmp_collect) - 中间件监控 Redis 采集与种子(middleware_monitor_redis/seed) - 站点探测 pkg(siteprobe) + 站点视图(site_view) 自动化任务 - cron 调度器(cronscheduler)、脚本运行器(scriptrunner)、系统任务(systask)及运行记录(cron_job_run、system_task) 审计与凭证 - 审计设置(audit_setting) + 历史清理(auditcleaner) 前端 - 监控页面(host/middleware/site/snmp)拆分为子模块并大屏化 - 告警中心多 Tab(规则/指标目录/通知策略/静默)、任务管理组件重构、Agent CLI Markdown 渲染 - 移除旧脚本卡片/详情/日志组件,统一为 ScriptTable/ScriptCodeEditor/TerminalOutput Co-Authored-By: Claude <noreply@anthropic.com>
123 lines
3.2 KiB
Go
123 lines
3.2 KiB
Go
package model
|
|
|
|
// Response 通用响应
|
|
type Response struct {
|
|
Code int `json:"code"`
|
|
Message string `json:"message"`
|
|
Data interface{} `json:"data,omitempty"`
|
|
}
|
|
|
|
// ListResponse 列表响应
|
|
type ListResponse struct {
|
|
List interface{} `json:"list"`
|
|
Total int64 `json:"total"`
|
|
}
|
|
|
|
// PageQuery 分页查询
|
|
type PageQuery struct {
|
|
Page int `form:"page,default=1"`
|
|
PageSize int `form:"page_size,default=20"`
|
|
Keyword string `form:"keyword"`
|
|
Sort string `form:"sort"`
|
|
Order string `form:"order,default=desc"`
|
|
}
|
|
|
|
// GetOffset 获取偏移量
|
|
func (p *PageQuery) GetOffset() int {
|
|
if p.Page < 1 {
|
|
p.Page = 1
|
|
}
|
|
return (p.Page - 1) * p.GetLimit()
|
|
}
|
|
|
|
// GetLimit 获取每页数量
|
|
func (p *PageQuery) GetLimit() int {
|
|
if p.PageSize < 1 {
|
|
p.PageSize = 20
|
|
}
|
|
if p.PageSize > 100 {
|
|
p.PageSize = 100
|
|
}
|
|
return p.PageSize
|
|
}
|
|
|
|
// IDRequest ID请求
|
|
type IDRequest struct {
|
|
ID uint `uri:"id" binding:"required"`
|
|
}
|
|
|
|
// IDsRequest IDs请求
|
|
type IDsRequest struct {
|
|
IDs []uint `json:"ids" binding:"required"`
|
|
}
|
|
|
|
// StatusRequest 状态请求
|
|
type StatusRequest struct {
|
|
Status int `json:"status" binding:"required,oneof=0 1"`
|
|
}
|
|
|
|
// DashboardStats 仪表盘统计
|
|
type DashboardStats struct {
|
|
ServerStats ServerStats `json:"server_stats"`
|
|
K8sStats KubernetesClusterStats `json:"kubernetes_stats"`
|
|
AlertStats AlertStats `json:"alert_stats"`
|
|
PipelineStats PipelineStats `json:"pipeline_stats"`
|
|
AutomationStats AutomationStats `json:"automation_stats"`
|
|
OpsStats OpsOverviewStats `json:"ops_stats"`
|
|
CostStats CostStats `json:"cost_stats"`
|
|
TopResourceUsage TopResourceUsage `json:"top_resource_usage"`
|
|
ExpiringCerts []DomainCert `json:"expiring_certs"`
|
|
}
|
|
|
|
// OpsOverviewStats 运维概览统计(仪表盘快捷入口)// Logan.Li
|
|
type OpsOverviewStats struct {
|
|
DomainCount int64 `json:"domain_count"`
|
|
SiteTaskCount int64 `json:"site_task_count"`
|
|
MiddlewareCount int64 `json:"middleware_count"`
|
|
SnmpDeviceCount int64 `json:"snmp_device_count"`
|
|
MonitorTargetCount int64 `json:"monitor_target_count"`
|
|
}
|
|
|
|
// CostStats 成本统计
|
|
type CostStats struct {
|
|
TotalCost float64 `json:"total_cost"`
|
|
MonthCost float64 `json:"month_cost"`
|
|
CloudCosts []CloudCost `json:"cloud_costs"`
|
|
MonthTrend []MonthTrend `json:"month_trend"`
|
|
}
|
|
|
|
// CloudCost 云平台成本
|
|
type CloudCost struct {
|
|
Cloud string `json:"cloud"`
|
|
Cost float64 `json:"cost"`
|
|
}
|
|
|
|
// MonthTrend 月度趋势
|
|
type MonthTrend struct {
|
|
Month string `json:"month"`
|
|
Cost float64 `json:"cost"`
|
|
}
|
|
|
|
// TopResourceUsage Top资源使用
|
|
type TopResourceUsage struct {
|
|
CPU []ServerResource `json:"cpu"`
|
|
Memory []ServerResource `json:"memory"`
|
|
Disk []ServerResource `json:"disk"`
|
|
}
|
|
|
|
// ServerResource 服务器资源
|
|
type ServerResource struct {
|
|
ID uint `json:"id"`
|
|
Hostname string `json:"hostname"`
|
|
IP string `json:"ip"`
|
|
Usage float64 `json:"usage"`
|
|
}
|
|
|
|
// DomainCert 域名证书
|
|
type DomainCert struct {
|
|
ID uint `json:"id"`
|
|
Name string `json:"name"`
|
|
ExpireDate string `json:"expire_date"`
|
|
DaysUntilExpiry int `json:"days_until_expiry"`
|
|
}
|