client: add disk_total_mb and disk_free_mb config options (#15852)

This commit is contained in:
Karl Johann Schubert
2023-01-24 15:14:22 +01:00
committed by GitHub
parent ca847a195f
commit 588392cabc
6 changed files with 49 additions and 0 deletions

View File

@@ -668,6 +668,12 @@ func convertClientConfig(agentConfig *Config) (*clientconfig.Config, error) {
if agentConfig.Client.MemoryMB != 0 {
conf.MemoryMB = agentConfig.Client.MemoryMB
}
if agentConfig.Client.DiskTotalMB != 0 {
conf.DiskTotalMB = agentConfig.Client.DiskTotalMB
}
if agentConfig.Client.DiskFreeMB != 0 {
conf.DiskFreeMB = agentConfig.Client.DiskFreeMB
}
if agentConfig.Client.MaxKillTimeout != "" {
dur, err := time.ParseDuration(agentConfig.Client.MaxKillTimeout)
if err != nil {

View File

@@ -227,6 +227,12 @@ type ClientConfig struct {
// MemoryMB is used to override any detected or default total memory.
MemoryMB int `hcl:"memory_total_mb"`
// DiskTotalMB is used to override any detected or default total disk space.
DiskTotalMB int `hcl:"disk_total_mb"`
// DiskFreeMB is used to override any detected or default free disk space.
DiskFreeMB int `hcl:"disk_free_mb"`
// ReservableCores is used to override detected reservable cpu cores.
ReserveableCores string `hcl:"reservable_cores"`
@@ -2006,6 +2012,12 @@ func (a *ClientConfig) Merge(b *ClientConfig) *ClientConfig {
if b.MemoryMB != 0 {
result.MemoryMB = b.MemoryMB
}
if b.DiskTotalMB != 0 {
result.DiskTotalMB = b.DiskTotalMB
}
if b.DiskFreeMB != 0 {
result.DiskFreeMB = b.DiskFreeMB
}
if b.MaxKillTimeout != "" {
result.MaxKillTimeout = b.MaxKillTimeout
}