Documentation
¶
Index ¶
- Constants
- Variables
- func FromPortStateDesc(desc string) int64
- func FromProcessStateDesc(desc string) int64
- func GetBootTime(conn *ssh.Connection) (int64, error)
- func GetPortStateDesc(state int64) string
- func GetProcessStateDesc(state int64) string
- func GetProcesses(w http.ResponseWriter, req *http.Request)
- func Init()
- func ProcessHandler(w http.ResponseWriter, req *http.Request)
- func RawConnect(host string, port int64) bool
- func Stop()
- func Suspend(s string) bool
- type Alert
- type Annotations
- type CachePort
- type CacheProcess
- type Collector
- type Command
- type Config
- type Group
- type Instances
- type Labels
- type Message
- type NSWrapper
- type NameSpace
- type Port
- type PortState
- type ProcStat
- type Process
- type ProcessCache
- func (c *ProcessCache) Empty() bool
- func (c *ProcessCache) FetchPort() []*PortState
- func (c *ProcessCache) FetchPro() []*ProcessState
- func (c *ProcessCache) List() []Group
- func (c *ProcessCache) MergeSort(pros []*ProcessState, ports []*PortState) []Group
- func (c *ProcessCache) Render() render.Rows
- func (c *ProcessCache) SyncPort(collection []*PortState)
- func (c *ProcessCache) SyncPro(collection []*ProcessState)
- type ProcessConfig
- type ProcessDetail
- func (p *ProcessDetail) AddListener(l TableListener)
- func (p *ProcessDetail) Peek() render.Rows
- func (p *ProcessDetail) Peep(rows render.Rows) render.Rows
- func (p *ProcessDetail) Refresh()
- func (p *ProcessDetail) RemoveListener(l TableListener)
- func (p *ProcessDetail) Running() bool
- func (p *ProcessDetail) SendCommand(i int64)
- func (p *ProcessDetail) Start() error
- func (p *ProcessDetail) Stop()
- type ProcessState
- type Report
- type Result
- type State
- type TableListener
- type Target
- type Wrapper
- type WrapperFunc
Constants ¶
View Source
const ( RUNNING = "RUNNING" EXCEPTION = "EXCEPTION" OPEN = "OPEN" CLOSED = "CLOSED" )
View Source
const ( UseCache = 0 Reload = 1 )
View Source
const ( Bad = 0 Good = 1 )
View Source
const MaxRetries = 5
View Source
const TimeLayout = "2006-01-02 15:04:05"
Variables ¶
View Source
var ( CollectorMap = map[string]Collector{ "process": p, "namespace": p, } WrapperFuncMap = map[string]WrapperFunc{ "process": NewWrapper, "namespace": NewNSWrapper, } )
View Source
var (
SendMail = make(chan struct{})
)
Functions ¶
func FromPortStateDesc ¶
func FromProcessStateDesc ¶
func GetBootTime ¶
func GetBootTime(conn *ssh.Connection) (int64, error)
func GetPortStateDesc ¶
func GetProcessStateDesc ¶
func GetProcesses ¶
func GetProcesses(w http.ResponseWriter, req *http.Request)
func ProcessHandler ¶
func ProcessHandler(w http.ResponseWriter, req *http.Request)
func RawConnect ¶
Types ¶
type Alert ¶
type Alert struct { URL string IgnoreTimeString []string // contains filtered or unexported fields }
func (*Alert) ConvertTime ¶ added in v0.1.5
func (*Alert) ProcessAlert ¶
func (*Alert) TableDataChanged ¶
func (*Alert) TableLoadFailed ¶
type Annotations ¶
type CacheProcess ¶
type CacheProcess struct { Name string `json:"name"` Host string `json:"host"` Path string `json:"path"` Flag string `json:"flag"` Ports []CachePort `json:"ports"` State int64 `json:"state"` StartTime string `json:"start_time"` TimeStamp string `json:"time_stamp"` Suspend bool `json:"suspend"` }
func (*CacheProcess) String ¶
func (cp *CacheProcess) String() string
type Collector ¶
type Collector interface { // Start 开启后台收集任务 Start() error // Stop 停止收集 Stop() // Refresh 负责手动刷新 Refresh() // Peek Peek返回未加工的数据 Peek() render.Rows Running() bool // AddListener 注册数据订阅者 AddListener(TableListener) // RemoveListener 移除订阅者 RemoveListener(TableListener) SendCommand(int64) }
Collector 收集数据
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func NewCommand ¶
func (*Command) GetProcessStat ¶
func (c *Command) GetProcessStat() (*ProcessState, error)
type Config ¶
type Config struct {
Processes []ProcessConfig
}
type Group ¶
type Group struct { Name string `json:"name"` Processes []*CacheProcess `json:"processes"` }
func (Group) CountNormal ¶
func (Group) CountPortException ¶
func (Group) CountProcessException ¶
func (Group) CountSuspend ¶
type Message ¶
type Message struct { Status string `json:"status"` Labels Labels `json:"labels"` Annotations Annotations `json:"annotations"` }
type NSWrapper ¶
type NSWrapper struct { serialize.Serializable // contains filtered or unexported fields }
func (NSWrapper) TableDataChanged ¶
func (NSWrapper) TableLoadFailed ¶
type NameSpace ¶
func NewNameSpace ¶
func NewNameSpace() *NameSpace
type ProcStat ¶
type ProcStat struct { // The process ID. PID int // The filename of the executable. Comm string // The process state. State string // The PID of the parent of this process. PPID int // The process group ID of the process. PGRP int // The session ID of the process. Session int // The controlling terminal of the process. TTY int // The ID of the foreground process group of the controlling terminal of // the process. TPGID int // The kernel flags word of the process. Flags uint // The number of minor faults the process has made which have not required // loading a memory page from disk. MinFlt uint // The number of minor faults that the process's waited-for children have // made. CMinFlt uint // The number of major faults the process has made which have required // loading a memory page from disk. MajFlt uint // The number of major faults that the process's waited-for children have // made. CMajFlt uint // Amount of time that this process has been scheduled in user mode, // measured in clock ticks. UTime uint // Amount of time that this process has been scheduled in kernel mode, // measured in clock ticks. STime uint // Amount of time that this process's waited-for children have been // scheduled in user mode, measured in clock ticks. CUTime uint // Amount of time that this process's waited-for children have been // scheduled in kernel mode, measured in clock ticks. CSTime uint // For processes running a real-time scheduling policy, this is the negated // scheduling priority, minus one. Priority int // The nice value, a value in the range 19 (low priority) to -20 (high // priority). Nice int // Number of threads in this process. NumThreads int // The time the process started after system boot, the value is expressed // in clock ticks. Starttime uint64 // Virtual memory size in bytes. VSize uint // Resident set size in pages. RSS int }
ProcStat provides status information about the process, read from /proc/[pid]/stat.
func NewProcStat ¶
NewProcStat returns the current status information of the process.
type Process ¶
type Process struct { OSUser string Name string Path string Ports []int64 Group string Host string PIDFile string Flag string Suspend bool }
func (*Process) GetConnectionKey ¶
type ProcessCache ¶
type ProcessCache struct {
// contains filtered or unexported fields
}
func (*ProcessCache) Empty ¶
func (c *ProcessCache) Empty() bool
func (*ProcessCache) FetchPort ¶
func (c *ProcessCache) FetchPort() []*PortState
func (*ProcessCache) FetchPro ¶
func (c *ProcessCache) FetchPro() []*ProcessState
func (*ProcessCache) List ¶
func (c *ProcessCache) List() []Group
func (*ProcessCache) MergeSort ¶
func (c *ProcessCache) MergeSort(pros []*ProcessState, ports []*PortState) []Group
func (*ProcessCache) Render ¶
func (c *ProcessCache) Render() render.Rows
func (*ProcessCache) SyncPort ¶
func (c *ProcessCache) SyncPort(collection []*PortState)
func (*ProcessCache) SyncPro ¶
func (c *ProcessCache) SyncPro(collection []*ProcessState)
type ProcessConfig ¶
type ProcessDetail ¶
type ProcessDetail struct { *ProcessCache sync.RWMutex // contains filtered or unexported fields }
func NewProcessDetail ¶
func NewProcessDetail() *ProcessDetail
func (*ProcessDetail) AddListener ¶
func (p *ProcessDetail) AddListener(l TableListener)
func (*ProcessDetail) Peek ¶
func (p *ProcessDetail) Peek() render.Rows
func (*ProcessDetail) Refresh ¶
func (p *ProcessDetail) Refresh()
func (*ProcessDetail) RemoveListener ¶
func (p *ProcessDetail) RemoveListener(l TableListener)
func (*ProcessDetail) Running ¶
func (p *ProcessDetail) Running() bool
func (*ProcessDetail) SendCommand ¶
func (p *ProcessDetail) SendCommand(i int64)
func (*ProcessDetail) Start ¶
func (p *ProcessDetail) Start() error
func (*ProcessDetail) Stop ¶
func (p *ProcessDetail) Stop()
type ProcessState ¶
type ProcessState struct { Process State int64 StateDescribe string StartTime int64 Timestamp int64 }
func (*ProcessState) Clone ¶ added in v0.1.4
func (p *ProcessState) Clone(ps *ProcessState)
type Report ¶
type TableListener ¶
type TableListener interface { // TableDataChanged notifies the model data changed. TableDataChanged(rows render.Rows) // TableLoadFailed notifies the load failed. TableLoadFailed(error) Chan() chan []byte }
func NewNSWrapper ¶
func NewNSWrapper(s serialize.Serializable) TableListener
func NewWrapper ¶
func NewWrapper(s serialize.Serializable) TableListener
type Target ¶
type Target struct { Conn *ssh.Connection // used to compute process start time BootTime int64 }
type Wrapper ¶
type Wrapper struct { serialize.Serializable // contains filtered or unexported fields }
func (Wrapper) TableDataChanged ¶
func (Wrapper) TableLoadFailed ¶
type WrapperFunc ¶
type WrapperFunc func(serialize.Serializable) TableListener
Click to show internal directories.
Click to hide internal directories.