models

package
v0.0.0-...-8df46b2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2016 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

任务状态集合

Functions

This section is empty.

Types

type AgentInfo

type AgentInfo struct {
	ID      bson.ObjectId `bson:"_id,omitempty"`
	Name    string        `bson:"name"`        //名称
	IP      string        `bson:"ip"`          //IP
	URL     string        `bson:"url"`         //URL
	Version string        `bson:"version"`     //版本
	Status  AgentStatus   `bson:"status"`      //状态
	Desc    string        `bson:"description"` //描述
	Updated time.Time     `bson:"updated" json:"-"`
}

AgentInfo Agent信息

func (*AgentInfo) JionPath

func (a *AgentInfo) JionPath(ps ...string) string

JionPath 拼接 URL

func (*AgentInfo) String

func (a *AgentInfo) String() string

func (*AgentInfo) Verify

func (a *AgentInfo) Verify() error

Verify 验证

type AgentStatus

type AgentStatus string

AgentStatus Agent状态

const (
	AgentStatusUnknown AgentStatus = ""        //未知
	AgentStatusOnline  AgentStatus = "online"  //在线
	AgentStatusOffline AgentStatus = "offline" //离线

)

type CheckItem

type CheckItem struct {
	ID        bson.ObjectId     `bson:"_id,omitempty"`
	Name      string            `bson:"name"`       //名称
	TargetIP  string            `bson:"target_ip"`  //执行任务的IP,即在该指定服务器上执行命令
	TargetIP2 string            `bson:"target_ip2"` //代理执行命令的服务器IP
	Cmd       *CmdInfo          `bson:"cmd"`        //命令信息
	Options   map[string]string `bson:"options"`    //更新相关信息
	CheckWays []*ResultCheckWay `bson:"checkways"`  //数据检查方式
	Status    string            `bson:"status"`     //检查项状态:running,stoped,disabled
}

CheckItem 检查项

type CmdExecProcess

type CmdExecProcess struct {
	CommandID bson.ObjectId `bson:"_id,omitempty"` //对应的 command ID
	Tag       string        `bson:"tag"`
	Body      interface{}   `bson:"body"`
}

CmdExecProcess CMD命令执行进度报告

type CmdInfo

type CmdInfo struct {
	ID       bson.ObjectId     `bson:"_id,omitempty"`
	Name     string            `bson:"name"`
	Category string            `bson:"category"` //命令类型: cmd, ps, sql
	ResType  CmdResultType     `bson:"resType"`  //命令结果类型:数字:number, 文本:string, 多行记录:records
	Command  string            `bson:"command"`  //命令内容
	Options  map[string]string `bson:"options"`  //更多命令执行选项信息
	Args     []string          `bson:"args"`
}

CmdInfo 命令信息

func (*CmdInfo) Verify

func (c *CmdInfo) Verify() error

Verify 验证输入

type CmdResultType

type CmdResultType string

CmdResultType 命令执行结果数据类型格式

const (
	ResultTypeIsSingleNumber CmdResultType = "number" // 单个数字
	ResultTypeIsSingleString CmdResultType = "string" // 单个字符
	ResultTypeIsOneRow       CmdResultType = "single_row"
	ResultTypeIsMultiRows    CmdResultType = "multi_rows"
	ResultTypeIsJSON         CmdResultType = "json"
)

type Msg

type Msg struct {
	ID          bson.ObjectId //消息唯一ID
	Target      bson.ObjectId //消息主题ID
	ContentType string        //消息内容类型,方便进行数据解析
	Content     interface{}   //消息内容
	SendTimes   int           //发送次数,表示该消息被发送过的次数
	Created     time.Time     //消息创建时间
}

Msg 消息

func (*Msg) Verify

func (m *Msg) Verify() error

Verify 验证数据合法性

type ResultCheckWay

type ResultCheckWay struct {
	Way     assertions.Assertion   `bson:"way"`
	Params  map[string]interface{} `bson:"params"`
	Leval   string                 `bson:"level"` //Level 基本:info, warn,error
	Options map[string]string      `bson:"options"`
}

ResultCheckWay 数据检查模式

type ServerInfo

type ServerInfo struct {
	Name    string `bson:"name"`    //名称
	IP      string `bson:"ip"`      //IP
	URL     string `bson:"url"`     //URL
	Version string `bson:"version"` //版本
}

ServerInfo 服务器信息

type Task

type Task struct {
	ID          bson.ObjectId          `bson:"_id,omitempty"`
	Name        string                 `bson:"name"`        //任务名称
	TargetIP    string                 `bson:"targetIp"`    //执行任务的IP,即在该指定服务器上执行命令
	TargetIP2   string                 `bson:"targetIp2"`   //代理执行命令的服务器IP
	Status      TaskStatus             `bson:"status"`      //状态
	Operator    string                 `bson:"operator"`    //操作者
	Options     map[string]interface{} `bson:"options"`     //更新相关信息
	ResultCheck []*ResultCheckWay      `bson:"resultCheck"` //数据检查方式
	Cmd         *CmdInfo               `bson:"cmd"`         //命令信息
}

Task 任务

func (*Task) Verify

func (t *Task) Verify() error

Verify 返回任务基础信息检查结果.

type TaskLog

type TaskLog struct {
	ID             bson.ObjectId `bson:"_id,omitempty"`
	TaskID         bson.ObjectId `bson:"taskId"`
	Content        interface{}   `bson:"content"`
	OccurrenceTime time.Time     `bson:"occurrenceTime"`
}

TaskLog 任务日志

type TaskStatus

type TaskStatus string

TaskStatus 任务状态

const (
	TaskStatusNew        TaskStatus = "new"        //新任务
	TaskStatusStarted    TaskStatus = "started"    // 已发送
	TaskStatusProcessing TaskStatus = "processing" // 执行中
	TaskStatusErrorDown  TaskStatus = "errorDown"  // 错误停止
	TaskStatusCompleted  TaskStatus = "completed"  // 已完成
)

Jump to

Keyboard shortcuts

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