feat: Ability to override commands args

In order to override the arguments which are used e.g. to call smartctl, they need to be bind to the respective environment variable.
pull/619/head
Martin Kleine 1 month ago committed by GitHub
parent 5977f7c7d4
commit b2b8299bdf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -48,6 +48,16 @@ func (c *configuration) Init() error {
c.SetDefault("commands.metrics_info_args", "--info --json")
c.SetDefault("commands.metrics_smart_args", "--xall --json")
// Bind environment variables with COLLECTOR_ prefix
c.BindEnv("host.id", "COLLECTOR_HOST_ID")
c.BindEnv("log.level", "COLLECTOR_LOG_LEVEL")
c.BindEnv("log.file", "COLLECTOR_LOG_FILE")
c.BindEnv("api.endpoint", "COLLECTOR_API_ENDPOINT")
c.BindEnv("commands.metrics_smartctl_bin", "COLLECTOR_COMMANDS_METRICS_SMARTCTL_BIN")
c.BindEnv("commands.metrics_scan_args", "COLLECTOR_COMMANDS_METRICS_SCAN_ARGS")
c.BindEnv("commands.metrics_info_args", "COLLECTOR_COMMANDS_METRICS_INFO_ARGS")
c.BindEnv("commands.metrics_smart_args", "COLLECTOR_COMMANDS_METRICS_SMART_ARGS")
//c.SetDefault("collect.short.command", "-a -o on -S on")
//if you want to load a non-standard location system config file (~/drawbridge.yml), use ReadConfig

Loading…
Cancel
Save