mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-25 15:09:05 +01:00
Set default for topprocs collector to Top2 processes if no config is given
This commit is contained in:
parent
f5b7da5046
commit
8d643bb5e8
@ -12,6 +12,7 @@ import (
|
||||
)
|
||||
|
||||
const MAX_NUM_PROCS = 10
|
||||
const DEFAULT_NUM_PROCS = 2
|
||||
|
||||
type TopProcsCollectorConfig struct {
|
||||
num_procs int `json:"num_procs"`
|
||||
@ -32,6 +33,8 @@ func (m *TopProcsCollector) Init(config []byte) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
m.config.num_procs = int(DEFAULT_NUM_PROCS)
|
||||
}
|
||||
if m.config.num_procs <= 0 || m.config.num_procs > MAX_NUM_PROCS {
|
||||
return errors.New(fmt.Sprintf("num_procs option must be set in 'topprocs' config (range: 1-%d)", MAX_NUM_PROCS))
|
||||
|
Loading…
Reference in New Issue
Block a user