Documentation ¶
Index ¶
- Constants
- func AccessLogs(p *proto.NginxConfig) map[string]string
- func CheckForProcesses(processesToCheck []string) ([]string, error)
- func ErrorLogs(p *proto.NginxConfig) map[string]string
- func FileExists(filePath string) (bool, error)
- func FilesExists(filePaths []string) (bool, error)
- func GenerateNginxID(format string, a ...interface{}) string
- func SliceContainsString(slice []string, toFind string) (bool, int)
- func ValidateMessages(t *testing.T, messagePipe *MockMessagePipe, msgTopics []string)
- type ConfigApplyMarker
- type Environment
- type EnvironmentType
- func (env *EnvironmentType) DiskDevices() ([]string, error)
- func (env *EnvironmentType) FileStat(path string) (os.FileInfo, error)
- func (env *EnvironmentType) GetContainerID() (string, error)
- func (env *EnvironmentType) GetHostname() string
- func (env *EnvironmentType) GetNetOverflow() (float64, error)
- func (env *EnvironmentType) GetSystemUUID() string
- func (env *EnvironmentType) IsContainer() bool
- func (env *EnvironmentType) NewHostInfo(agentVersion string, tags *[]string, configDirs string, clearCache bool) *proto.HostInfo
- func (env *EnvironmentType) Processes() (result []Process)
- func (env *EnvironmentType) ReadDirectory(dir string, ext string) ([]string, error)
- func (env *EnvironmentType) WriteFiles(backup ConfigApplyMarker, files []*proto.File, confPath string, ...) error
- type Info
- type Message
- type MessagePipe
- type MessagePipeInterface
- type MockMessagePipe
- func (p *MockMessagePipe) ClearMessages()
- func (p *MockMessagePipe) Context() context.Context
- func (p *MockMessagePipe) GetMessages() []*Message
- func (p *MockMessagePipe) GetPlugins() []Plugin
- func (p *MockMessagePipe) GetProcessedMessages() []*Message
- func (p *MockMessagePipe) Process(msgs ...*Message)
- func (p *MockMessagePipe) Register(size int, plugin ...Plugin) error
- func (p *MockMessagePipe) Run()
- func (p *MockMessagePipe) RunWithoutInit()
- type NginxBinary
- type NginxBinaryType
- func (n *NginxBinaryType) GetAccessLogs() map[string]string
- func (n *NginxBinaryType) GetChildProcesses() map[string][]*proto.NginxDetails
- func (n *NginxBinaryType) GetErrorLogs() map[string]string
- func (n *NginxBinaryType) GetNginxDetailsByID(nginxID string) *proto.NginxDetails
- func (n *NginxBinaryType) GetNginxDetailsFromProcess(nginxProcess Process) *proto.NginxDetails
- func (n *NginxBinaryType) GetNginxDetailsMapFromProcesses(nginxProcesses []Process) map[string]*proto.NginxDetails
- func (n *NginxBinaryType) GetNginxIDForProcess(nginxProcess Process) string
- func (n *NginxBinaryType) ReadConfig(confFile, nginxId, systemId string) (*proto.NginxConfig, error)
- func (n *NginxBinaryType) Reload(processId, bin string) error
- func (n *NginxBinaryType) SkipLog(filename string) bool
- func (n *NginxBinaryType) Start(nginxId, bin string) error
- func (n *NginxBinaryType) Stop(processId, bin string) error
- func (n *NginxBinaryType) UpdateLogs(existingLogs map[string]string, newLogs map[string]string) bool
- func (n *NginxBinaryType) UpdateNginxDetailsFromProcesses(nginxProcesses []Process)
- func (n *NginxBinaryType) ValidateConfig(processId, bin, configLocation string, config *proto.NginxConfig, ...) error
- func (n *NginxBinaryType) WriteConfig(config *proto.NginxConfig) (*sdk.ConfigApply, error)
- type Payload
- type Plugin
- type Process
Constants ¶
const ( MessageQueueSize = 100 MaxPlugins = 100 )
const ( UNKNOWN = "unknown" RegistrationPrefix = "registration." RegistrationCompletedTopic = RegistrationPrefix + "completed" RegisterWithDataplaneSoftwareDetails = RegistrationPrefix + "with.dataplane.software.details" CommNginxConfig = "nginx.config" NginxConfigUpload = "nginx.config.upload" NginxReload = "nginx.reload" NginxReloadComplete = "nginx.reload.complete" NginxStart = "nginx.start" NginxStop = "nginx.stop" NginxPluginConfigured = "nginx.plugin.config" NginxStatusAPIUpdate = "nginx.status.api.update" NginxInstancesFound = "nginx.instances.found" NginxMasterProcCreated = "nginx.master.created" NginxMasterProcKilled = "nginx.master.killed" NginxWorkerProcCreated = "nginx.worker.created" NginxWorkerProcKilled = "nginx.worker.killed" NginxDetailProcUpdate = "nginx.proc.update" NginxConfigValidationPending = "nginx.config.validation.pending" NginxConfigValidationFailed = "nginx.config.validation.failed" NginxConfigValidationSucceeded = "nginx.config.validation.succeeded" NginxConfigApplyFailed = "nginx.config.apply.failed" NginxConfigApplySucceeded = "nginx.config.apply.succeeded" CommPrefix = "comms." CommStatus = CommPrefix + "status" CommMetrics = CommPrefix + "metrics" CommRegister = CommPrefix + "register" CommResponse = CommPrefix + "response" AgentStarted = "agent.started" AgentConnected = "agent.connected" AgentConfig = "agent.config" AgentConfigChanged = "agent.config.changed" AgentCollectorsUpdate = "agent.collectors.update" MetricReport = "metrics.report" LoggerPrefix = "logger." LoggerLevel = LoggerPrefix + "level" LoggerPath = LoggerPrefix + "path" DataplaneChanged = "dataplane.changed" DataplaneFilesChanged = "dataplane.fileschanged" Events = "events" FileWatcherEnabled = "file.watcher.enabled" ConfigRollbackResponse = "config.rollback.response" DataplaneSoftwareDetailsUpdated = "dataplane.software.details.updated" EnableExtension = "enable.extension" AgentAPIConfigApplyResponse = "agent.api.config.apply.response" )
Variables ¶
This section is empty.
Functions ¶
func AccessLogs ¶
func AccessLogs(p *proto.NginxConfig) map[string]string
AccessLogs returns a list of access logs in the config
func CheckForProcesses ¶
CheckForProcesses takes in a slice of strings that represents the process names to check for then returns a slice of strings of the processes that were checked for and NOT found.
func ErrorLogs ¶
func ErrorLogs(p *proto.NginxConfig) map[string]string
ErrorLogs returns a list of error logs in the config
func FileExists ¶
FileExists determines if the specified file given by the file path exists on the system. If the file does NOT exist on the system the bool will be false and the error will be nil, if the error is not nil then it's possible the file might exist but an error verifying it's existence has occurred.
func FilesExists ¶
FilesExists determines if the specified set of files exists on the system. If any of the files do NOT exist on the system the bool will be false and the error will be nil, if the error is not nil then it's possible the files might exist but an error verifying their existence has occurred.
func GenerateNginxID ¶
GenerateNginxID used to get the NGINX ID
func SliceContainsString ¶
SliceContainsString takes in a slice of strings and a string to check for within the supplied slice of strings, then returns a bool indicating if the the specified string was found and the index where it was found. If the specified string was not found then the index returned is -1.
func ValidateMessages ¶
func ValidateMessages(t *testing.T, messagePipe *MockMessagePipe, msgTopics []string)
Types ¶
type ConfigApplyMarker ¶
type Environment ¶
type Environment interface { NewHostInfo(agentVersion string, tags *[]string, configDirs string, clearCache bool) *proto.HostInfo GetHostname() (hostname string) GetSystemUUID() (hostId string) ReadDirectory(dir string, ext string) ([]string, error) WriteFiles(backup ConfigApplyMarker, files []*proto.File, prefix string, allowedDirs map[string]struct{}) error Processes() (result []Process) FileStat(path string) (os.FileInfo, error) DiskDevices() ([]string, error) GetContainerID() (string, error) GetNetOverflow() (float64, error) IsContainer() bool }
type EnvironmentType ¶
type EnvironmentType struct {
// contains filtered or unexported fields
}
func (*EnvironmentType) DiskDevices ¶
func (env *EnvironmentType) DiskDevices() ([]string, error)
DiskDevices returns a list of Disk Devices known by the system. Loop and other virtual devices are filtered out
func (*EnvironmentType) FileStat ¶
func (env *EnvironmentType) FileStat(path string) (os.FileInfo, error)
func (*EnvironmentType) GetContainerID ¶
func (env *EnvironmentType) GetContainerID() (string, error)
GetContainerID returns the ID of the current environment if running in a container
func (*EnvironmentType) GetHostname ¶
func (env *EnvironmentType) GetHostname() string
func (*EnvironmentType) GetNetOverflow ¶
func (env *EnvironmentType) GetNetOverflow() (float64, error)
func (*EnvironmentType) GetSystemUUID ¶
func (env *EnvironmentType) GetSystemUUID() string
func (*EnvironmentType) IsContainer ¶
func (env *EnvironmentType) IsContainer() bool
func (*EnvironmentType) NewHostInfo ¶
func (*EnvironmentType) Processes ¶
func (env *EnvironmentType) Processes() (result []Process)
Processes returns a slice of nginx master and nginx worker processes currently running
func (*EnvironmentType) ReadDirectory ¶
func (env *EnvironmentType) ReadDirectory(dir string, ext string) ([]string, error)
func (*EnvironmentType) WriteFiles ¶
func (env *EnvironmentType) WriteFiles(backup ConfigApplyMarker, files []*proto.File, confPath string, allowedDirs map[string]struct{}) error
type MessagePipe ¶
type MessagePipe struct {
// contains filtered or unexported fields
}
func NewMessagePipe ¶
func NewMessagePipe(ctx context.Context) *MessagePipe
func (*MessagePipe) Cancel ¶
func (p *MessagePipe) Cancel() context.CancelFunc
func (*MessagePipe) Context ¶
func (p *MessagePipe) Context() context.Context
func (*MessagePipe) GetPlugins ¶
func (p *MessagePipe) GetPlugins() []Plugin
func (*MessagePipe) Process ¶
func (p *MessagePipe) Process(messages ...*Message)
func (*MessagePipe) Run ¶
func (p *MessagePipe) Run()
type MessagePipeInterface ¶
type MockMessagePipe ¶
type MockMessagePipe struct {
// contains filtered or unexported fields
}
MockMessagePipe is a mock message pipe
func NewMockMessagePipe ¶
func NewMockMessagePipe(ctx context.Context) *MockMessagePipe
func SetupMockMessagePipe ¶
func (*MockMessagePipe) ClearMessages ¶
func (p *MockMessagePipe) ClearMessages()
func (*MockMessagePipe) Context ¶
func (p *MockMessagePipe) Context() context.Context
func (*MockMessagePipe) GetMessages ¶
func (p *MockMessagePipe) GetMessages() []*Message
func (*MockMessagePipe) GetPlugins ¶
func (p *MockMessagePipe) GetPlugins() []Plugin
func (*MockMessagePipe) GetProcessedMessages ¶
func (p *MockMessagePipe) GetProcessedMessages() []*Message
func (*MockMessagePipe) Process ¶
func (p *MockMessagePipe) Process(msgs ...*Message)
func (*MockMessagePipe) Register ¶
func (p *MockMessagePipe) Register(size int, plugin ...Plugin) error
func (*MockMessagePipe) Run ¶
func (p *MockMessagePipe) Run()
func (*MockMessagePipe) RunWithoutInit ¶
func (p *MockMessagePipe) RunWithoutInit()
type NginxBinary ¶
type NginxBinary interface { Start(nginxId, bin string) error Stop(processId, bin string) error Reload(processId, bin string) error ValidateConfig(processId, bin, configLocation string, config *proto.NginxConfig, configApply *sdk.ConfigApply) error GetNginxDetailsFromProcess(nginxProcess Process) *proto.NginxDetails GetNginxDetailsByID(nginxID string) *proto.NginxDetails GetNginxIDForProcess(nginxProcess Process) string GetNginxDetailsMapFromProcesses(nginxProcesses []Process) map[string]*proto.NginxDetails UpdateNginxDetailsFromProcesses(nginxProcesses []Process) WriteConfig(config *proto.NginxConfig) (*sdk.ConfigApply, error) ReadConfig(path, nginxId, systemId string) (*proto.NginxConfig, error) UpdateLogs(existingLogs map[string]string, newLogs map[string]string) bool GetAccessLogs() map[string]string GetErrorLogs() map[string]string GetChildProcesses() map[string][]*proto.NginxDetails }
type NginxBinaryType ¶
type NginxBinaryType struct {
// contains filtered or unexported fields
}
func NewNginxBinary ¶
func NewNginxBinary(env Environment, config *config.Config) *NginxBinaryType
func (*NginxBinaryType) GetAccessLogs ¶ added in v2.20.0
func (n *NginxBinaryType) GetAccessLogs() map[string]string
func (*NginxBinaryType) GetChildProcesses ¶
func (n *NginxBinaryType) GetChildProcesses() map[string][]*proto.NginxDetails
func (*NginxBinaryType) GetErrorLogs ¶ added in v2.20.0
func (n *NginxBinaryType) GetErrorLogs() map[string]string
func (*NginxBinaryType) GetNginxDetailsByID ¶
func (n *NginxBinaryType) GetNginxDetailsByID(nginxID string) *proto.NginxDetails
func (*NginxBinaryType) GetNginxDetailsFromProcess ¶
func (n *NginxBinaryType) GetNginxDetailsFromProcess(nginxProcess Process) *proto.NginxDetails
func (*NginxBinaryType) GetNginxDetailsMapFromProcesses ¶
func (n *NginxBinaryType) GetNginxDetailsMapFromProcesses(nginxProcesses []Process) map[string]*proto.NginxDetails
func (*NginxBinaryType) GetNginxIDForProcess ¶
func (n *NginxBinaryType) GetNginxIDForProcess(nginxProcess Process) string
func (*NginxBinaryType) ReadConfig ¶
func (n *NginxBinaryType) ReadConfig(confFile, nginxId, systemId string) (*proto.NginxConfig, error)
func (*NginxBinaryType) Reload ¶
func (n *NginxBinaryType) Reload(processId, bin string) error
Reload NGINX.
func (*NginxBinaryType) SkipLog ¶
func (n *NginxBinaryType) SkipLog(filename string) bool
SkipLog checks if a logfile should be omitted from analysis
func (*NginxBinaryType) Start ¶
func (n *NginxBinaryType) Start(nginxId, bin string) error
Start starts NGINX.
func (*NginxBinaryType) Stop ¶
func (n *NginxBinaryType) Stop(processId, bin string) error
Stop stops an instance of NGINX.
func (*NginxBinaryType) UpdateLogs ¶
func (*NginxBinaryType) UpdateNginxDetailsFromProcesses ¶
func (n *NginxBinaryType) UpdateNginxDetailsFromProcesses(nginxProcesses []Process)
func (*NginxBinaryType) ValidateConfig ¶
func (n *NginxBinaryType) ValidateConfig(processId, bin, configLocation string, config *proto.NginxConfig, configApply *sdk.ConfigApply) error
ValidateConfig tests the config with nginx -t -c configLocation.
func (*NginxBinaryType) WriteConfig ¶
func (n *NginxBinaryType) WriteConfig(config *proto.NginxConfig) (*sdk.ConfigApply, error)