forked from cloudfoundry/bosh-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
job_supervisor_interface.go
52 lines (41 loc) · 1.2 KB
/
job_supervisor_interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package jobsupervisor
import (
boshalert "github.com/cloudfoundry/bosh-agent/agent/alert"
)
type Process struct {
Name string `json:"name"`
State string `json:"state"`
Uptime UptimeVitals `json:"uptime,omitempty"`
Memory MemoryVitals `json:"mem,omitempty"`
CPU CPUVitals `json:"cpu,omitempty"`
}
type UptimeVitals struct {
Secs int `json:"secs,omitempty"`
}
type MemoryVitals struct {
Kb int `json:"kb,omitempty"`
Percent float64 `json:"percent"`
}
type CPUVitals struct {
Total float64 `json:"total"`
}
type JobFailureHandler func(boshalert.MonitAlert) error
type JobSupervisor interface {
Reload() error
// Actions taken on all services
Start() error
Stop() error
StopAndWait() error
// Start and Stop should still function after Unmonitor.
// Calling Start after Unmonitor should re-monitor all jobs.
// Calling Stop after Unmonitor should not re-monitor all jobs.
// (Monit complies to above requirements.)
Unmonitor() error
Status() string
Processes() ([]Process, error)
// Job management
AddJob(jobName string, jobIndex int, configPath string) error
RemoveAllJobs() error
MonitorJobFailures(handler JobFailureHandler) error
HealthRecorder(status string)
}