Documentation
¶
Index ¶
- Constants
- func Exec(command string, arg ...string) (string, error)
- func ParseArgs(s string) (args []string)
- type AlertLevel
- type AlertTarget
- type App
- type AppInterface
- type CPUUsage
- type Event
- type Listen
- type Log
- type LogFormat
- type LogType
- type LsofResult
- func (this *LsofResult) IsCwd() bool
- func (this *LsofResult) IsEstablished() bool
- func (this *LsofResult) IsIPv4() bool
- func (this *LsofResult) IsIPv6() bool
- func (this *LsofResult) IsListening() bool
- func (this *LsofResult) IsRegularFile() bool
- func (this *LsofResult) IsTCP() bool
- func (this *LsofResult) LAddr() string
- func (this *LsofResult) Listen() string
- func (this *LsofResult) RAddr() string
- type MemoryUsage
- type Monitor
- type Operation
- type Process
- type Socket
- type Statistics
Constants ¶
View Source
const ( AlertLevelInfo = "info" AlertLevelDebug = "debug" AlertLevelWarning = "warning" AlertLevelError = "error" )
View Source
const ( LogTypeNormal = "normal" LogTypeAccess = "access" LogTypeError = "error" )
日志类型
View Source
const ( LogFormatPlain = "plain" LogFormatXML = "xml" // @TODO 暂不支持 LogFormatGzip = "gzip" // @TODO 暂不支持 LogFormatJSON = "json" // @TODO 暂不支持 LogFormatSQL = "sql" // @TODO 暂不支持 )
日志文件格式
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AlertTarget ¶
type AlertTarget interface {
SetOptions(options map[string]interface{}) error // 设置选项
Send(message string) error // 发送消息
}
报警发送目标
type App ¶
type App struct {
Id string // 唯一ID,通常系统会自动生成
Name string
Developer string
Site string
DocSite string
Version string
Icon []byte
Cmdline string
Processes []*Process // 进程列表
Operations []*Operation // TODO
Monitors []*Monitor // TODO
Statistics []*Statistics // TODO
Logs []*Log // TODO
IsRunning bool
// contains filtered or unexported fields
}
App定义
type Log ¶
type Log struct {
Id string // 唯一ID,通常系统会自动生成
Name string // 日志名
Path string // 文件路径
Type LogType // 类型
Format LogFormat // 文件格式
}
日志定义
type LsofResult ¶
type LsofResult struct {
Command string
Pid int32
User string
Fd string
Type string
Protocol string
Name string
ConnectionState string
}
func Lsof ¶
func Lsof(pid int32) (results []*LsofResult, err error)
func (*LsofResult) IsCwd ¶
func (this *LsofResult) IsCwd() bool
func (*LsofResult) IsEstablished ¶
func (this *LsofResult) IsEstablished() bool
func (*LsofResult) IsIPv4 ¶
func (this *LsofResult) IsIPv4() bool
func (*LsofResult) IsIPv6 ¶
func (this *LsofResult) IsIPv6() bool
func (*LsofResult) IsListening ¶
func (this *LsofResult) IsListening() bool
func (*LsofResult) IsRegularFile ¶
func (this *LsofResult) IsRegularFile() bool
func (*LsofResult) IsTCP ¶
func (this *LsofResult) IsTCP() bool
func (*LsofResult) LAddr ¶
func (this *LsofResult) LAddr() string
func (*LsofResult) Listen ¶
func (this *LsofResult) Listen() string
func (*LsofResult) RAddr ¶
func (this *LsofResult) RAddr() string
type MemoryUsage ¶
内存使用
type Monitor ¶
type Monitor struct {
ProcessPids []uint32 // 监控的进程PID
Files []string // 监控的文件
EventTypes []string // 监控的事件
Sockets []*Socket // 监控的Socket端口
URLs []string // 监控的URL
PingHosts []string // 通过ICMP监控
Scripts []string // 监控脚本
Timeout float64 // 超时时间,单位为秒
Interval float64 // 间隔时间
MaxFails uint32 // 最大失败次数,在达到此失败次数后才会报警
Level AlertLevel // 级别
Targets []*AlertTarget // 报警发送目标
}
监控设置
type Operation ¶
type Operation struct {
Id string // 唯一ID,通常系统会自动生成
Code string // 代号
Name string // 名称
IsEnabled bool // 是否启用
ShouldConfirm bool // 操作是否确认
ConfirmText string // 操作确认文字
// contains filtered or unexported fields
}
对App的操作定义
type Process ¶
type Process struct {
Name string
Pid int32
Ppid int32
Cwd string
User string
Uid int32
Gid int32
CreateTime int64 // 时间戳
Cmdline string
File string // 命令行文件路径
Dir string // 命令行文件所在目录
CPUUsage *CPUUsage
MemoryUsage *MemoryUsage
OpenFiles []string
Connections []string
Listens []*Listen
IsRunning bool
}
func NewProcess ¶
func PsChildren ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.