Documentation ¶
Index ¶
- Constants
- func FixupCheckType(raw interface{}) error
- func FixupLockDelay(raw interface{}) error
- func LevelFilter() *logutils.LevelFilter
- func NewLogWriter(buf int) *logWriter
- func ValidateLevelFilter(minLevel logutils.LogLevel, filter *logutils.LevelFilter) bool
- type Agent
- func (a *Agent) AddCheck(check *structs.HealthCheck, chkType *CheckType) error
- func (a *Agent) AddService(service *structs.NodeService, chkType *CheckType) error
- func (a *Agent) ForceLeave(node string) (err error)
- func (a *Agent) JoinLAN(addrs []string) (n int, err error)
- func (a *Agent) JoinWAN(addrs []string) (n int, err error)
- func (a *Agent) LANMembers() []serf.Member
- func (a *Agent) Leave() error
- func (a *Agent) LocalMember() serf.Member
- func (a *Agent) PauseSync()
- func (a *Agent) RPC(method string, args interface{}, reply interface{}) error
- func (a *Agent) RemoveCheck(checkID string) error
- func (a *Agent) RemoveService(serviceID string) error
- func (a *Agent) ResumeSync()
- func (a *Agent) Shutdown() error
- func (a *Agent) ShutdownCh() <-chan struct{}
- func (a *Agent) StartSync()
- func (a *Agent) Stats() map[string]map[string]string
- func (a *Agent) UpdateCheck(checkID, status, output string) error
- func (a *Agent) WANMembers() []serf.Member
- type AgentRPC
- type AgentSelf
- type AppendSliceValue
- type CheckDefinition
- type CheckMonitor
- type CheckNotifier
- type CheckTTL
- type CheckType
- type Command
- type Config
- type DNSConfig
- type DNSServer
- type GatedWriter
- type HTTPServer
- func (s *HTTPServer) AgentCheckFail(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AgentCheckPass(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AgentCheckWarn(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AgentChecks(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AgentDeregisterCheck(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AgentDeregisterService(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AgentForceLeave(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AgentJoin(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AgentMembers(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AgentRegisterCheck(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AgentRegisterService(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AgentSelf(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) AgentServices(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) CatalogDatacenters(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) CatalogDeregister(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) CatalogNodeServices(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) CatalogNodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) CatalogRegister(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) CatalogServiceNodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) CatalogServices(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) HealthChecksInState(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) HealthNodeChecks(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) HealthServiceChecks(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) HealthServiceNodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) Index(resp http.ResponseWriter, req *http.Request)
- func (s *HTTPServer) KVSDelete(resp http.ResponseWriter, req *http.Request, args *structs.KeyRequest) (interface{}, error)
- func (s *HTTPServer) KVSEndpoint(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) KVSGet(resp http.ResponseWriter, req *http.Request, args *structs.KeyRequest) (interface{}, error)
- func (s *HTTPServer) KVSGetKeys(resp http.ResponseWriter, req *http.Request, args *structs.KeyRequest) (interface{}, error)
- func (s *HTTPServer) KVSPut(resp http.ResponseWriter, req *http.Request, args *structs.KeyRequest) (interface{}, error)
- func (s *HTTPServer) SessionCreate(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) SessionDestroy(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) SessionGet(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) SessionList(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) SessionsForNode(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) Shutdown()
- func (s *HTTPServer) StatusLeader(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) StatusPeers(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) UINodeInfo(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) UINodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- func (s *HTTPServer) UIServices(resp http.ResponseWriter, req *http.Request) (interface{}, error)
- type LogHandler
- type Member
- type PortConfig
- type RPCClient
- func (c *RPCClient) Close() error
- func (c *RPCClient) ForceLeave(node string) error
- func (c *RPCClient) Join(addrs []string, wan bool) (int, error)
- func (c *RPCClient) LANMembers() ([]Member, error)
- func (c *RPCClient) Leave() error
- func (c *RPCClient) Monitor(level logutils.LogLevel, ch chan<- string) (StreamHandle, error)
- func (c *RPCClient) Reload() error
- func (c *RPCClient) Stats() (map[string]map[string]string, error)
- func (c *RPCClient) Stop(handle StreamHandle) error
- func (c *RPCClient) WANMembers() ([]Member, error)
- type ServiceDefinition
- type ServiceSummary
- type StreamHandle
- type SyslogWrapper
Constants ¶
const ( // Do not allow for a interval below this value. // Otherwise we risk fork bombing a system. MinInterval = time.Second // Limit the size of a check's output to the // last CheckBufSize. Prevents an enormous buffer // from being captured CheckBufSize = 4 * 1024 // 4KB )
const ( MinRPCVersion = 1 MaxRPCVersion = 1 )
Variables ¶
This section is empty.
Functions ¶
func FixupCheckType ¶
func FixupCheckType(raw interface{}) error
func FixupLockDelay ¶ added in v0.3.0
func FixupLockDelay(raw interface{}) error
FixupLockDelay is used to handle parsing the JSON body to session/create and properly parsing out the lock delay duration value.
func LevelFilter ¶
func LevelFilter() *logutils.LevelFilter
LevelFilter returns a LevelFilter that is configured with the log levels that we use.
func NewLogWriter ¶
func NewLogWriter(buf int) *logWriter
NewLogWriter creates a logWriter with the given buffer capacity
func ValidateLevelFilter ¶
func ValidateLevelFilter(minLevel logutils.LogLevel, filter *logutils.LevelFilter) bool
ValidateLevelFilter verifies that the log levels within the filter are valid.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
The agent is the long running process that is run on every machine. It exposes an RPC interface that is used by the CLI to control the agent. The agent runs the query interfaces like HTTP, DNS, and RPC. However, it can run in either a client, or server mode. In server mode, it runs a full Consul server. In client-only mode, it only forwards requests to other Consul servers.
func (*Agent) AddCheck ¶
func (a *Agent) AddCheck(check *structs.HealthCheck, chkType *CheckType) error
AddCheck is used to add a health check to the agent. This entry is persistent and the agent will make a best effort to ensure it is registered. The Check may include a CheckType which is used to automatically update the check status
func (*Agent) AddService ¶
func (a *Agent) AddService(service *structs.NodeService, chkType *CheckType) error
AddService is used to add a service entry. This entry is persistent and the agent will make a best effort to ensure it is registered
func (*Agent) ForceLeave ¶
ForceLeave is used to remove a failed node from the cluster
func (*Agent) LANMembers ¶
LANMembers is used to retrieve the LAN members
func (*Agent) LocalMember ¶ added in v0.3.0
LocalMember is used to return the local node
func (*Agent) PauseSync ¶
func (a *Agent) PauseSync()
PauseSync is used to pause anti-entropy while bulk changes are make
func (*Agent) RPC ¶
RPC is used to make an RPC call to the Consul servers This allows the agent to implement the Consul.Interface
func (*Agent) RemoveCheck ¶
RemoveCheck is used to remove a health check. The agent will make a best effort to ensure it is deregistered
func (*Agent) RemoveService ¶
RemoveService is used to remove a service entry. The agent will make a best effort to ensure it is deregistered
func (*Agent) ResumeSync ¶
func (a *Agent) ResumeSync()
ResumeSync is used to unpause anti-entropy after bulk changes are make
func (*Agent) Shutdown ¶
Shutdown is used to hard stop the agent. Should be preceeded by a call to Leave to do it gracefully.
func (*Agent) ShutdownCh ¶
func (a *Agent) ShutdownCh() <-chan struct{}
ShutdownCh is used to return a channel that can be selected to wait for the agent to perform a shutdown.
func (*Agent) StartSync ¶
func (a *Agent) StartSync()
StartSync is called once Services and Checks are registered. This is called to prevent a race between clients and the anti-entropy routines
func (*Agent) UpdateCheck ¶
UpdateCheck is used to update the status of a check. This can only be used with checks of the TTL type.
func (*Agent) WANMembers ¶
WANMembers is used to retrieve the WAN members
type AgentRPC ¶
func NewAgentRPC ¶
func NewAgentRPC(agent *Agent, listener net.Listener, logOutput io.Writer, logWriter *logWriter) *AgentRPC
NewAgentRPC is used to create a new Agent RPC handler
type AppendSliceValue ¶
type AppendSliceValue []string
AppendSliceValue implements the flag.Value interface and allows multiple calls to the same variable to append a list.
func (*AppendSliceValue) Set ¶
func (s *AppendSliceValue) Set(value string) error
func (*AppendSliceValue) String ¶
func (s *AppendSliceValue) String() string
type CheckDefinition ¶
type CheckDefinition struct { ID string Name string Notes string CheckType `mapstructure:",squash"` }
ChecKDefinition is used to JSON decode the Check definitions
func DecodeCheckDefinition ¶
func DecodeCheckDefinition(raw interface{}) (*CheckDefinition, error)
DecodeCheckDefinition is used to decode a check definition
func (*CheckDefinition) HealthCheck ¶
func (c *CheckDefinition) HealthCheck(node string) *structs.HealthCheck
type CheckMonitor ¶
type CheckMonitor struct { Notify CheckNotifier CheckID string Script string Interval time.Duration Logger *log.Logger // contains filtered or unexported fields }
CheckMonitor is used to periodically invoke a script to determine the health of a given check. It is compatible with nagios plugins and expects the output in the same format.
func (*CheckMonitor) Start ¶
func (c *CheckMonitor) Start()
Start is used to start a check monitor. Monitor runs until stop is called
type CheckNotifier ¶
type CheckNotifier interface {
UpdateCheck(checkID, status, output string)
}
CheckNotifier interface is used by the CheckMonitor to notify when a check has a status update. The update should take care to be idempotent.
type CheckTTL ¶
type CheckTTL struct { Notify CheckNotifier CheckID string TTL time.Duration Logger *log.Logger // contains filtered or unexported fields }
CheckTTL is used to apply a TTL to check status, and enables clients to set the status of a check but upon the TTL expiring, the check status is automatically set to critical.
func (*CheckTTL) SetStatus ¶
SetStatus is used to update the status of the check, and to renew the TTL. If expired, TTL is restarted.
type CheckType ¶
CheckType is used to create either the CheckMonitor or the CheckTTL. Only one of TTL or Script/Interval needs to be provided
type Command ¶
type Command struct { Revision string Version string VersionPrerelease string Ui cli.Ui ShutdownCh <-chan struct{} // contains filtered or unexported fields }
Command is a Command implementation that runs a Consul agent. The command will not end unless a shutdown message is sent on the ShutdownCh. If two messages are sent on the ShutdownCh it will forcibly exit.
type Config ¶
type Config struct { // Bootstrap is used to bring up the first Consul server, and // permits that node to elect itself leader Bootstrap bool `mapstructure:"bootstrap"` // BootstrapExpect tries to automatically bootstrap the Consul cluster, // by witholding peers until enough servers join. BootstrapExpect int `mapstructure:"bootstrap_expect"` // Server controls if this agent acts like a Consul server, // or merely as a client. Servers have more state, take part // in leader election, etc. Server bool `mapstructure:"server"` // Datacenter is the datacenter this node is in. Defaults to dc1 Datacenter string `mapstructure:"datacenter"` // DataDir is the directory to store our state in DataDir string `mapstructure:"data_dir"` // DNSRecursor can be set to allow the DNS server to recursively // resolve non-consul domains DNSRecursor string `mapstructure:"recursor"` // DNS configuration DNSConfig DNSConfig `mapstructure:"dns_config"` // Domain is the DNS domain for the records. Defaults to "consul." Domain string `mapstructure:"domain"` // Encryption key to use for the Serf communication EncryptKey string `mapstructure:"encrypt" json:"-"` // LogLevel is the level of the logs to putout LogLevel string `mapstructure:"log_level"` // Node name is the name we use to advertise. Defaults to hostname. NodeName string `mapstructure:"node_name"` // ClientAddr is used to control the address we bind to for // client services (DNS, HTTP, RPC) ClientAddr string `mapstructure:"client_addr"` // BindAddr is used to control the address we bind to. // If not specified, the first private IP we find is used. // This controls the address we use for cluster facing // services (Gossip, Server RPC) BindAddr string `mapstructure:"bind_addr"` // AdvertiseAddr is the address we use for advertising our Serf, // and Consul RPC IP. If not specified, bind address is used. AdvertiseAddr string `mapstructure:"advertise_addr"` // Port configurations Ports PortConfig // LeaveOnTerm controls if Serf does a graceful leave when receiving // the TERM signal. Defaults false. This can be changed on reload. LeaveOnTerm bool `mapstructure:"leave_on_terminate"` // SkipLeaveOnInt controls if Serf skips a graceful leave when receiving // the INT signal. Defaults false. This can be changed on reload. SkipLeaveOnInt bool `mapstructure:"skip_leave_on_interrupt"` // StatsiteAddr is the address of a statsite instance. If provided, // metrics will be streamed to that instance. StatsiteAddr string `mapstructure:"statsite_addr"` // Protocol is the Consul protocol version to use. Protocol int `mapstructure:"protocol"` // EnableDebug is used to enable various debugging features EnableDebug bool `mapstructure:"enable_debug"` // VerifyIncoming is used to verify the authenticity of incoming connections. // This means that TCP requests are forbidden, only allowing for TLS. TLS connections // must match a provided certificate authority. This can be used to force client auth. VerifyIncoming bool `mapstructure:"verify_incoming"` // VerifyOutgoing is used to verify the authenticity of outgoing connections. // This means that TLS requests are used. TLS connections must match a provided // certificate authority. This is used to verify authenticity of server nodes. VerifyOutgoing bool `mapstructure:"verify_outgoing"` // CAFile is a path to a certificate authority file. This is used with VerifyIncoming // or VerifyOutgoing to verify the TLS connection. CAFile string `mapstructure:"ca_file"` // CertFile is used to provide a TLS certificate that is used for serving TLS connections. // Must be provided to serve TLS connections. CertFile string `mapstructure:"cert_file"` // KeyFile is used to provide a TLS key that is used for serving TLS connections. // Must be provided to serve TLS connections. KeyFile string `mapstructure:"key_file"` // ServerName is used with the TLS certificates to ensure the name we // provid ematches the certificate ServerName string `mapstructure:"server_name"` // StartJoin is a list of addresses to attempt to join when the // agent starts. If Serf is unable to communicate with any of these // addresses, then the agent will error and exit. StartJoin []string `mapstructure:"start_join"` // UiDir is the directory containing the Web UI resources. // If provided, the UI endpoints will be enabled. UiDir string `mapstructure:"ui_dir"` // PidFile is the file to store our PID in PidFile string `mapstructure:"pid_file"` // EnableSyslog is used to also tee all the logs over to syslog. Only supported // on linux and OSX. Other platforms will generate an error. EnableSyslog bool `mapstructure:"enable_syslog"` // SyslogFacility is used to control where the syslog messages go // By default, goes to LOCAL0 SyslogFacility string `mapstructure:"syslog_facility"` // RejoinAfterLeave controls our interaction with the cluster after leave. // When set to false (default), a leave causes Consul to not rejoin // the cluster until an explicit join is received. If this is set to // true, we ignore the leave, and rejoin the cluster on start. RejoinAfterLeave bool `mapstructure:"rejoin_after_leave"` // CheckUpdateInterval controls the interval on which the output of a health check // is updated if there is no change to the state. For example, a check in a steady // state may run every 5 second generating a unique output (timestamp, etc), forcing // constant writes. This allows Consul to defer the write for some period of time, // reducing the write pressure when the state is steady. CheckUpdateInterval time.Duration `mapstructure:"-"` CheckUpdateIntervalRaw string `mapstructure:"check_update_interval" json:"-"` // AEInterval controls the anti-entropy interval. This is how often // the agent attempts to reconcile it's local state with the server' // representation of our state. Defaults to every 60s. AEInterval time.Duration `mapstructure:"-" json:"-"` // Checks holds the provided check definitions Checks []*CheckDefinition `mapstructure:"-" json:"-"` // Services holds the provided service definitions Services []*ServiceDefinition `mapstructure:"-" json:"-"` // ConsulConfig can either be provided or a default one created ConsulConfig *consul.Config `mapstructure:"-" json:"-"` // Revision is the GitCommit this maps to Revision string `mapstructure:"-"` // Version is the release version number Version string `mapstructure:"-"` // VersionPrerelease is a label for pre-release builds VersionPrerelease string `mapstructure:"-"` }
Config is the configuration that can be set for an Agent. Some of this is configurable as CLI flags, but most must be set using a configuration file.
func DecodeConfig ¶
DecodeConfig reads the configuration from the given reader in JSON format and decodes it into a proper Config structure.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig is used to return a sane default configuration
func MergeConfig ¶
MergeConfig merges two configurations together to make a single new configuration.
func ReadConfigPaths ¶
ReadConfigPaths reads the paths in the given order to load configurations. The paths can be to files or directories. If the path is a directory, we read one directory deep and read any files ending in ".json" as configuration files.
func (*Config) ClientListener ¶
ClientListener is used to format a listener for a port on a ClientAddr
func (*Config) EncryptBytes ¶
EncryptBytes returns the encryption key configured.
type DNSConfig ¶ added in v0.3.0
type DNSConfig struct { // NodeTTL provides the TTL value for a node query NodeTTL time.Duration `mapstructure:"-"` NodeTTLRaw string `mapstructure:"node_ttl" json:"-"` // ServiceTTL provides the TTL value for a service // query for given service. The "*" wildcard can be used // to set a default for all services. ServiceTTL map[string]time.Duration `mapstructure:"-"` ServiceTTLRaw map[string]string `mapstructure:"service_ttl" json:"-"` // AllowStale is used to enable lookups with stale // data. This gives horizontal read scalability since // any Consul server can service the query instead of // only the leader. AllowStale bool `mapstructure:"allow_stale"` // MaxStale is used to bound how stale of a result is // accepted for a DNS lookup. This can be used with // AllowStale to limit how old of a value is served up. // If the stale result exceeds this, another non-stale // stale read is performed. MaxStale time.Duration `mapstructure:"-"` MaxStaleRaw string `mapstructure:"max_stale" json:"-"` }
DNSConfig is used to fine tune the DNS sub-system. It can be used to control cache values, and stale reads
type DNSServer ¶
type DNSServer struct {
// contains filtered or unexported fields
}
DNSServer is used to wrap an Agent and expose various service discovery endpoints using a DNS interface.
type GatedWriter ¶
GatedWriter is an io.Writer implementation that buffers all of its data into an internal buffer until it is told to let data through.
func (*GatedWriter) Flush ¶
func (w *GatedWriter) Flush()
Flush tells the GatedWriter to flush any buffered data and to stop buffering.
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer is used to wrap an Agent and expose various API's in a RESTful manner
func NewHTTPServer ¶
func NewHTTPServer(agent *Agent, uiDir string, enableDebug bool, logOutput io.Writer, bind string) (*HTTPServer, error)
NewHTTPServer starts a new HTTP server to provide an interface to the agent.
func (*HTTPServer) AgentCheckFail ¶
func (s *HTTPServer) AgentCheckFail(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AgentCheckPass ¶
func (s *HTTPServer) AgentCheckPass(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AgentCheckWarn ¶
func (s *HTTPServer) AgentCheckWarn(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AgentChecks ¶
func (s *HTTPServer) AgentChecks(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AgentDeregisterCheck ¶
func (s *HTTPServer) AgentDeregisterCheck(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AgentDeregisterService ¶
func (s *HTTPServer) AgentDeregisterService(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AgentForceLeave ¶
func (s *HTTPServer) AgentForceLeave(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AgentJoin ¶
func (s *HTTPServer) AgentJoin(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AgentMembers ¶
func (s *HTTPServer) AgentMembers(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AgentRegisterCheck ¶
func (s *HTTPServer) AgentRegisterCheck(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AgentRegisterService ¶
func (s *HTTPServer) AgentRegisterService(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AgentSelf ¶ added in v0.3.0
func (s *HTTPServer) AgentSelf(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) AgentServices ¶
func (s *HTTPServer) AgentServices(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) CatalogDatacenters ¶
func (s *HTTPServer) CatalogDatacenters(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) CatalogDeregister ¶
func (s *HTTPServer) CatalogDeregister(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) CatalogNodeServices ¶
func (s *HTTPServer) CatalogNodeServices(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) CatalogNodes ¶
func (s *HTTPServer) CatalogNodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) CatalogRegister ¶
func (s *HTTPServer) CatalogRegister(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) CatalogServiceNodes ¶
func (s *HTTPServer) CatalogServiceNodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) CatalogServices ¶
func (s *HTTPServer) CatalogServices(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) HealthChecksInState ¶
func (s *HTTPServer) HealthChecksInState(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) HealthNodeChecks ¶
func (s *HTTPServer) HealthNodeChecks(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) HealthServiceChecks ¶
func (s *HTTPServer) HealthServiceChecks(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) HealthServiceNodes ¶
func (s *HTTPServer) HealthServiceNodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) Index ¶
func (s *HTTPServer) Index(resp http.ResponseWriter, req *http.Request)
Renders a simple index page
func (*HTTPServer) KVSDelete ¶
func (s *HTTPServer) KVSDelete(resp http.ResponseWriter, req *http.Request, args *structs.KeyRequest) (interface{}, error)
KVSPut handles a DELETE request
func (*HTTPServer) KVSEndpoint ¶
func (s *HTTPServer) KVSEndpoint(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) KVSGet ¶
func (s *HTTPServer) KVSGet(resp http.ResponseWriter, req *http.Request, args *structs.KeyRequest) (interface{}, error)
KVSGet handles a GET request
func (*HTTPServer) KVSGetKeys ¶ added in v0.2.0
func (s *HTTPServer) KVSGetKeys(resp http.ResponseWriter, req *http.Request, args *structs.KeyRequest) (interface{}, error)
KVSGetKeys handles a GET request for keys
func (*HTTPServer) KVSPut ¶
func (s *HTTPServer) KVSPut(resp http.ResponseWriter, req *http.Request, args *structs.KeyRequest) (interface{}, error)
KVSPut handles a PUT request
func (*HTTPServer) SessionCreate ¶ added in v0.3.0
func (s *HTTPServer) SessionCreate(resp http.ResponseWriter, req *http.Request) (interface{}, error)
SessionCreate is used to create a new session
func (*HTTPServer) SessionDestroy ¶ added in v0.3.0
func (s *HTTPServer) SessionDestroy(resp http.ResponseWriter, req *http.Request) (interface{}, error)
SessionDestroy is used to destroy an existing session
func (*HTTPServer) SessionGet ¶ added in v0.3.0
func (s *HTTPServer) SessionGet(resp http.ResponseWriter, req *http.Request) (interface{}, error)
SessionGet is used to get info for a particular session
func (*HTTPServer) SessionList ¶ added in v0.3.0
func (s *HTTPServer) SessionList(resp http.ResponseWriter, req *http.Request) (interface{}, error)
SessionList is used to list all the sessions
func (*HTTPServer) SessionsForNode ¶ added in v0.3.0
func (s *HTTPServer) SessionsForNode(resp http.ResponseWriter, req *http.Request) (interface{}, error)
SessionsForNode returns all the nodes belonging to a node
func (*HTTPServer) Shutdown ¶
func (s *HTTPServer) Shutdown()
Shutdown is used to shutdown the HTTP server
func (*HTTPServer) StatusLeader ¶
func (s *HTTPServer) StatusLeader(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) StatusPeers ¶
func (s *HTTPServer) StatusPeers(resp http.ResponseWriter, req *http.Request) (interface{}, error)
func (*HTTPServer) UINodeInfo ¶ added in v0.2.0
func (s *HTTPServer) UINodeInfo(resp http.ResponseWriter, req *http.Request) (interface{}, error)
UINodeInfo is used to get info on a single node in a given datacenter. We return a NodeInfo which provides overview information for the node
func (*HTTPServer) UINodes ¶ added in v0.2.0
func (s *HTTPServer) UINodes(resp http.ResponseWriter, req *http.Request) (interface{}, error)
UINodes is used to list the nodes in a given datacenter. We return a NodeDump which provides overview information for all the nodes
func (*HTTPServer) UIServices ¶ added in v0.2.0
func (s *HTTPServer) UIServices(resp http.ResponseWriter, req *http.Request) (interface{}, error)
UIServices is used to list the services in a given datacenter. We return a ServiceSummary which provides overview information for the service
type LogHandler ¶
type LogHandler interface {
HandleLog(string)
}
LogHandler interface is used for clients that want to subscribe to logs, for example to stream them over an IPC mechanism
type PortConfig ¶
type PortConfig struct { DNS int // DNS Query interface HTTP int // HTTP API RPC int // CLI RPC SerfLan int `mapstructure:"serf_lan"` // LAN gossip (Client + Server) SerfWan int `mapstructure:"serf_wan"` // WAN gossip (Server onlyg) Server int // Server internal RPC }
Ports is used to simplify the configuration by providing default ports, and allowing the addresses to only be specified once
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
RPCClient is the RPC client to make requests to the agent RPC.
func NewRPCClient ¶
NewRPCClient is used to create a new RPC client given the address. This will properly dial, handshake, and start listening
func (*RPCClient) ForceLeave ¶
ForceLeave is used to ask the agent to issue a leave command for a given node
func (*RPCClient) LANMembers ¶
LANMembers is used to fetch a list of known members
func (*RPCClient) Stop ¶
func (c *RPCClient) Stop(handle StreamHandle) error
Stop is used to unsubscribe from logs or event streams
func (*RPCClient) WANMembers ¶
WANMembers is used to fetch a list of known members
type ServiceDefinition ¶
ServiceDefinition is used to JSON decode the Service definitions
func DecodeServiceDefinition ¶
func DecodeServiceDefinition(raw interface{}) (*ServiceDefinition, error)
DecodeServiceDefinition is used to decode a service definition
func (*ServiceDefinition) CheckType ¶
func (s *ServiceDefinition) CheckType() *CheckType
func (*ServiceDefinition) NodeService ¶
func (s *ServiceDefinition) NodeService() *structs.NodeService
type ServiceSummary ¶ added in v0.2.0
type ServiceSummary struct { Name string Nodes []string ChecksPassing int ChecksWarning int ChecksCritical int }
ServiceSummary is used to summarize a service
type StreamHandle ¶
type StreamHandle uint64
StreamHandle is an opaque handle passed to stop to stop streaming
type SyslogWrapper ¶ added in v0.3.0
type SyslogWrapper struct {
// contains filtered or unexported fields
}
SyslogWrapper is used to cleaup log messages before writing them to a Syslogger. Implements the io.Writer interface.
Source Files ¶
- agent.go
- agent_endpoint.go
- catalog_endpoint.go
- check.go
- command.go
- config.go
- dns.go
- flag_slice_value.go
- gated_writer.go
- health_endpoint.go
- http.go
- kvs_endpoint.go
- local.go
- log_levels.go
- log_writer.go
- rpc.go
- rpc_client.go
- rpc_log_stream.go
- session_endpoint.go
- status_endpoint.go
- structs.go
- syslog.go
- ui_endpoint.go
- util.go