Documentation
¶
Index ¶
- Constants
- Variables
- type BaseChecker
- type ConfApi
- type ContentChecker
- type HTTPChecker
- type LogReadInfo
- type Logtail
- type ProcessLogReadInfo
- type ProcessStdin
- type ProcessTailLog
- type RPCTaskResult
- type RemoteCommEvent
- type ScriptChecker
- type StartProcessArgs
- type StateInfo
- type Supervisor
- func (s *Supervisor) AddProcessGroup(r *http.Request, args *struct{ Name string }, reply *struct{ Success bool }) error
- func (s *Supervisor) ClearAllProcessLogs(r *http.Request, args *struct{}, ...) error
- func (s *Supervisor) ClearLog(r *http.Request, args *struct{}, reply *struct{ Ret bool }) error
- func (s *Supervisor) ClearProcessLogs(r *http.Request, args *struct{ Name string }, reply *struct{ Success bool }) error
- func (s *Supervisor) GetAllProcessInfo(r *http.Request, args *struct{}, ...) error
- func (s *Supervisor) GetConfig() *config.Config
- func (s *Supervisor) GetIdentification(r *http.Request, args *struct{}, reply *struct{ ID string }) error
- func (s *Supervisor) GetManager() *process.Manager
- func (s *Supervisor) GetPID(r *http.Request, args *struct{}, reply *struct{ Pid int }) error
- func (s *Supervisor) GetProcessInfo(r *http.Request, args *struct{ Name string }, ...) error
- func (s *Supervisor) GetPrograms() []string
- func (s *Supervisor) GetState(r *http.Request, args *struct{}, reply *struct{ StateInfo StateInfo }) error
- func (s *Supervisor) GetSupervisorID() string
- func (s *Supervisor) GetSupervisorVersion(r *http.Request, args *struct{}, reply *struct{ Version string }) error
- func (s *Supervisor) GetVersion(r *http.Request, args *struct{}, reply *struct{ Version string }) error
- func (s *Supervisor) IsRestarting() bool
- func (s *Supervisor) ReadLog(r *http.Request, args *LogReadInfo, reply *struct{ Log string }) error
- func (s *Supervisor) ReadProcessStderrLog(r *http.Request, args *ProcessLogReadInfo, reply *struct{ LogData string }) error
- func (s *Supervisor) ReadProcessStdoutLog(r *http.Request, args *ProcessLogReadInfo, reply *struct{ LogData string }) error
- func (s *Supervisor) Reload(restart bool) (addedGroup []string, changedGroup []string, removedGroup []string, err error)
- func (s *Supervisor) ReloadConfig(r *http.Request, args *struct{}, reply *types.ReloadConfigResult) error
- func (s *Supervisor) RemoveProcessGroup(r *http.Request, args *struct{ Name string }, reply *struct{ Success bool }) error
- func (s *Supervisor) Restart(r *http.Request, args *struct{}, reply *struct{ Ret bool }) error
- func (s *Supervisor) SendProcessStdin(r *http.Request, args *ProcessStdin, reply *struct{ Success bool }) error
- func (s *Supervisor) SendRemoteCommEvent(r *http.Request, args *RemoteCommEvent, reply *struct{ Success bool }) error
- func (s *Supervisor) Shutdown(r *http.Request, args *struct{}, reply *struct{ Ret bool }) error
- func (s *Supervisor) SignalAllProcesses(r *http.Request, args *types.ProcessSignal, ...) error
- func (s *Supervisor) SignalProcess(r *http.Request, args *types.ProcessSignal, reply *struct{ Success bool }) error
- func (s *Supervisor) SignalProcessGroup(r *http.Request, args *types.ProcessSignal, ...) error
- func (s *Supervisor) StartAllProcesses(r *http.Request, args ..., reply *struct{ RPCTaskResults []RPCTaskResult }) error
- func (s *Supervisor) StartProcess(r *http.Request, args *StartProcessArgs, reply *struct{ Success bool }) error
- func (s *Supervisor) StartProcessGroup(r *http.Request, args *StartProcessArgs, ...) error
- func (s *Supervisor) StopAllProc()
- func (s *Supervisor) StopAllProcesses(r *http.Request, args ..., reply *struct{ RPCTaskResults []RPCTaskResult }) error
- func (s *Supervisor) StopProcess(r *http.Request, args *StartProcessArgs, reply *struct{ Success bool }) error
- func (s *Supervisor) StopProcessGroup(r *http.Request, args *StartProcessArgs, ...) error
- func (s *Supervisor) TailProcessStderrLog(r *http.Request, args *ProcessLogReadInfo, reply *ProcessTailLog) error
- func (s *Supervisor) TailProcessStdoutLog(r *http.Request, args *ProcessLogReadInfo, reply *ProcessTailLog) error
- func (s *Supervisor) WaitForExit()
- type SupervisorRestful
- func (sr *SupervisorRestful) CreateProgramHandler() http.Handler
- func (sr *SupervisorRestful) CreateSupervisorHandler() http.Handler
- func (sr *SupervisorRestful) ListProgram(w http.ResponseWriter, req *http.Request)
- func (sr *SupervisorRestful) ReadStdoutLog(w http.ResponseWriter, req *http.Request)
- func (sr *SupervisorRestful) Reload(w http.ResponseWriter, req *http.Request)
- func (sr *SupervisorRestful) Shutdown(w http.ResponseWriter, req *http.Request)
- func (sr *SupervisorRestful) StartProgram(w http.ResponseWriter, req *http.Request)
- func (sr *SupervisorRestful) StartPrograms(w http.ResponseWriter, req *http.Request)
- func (sr *SupervisorRestful) StopProgram(w http.ResponseWriter, req *http.Request)
- func (sr *SupervisorRestful) StopPrograms(w http.ResponseWriter, req *http.Request)
- type SupervisorWebgui
- type TCPChecker
- type XMLRPC
Constants ¶
const (
// SupervisorVersion the version of supervisor
SupervisorVersion = "3.0"
)
Variables ¶
var HTTP http.FileSystem = http.Dir("./webgui")
HTTP auto generated
Functions ¶
This section is empty.
Types ¶
type BaseChecker ¶
type BaseChecker struct {
// contains filtered or unexported fields
}
BaseChecker basic implementation of ContentChecker
func NewBaseChecker ¶
func NewBaseChecker(includes []string, timeout int) *BaseChecker
NewBaseChecker creates BaseChecker object
type ConfApi ¶
type ConfApi struct {
// contains filtered or unexported fields
}
func NewConfApi ¶
func NewConfApi(supervisor *Supervisor) *ConfApi
NewLogtail creates a Logtail object
func (*ConfApi) CreateHandler ¶
CreateHandler creates http handlers to process the program stdout and stderr through http interface
type ContentChecker ¶
type ContentChecker interface {
Check() bool
}
ContentChecker defines check interface
type HTTPChecker ¶
type HTTPChecker struct {
// contains filtered or unexported fields
}
HTTPChecker implements the ContentChecker by HTTP protocol
func NewHTTPChecker ¶
func NewHTTPChecker(url string, timeout int) *HTTPChecker
NewHTTPChecker creates HTTPChecker object
type LogReadInfo ¶
LogReadInfo the input argument to read the log of supervisor
type Logtail ¶
type Logtail struct {
// contains filtered or unexported fields
}
Logtail tails the process log through http interface
func NewLogtail ¶
func NewLogtail(supervisor *Supervisor) *Logtail
NewLogtail creates a Logtail object
func (*Logtail) CreateHandler ¶
CreateHandler creates http handlers to process the program stdout and stderr through http interface
type ProcessLogReadInfo ¶
type ProcessLogReadInfo struct { Name string // the program name Offset int // the offset of the program log Length int // the length of log to read }
ProcessLogReadInfo the input argument to read the log of program
type ProcessStdin ¶
ProcessStdin process stdin from client
type ProcessTailLog ¶
ProcessTailLog the output of tail the program log
type RPCTaskResult ¶
type RPCTaskResult struct { Name string `xml:"name"` // the program name Group string `xml:"group"` // the group of the program Status int `xml:"status"` // the status of the program Description string `xml:"description"` // the description of program }
RPCTaskResult result of some remote commands
type RemoteCommEvent ¶
RemoteCommEvent remove communication event from client side
type ScriptChecker ¶
type ScriptChecker struct {
// contains filtered or unexported fields
}
ScriptChecker implements ContentChecker by calling external script
func NewScriptChecker ¶
func NewScriptChecker(args []string) *ScriptChecker
NewScriptChecker creates ScriptChecker object
func (*ScriptChecker) Check ¶
func (sc *ScriptChecker) Check() bool
Check return code of the script. If return code is 0, check is successful
type StartProcessArgs ¶
type StartProcessArgs struct { Name string // program name Wait bool `default:"true"` // Wait the program starting finished }
StartProcessArgs arguments for starting a process
type Supervisor ¶
type Supervisor struct {
// contains filtered or unexported fields
}
Supervisor manage all the processes defined in the supervisor configuration file. All the supervisor public interface is defined in this class
func NewSupervisor ¶
func NewSupervisor(configFile string) *Supervisor
NewSupervisor create a Supervisor object with supervisor configuration file
func (*Supervisor) AddProcessGroup ¶
func (s *Supervisor) AddProcessGroup(r *http.Request, args *struct{ Name string }, reply *struct{ Success bool }) error
AddProcessGroup adds a process group to the supervisor
func (*Supervisor) ClearAllProcessLogs ¶
func (s *Supervisor) ClearAllProcessLogs(r *http.Request, args *struct{}, reply *struct{ RPCTaskResults []RPCTaskResult }) error
ClearAllProcessLogs clears logs of all programs
func (*Supervisor) ClearLog ¶
func (s *Supervisor) ClearLog(r *http.Request, args *struct{}, reply *struct{ Ret bool }) error
ClearLog clear the supervisor log
func (*Supervisor) ClearProcessLogs ¶
func (s *Supervisor) ClearProcessLogs(r *http.Request, args *struct{ Name string }, reply *struct{ Success bool }) error
ClearProcessLogs clears log of given program
func (*Supervisor) GetAllProcessInfo ¶
func (s *Supervisor) GetAllProcessInfo(r *http.Request, args *struct{}, reply *struct{ AllProcessInfo []types.ProcessInfo }) error
GetAllProcessInfo get all the program information managed by supervisor
func (*Supervisor) GetConfig ¶
func (s *Supervisor) GetConfig() *config.Config
GetConfig get the loaded supervisor configuration
func (*Supervisor) GetIdentification ¶
func (s *Supervisor) GetIdentification(r *http.Request, args *struct{}, reply *struct{ ID string }) error
GetIdentification get the supervisor identifier configured in the file
func (*Supervisor) GetManager ¶
func (s *Supervisor) GetManager() *process.Manager
GetManager get the Manager object created by supervisor
func (*Supervisor) GetPID ¶
func (s *Supervisor) GetPID(r *http.Request, args *struct{}, reply *struct{ Pid int }) error
GetPID get the pid of supervisor
func (*Supervisor) GetProcessInfo ¶
func (s *Supervisor) GetProcessInfo(r *http.Request, args *struct{ Name string }, reply *struct{ ProcInfo types.ProcessInfo }) error
GetProcessInfo get the process information of one program
func (*Supervisor) GetPrograms ¶
func (s *Supervisor) GetPrograms() []string
GetPrograms Get all the name of programs
Return the name of all the programs
func (*Supervisor) GetState ¶
func (s *Supervisor) GetState(r *http.Request, args *struct{}, reply *struct{ StateInfo StateInfo }) error
GetState get the state of supervisor
func (*Supervisor) GetSupervisorID ¶
func (s *Supervisor) GetSupervisorID() string
GetSupervisorID get the supervisor identifier from configuration file
func (*Supervisor) GetSupervisorVersion ¶
func (s *Supervisor) GetSupervisorVersion(r *http.Request, args *struct{}, reply *struct{ Version string }) error
GetSupervisorVersion get the supervisor version
func (*Supervisor) GetVersion ¶
func (s *Supervisor) GetVersion(r *http.Request, args *struct{}, reply *struct{ Version string }) error
GetVersion get the version of supervisor
func (*Supervisor) IsRestarting ¶
func (s *Supervisor) IsRestarting() bool
IsRestarting check if supervisor is in restarting state
func (*Supervisor) ReadLog ¶
func (s *Supervisor) ReadLog(r *http.Request, args *LogReadInfo, reply *struct{ Log string }) error
ReadLog read the log of supervisor
func (*Supervisor) ReadProcessStderrLog ¶
func (s *Supervisor) ReadProcessStderrLog(r *http.Request, args *ProcessLogReadInfo, reply *struct{ LogData string }) error
ReadProcessStderrLog reads stderr log of given program
func (*Supervisor) ReadProcessStdoutLog ¶
func (s *Supervisor) ReadProcessStdoutLog(r *http.Request, args *ProcessLogReadInfo, reply *struct{ LogData string }) error
ReadProcessStdoutLog reads stdout of given program
func (*Supervisor) Reload ¶
func (s *Supervisor) Reload(restart bool) (addedGroup []string, changedGroup []string, removedGroup []string, err error)
Reload supervisord configuration.
func (*Supervisor) ReloadConfig ¶
func (s *Supervisor) ReloadConfig(r *http.Request, args *struct{}, reply *types.ReloadConfigResult) error
ReloadConfig reloads supervisord configuration file
func (*Supervisor) RemoveProcessGroup ¶
func (s *Supervisor) RemoveProcessGroup(r *http.Request, args *struct{ Name string }, reply *struct{ Success bool }) error
RemoveProcessGroup removes a process group from the supervisor
func (*Supervisor) Restart ¶
func (s *Supervisor) Restart(r *http.Request, args *struct{}, reply *struct{ Ret bool }) error
Restart the supervisor
func (*Supervisor) SendProcessStdin ¶
func (s *Supervisor) SendProcessStdin(r *http.Request, args *ProcessStdin, reply *struct{ Success bool }) error
SendProcessStdin send data to program through stdin
func (*Supervisor) SendRemoteCommEvent ¶
func (s *Supervisor) SendRemoteCommEvent(r *http.Request, args *RemoteCommEvent, reply *struct{ Success bool }) error
SendRemoteCommEvent emit a remote communication event
func (*Supervisor) Shutdown ¶
func (s *Supervisor) Shutdown(r *http.Request, args *struct{}, reply *struct{ Ret bool }) error
Shutdown the supervisor
func (*Supervisor) SignalAllProcesses ¶
func (s *Supervisor) SignalAllProcesses(r *http.Request, args *types.ProcessSignal, reply *struct{ AllProcessInfo []types.ProcessInfo }) error
SignalAllProcesses send signal to all the processes in the supervisor
func (*Supervisor) SignalProcess ¶
func (s *Supervisor) SignalProcess(r *http.Request, args *types.ProcessSignal, reply *struct{ Success bool }) error
SignalProcess send a signal to running program
func (*Supervisor) SignalProcessGroup ¶
func (s *Supervisor) SignalProcessGroup(r *http.Request, args *types.ProcessSignal, reply *struct{ AllProcessInfo []types.ProcessInfo }) error
SignalProcessGroup send signal to all processes in one group
func (*Supervisor) StartAllProcesses ¶
func (s *Supervisor) StartAllProcesses(r *http.Request, args *struct { Wait bool `default:"true"` }, reply *struct{ RPCTaskResults []RPCTaskResult }) error
StartAllProcesses start all the programs
func (*Supervisor) StartProcess ¶
func (s *Supervisor) StartProcess(r *http.Request, args *StartProcessArgs, reply *struct{ Success bool }) error
StartProcess start the given program
func (*Supervisor) StartProcessGroup ¶
func (s *Supervisor) StartProcessGroup(r *http.Request, args *StartProcessArgs, reply *struct{ AllProcessInfo []types.ProcessInfo }) error
StartProcessGroup start all the processes in one group
func (*Supervisor) StopAllProc ¶
func (s *Supervisor) StopAllProc()
func (*Supervisor) StopAllProcesses ¶
func (s *Supervisor) StopAllProcesses(r *http.Request, args *struct { Wait bool `default:"true"` }, reply *struct{ RPCTaskResults []RPCTaskResult }) error
StopAllProcesses stop all programs managed by supervisor
func (*Supervisor) StopProcess ¶
func (s *Supervisor) StopProcess(r *http.Request, args *StartProcessArgs, reply *struct{ Success bool }) error
StopProcess stop given program
func (*Supervisor) StopProcessGroup ¶
func (s *Supervisor) StopProcessGroup(r *http.Request, args *StartProcessArgs, reply *struct{ AllProcessInfo []types.ProcessInfo }) error
StopProcessGroup stop all processes in one group
func (*Supervisor) TailProcessStderrLog ¶
func (s *Supervisor) TailProcessStderrLog(r *http.Request, args *ProcessLogReadInfo, reply *ProcessTailLog) error
TailProcessStderrLog tails stderr of the program
func (*Supervisor) TailProcessStdoutLog ¶
func (s *Supervisor) TailProcessStdoutLog(r *http.Request, args *ProcessLogReadInfo, reply *ProcessTailLog) error
TailProcessStdoutLog tails stdout of the program
func (*Supervisor) WaitForExit ¶
func (s *Supervisor) WaitForExit()
WaitForExit waits for supervisord to exit
type SupervisorRestful ¶
type SupervisorRestful struct {
// contains filtered or unexported fields
}
SupervisorRestful the restful interface to control the programs defined in configuration file
func NewSupervisorRestful ¶
func NewSupervisorRestful(supervisor *Supervisor) *SupervisorRestful
NewSupervisorRestful create a new SupervisorRestful object
func (*SupervisorRestful) CreateProgramHandler ¶
func (sr *SupervisorRestful) CreateProgramHandler() http.Handler
CreateProgramHandler create http handler to process program related restful request
func (*SupervisorRestful) CreateSupervisorHandler ¶
func (sr *SupervisorRestful) CreateSupervisorHandler() http.Handler
CreateSupervisorHandler create http rest interface to control supervisor itself
func (*SupervisorRestful) ListProgram ¶
func (sr *SupervisorRestful) ListProgram(w http.ResponseWriter, req *http.Request)
ListProgram list the status of all the programs
json array to present the status of all programs
func (*SupervisorRestful) ReadStdoutLog ¶
func (sr *SupervisorRestful) ReadStdoutLog(w http.ResponseWriter, req *http.Request)
ReadStdoutLog read the stdout of given program
func (*SupervisorRestful) Reload ¶
func (sr *SupervisorRestful) Reload(w http.ResponseWriter, req *http.Request)
Reload the supervisor configuration file through rest interface
func (*SupervisorRestful) Shutdown ¶
func (sr *SupervisorRestful) Shutdown(w http.ResponseWriter, req *http.Request)
Shutdown the supervisor itself
func (*SupervisorRestful) StartProgram ¶
func (sr *SupervisorRestful) StartProgram(w http.ResponseWriter, req *http.Request)
StartProgram start the given program through restful interface
func (*SupervisorRestful) StartPrograms ¶
func (sr *SupervisorRestful) StartPrograms(w http.ResponseWriter, req *http.Request)
StartPrograms start one or more programs through restful interface
func (*SupervisorRestful) StopProgram ¶
func (sr *SupervisorRestful) StopProgram(w http.ResponseWriter, req *http.Request)
StopProgram stop a program through the restful interface
func (*SupervisorRestful) StopPrograms ¶
func (sr *SupervisorRestful) StopPrograms(w http.ResponseWriter, req *http.Request)
StopPrograms stop programs through the restful interface
type SupervisorWebgui ¶
type SupervisorWebgui struct {
// contains filtered or unexported fields
}
SupervisorWebgui the interface to show a WEBGUI to control the supervisor
func NewSupervisorWebgui ¶
func NewSupervisorWebgui(supervisor *Supervisor) *SupervisorWebgui
NewSupervisorWebgui create a new SupervisorWebgui object
func (*SupervisorWebgui) CreateHandler ¶
func (sw *SupervisorWebgui) CreateHandler() http.Handler
CreateHandler create a http handler to process the request from WEBGUI
type TCPChecker ¶
type TCPChecker struct {
// contains filtered or unexported fields
}
TCPChecker check by TCP protocol
func NewTCPChecker ¶
func NewTCPChecker(host string, port int, includes []string, timeout int) *TCPChecker
NewTCPChecker creates TCPChecker object
func (*TCPChecker) Check ¶
func (tc *TCPChecker) Check() bool
Check if it is ready by reading the tcp data
type XMLRPC ¶
type XMLRPC struct {
// contains filtered or unexported fields
}
XMLRPC mange the XML RPC servers start XML RPC servers to accept the XML RPC request from client side
func (*XMLRPC) StartInetHTTPServer ¶
func (p *XMLRPC) StartInetHTTPServer(user string, password string, listenAddr string, s *Supervisor, startedCb func())
StartInetHTTPServer start http server on tcp with path listenAddr. If both user and password are not empty, the user must provide user and password for basic authentication when making an XML RPC request.
func (*XMLRPC) StartUnixHTTPServer ¶
func (p *XMLRPC) StartUnixHTTPServer(user string, password string, listenAddr string, s *Supervisor, startedCb func())
StartUnixHTTPServer start http server on unix domain socket with path listenAddr. If both user and password are not empty, the user must provide user and password for basic authentication when making an XML RPC request.