common

package
v0.0.0-...-c638bfa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2024 License: MIT-0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CatCommand              = "cat "
	AppOwnerCommand         = "ps -u -p "
	ConfigOutputPath        = "/opt/aws/amazon-cloudwatch-agent/bin/config.json"
	Namespace               = "CWAgent"
	Host                    = "host"
	AgentLogFile            = "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log"
	InstallAgentVersionPath = "/opt/aws/amazon-cloudwatch-agent/bin/CWAGENT_VERSION"
)

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(pathIn string, pathOut string)

func CreateWindowsEvent

func CreateWindowsEvent(eventLogName string, eventLogLevel string, msg string) error

func DeleteFile

func DeleteFile(filePathAbsolute string) error

func GenerateLogConfig

func GenerateLogConfig(numberMonitoredLogs int, filePath string) error

GenerateLogConfig takes the number of logs to be monitored and applies it to the supplied config, It writes logs to be monitored of the form /tmp/testNUM.log where NUM is from 1 to number of logs requested to the supplied configuration DEFAULT CONFIG MUST BE SUPPLIED WITH AT LEAST ONE LOG BEING MONITORED (log being monitored will be overwritten - it is needed for json structure) returns the path of the config generated and a list of log stream names

func GenerateLogs

func GenerateLogs(configFilePath string, duration time.Duration, sendingInterval time.Duration, logLinesPerMinute int, validationLog []models.LogValidation) error

func GenerateWindowsEvents

func GenerateWindowsEvents(validationLog []models.LogValidation) error

func InstallAgent

func InstallAgent(installerFilePath string) error

InstallAgent can determine the package manager based on the installer suffix.

func ReadAgentLogfile

func ReadAgentLogfile(logfile string) string

func RecreateAgentLogfile

func RecreateAgentLogfile(logfile string)

func ReplaceLocalStackHostName

func ReplaceLocalStackHostName(pathIn string)

func RunAsyncCommand

func RunAsyncCommand(cmd string) error

func RunCommand

func RunCommand(cmd string) (string, error)

func RunCommands

func RunCommands(commands []string) error

func RunShellScript

func RunShellScript(path string, args ...string) (string, error)

func SendCollectDMetrics

func SendCollectDMetrics(metricPerInterval int, sendingInterval, duration time.Duration) error

func SendEMFMetrics

func SendEMFMetrics(metricPerInterval int, metricLogGroup, metricNamespace string, sendingInterval, duration time.Duration) error

func SendStatsdMetrics

func SendStatsdMetrics(metricPerInterval int, metricDimension []string, sendingInterval, duration time.Duration) error

func StartAgent

func StartAgent(configOutputPath string, fatalOnFailure bool, ssm bool) error

func StartAgentWithCommand

func StartAgentWithCommand(configOutputPath string, fatalOnFailure bool, ssm bool, agentStartCommand string) error

func StartLogWrite

func StartLogWrite(configFilePath string, duration time.Duration, sendingInterval time.Duration, logLinesPerMinute int) error

StartLogWrite starts go routines to write logs to each of the logs that are monitored by CW Agent according to the config provided

func StartSendingMetrics

func StartSendingMetrics(receiver string, duration, sendingInterval time.Duration, metricPerInterval int, metricLogGroup, metricNamespace string) (err error)

StartSendingMetrics will generate metrics load based on the receiver (e.g 5000 statsd metrics per minute)

func StopAgent

func StopAgent()

func TouchFile

func TouchFile(filePathAbsolute string) error

func UninstallAgent

func UninstallAgent(pm PackageManager) error

Types

type PackageManager

type PackageManager int
const (
	RPM PackageManager = iota
	DEB
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL