Allow setting the session timeout
Now that we have a good config framework in place, this is low-hanging fruit. Will apply to all collectors used, so total scrape time for Prometheus could be (timeout * #-of-collectors) milliseconds for a given module. Related to #20.
This commit is contained in:
parent
0c4d5f0ea2
commit
a4a57fe40b
|
@ -187,6 +187,10 @@ func freeipmiConfig(config IPMIConfig) string {
|
||||||
if config.Password != "" {
|
if config.Password != "" {
|
||||||
fmt.Fprintf(&b, "password %s\n", config.Password)
|
fmt.Fprintf(&b, "password %s\n", config.Password)
|
||||||
}
|
}
|
||||||
|
if config.Timeout != 0 {
|
||||||
|
fmt.Fprintf(&b, "session-timeout %d\n", config.Timeout)
|
||||||
|
}
|
||||||
|
fmt.Println(b.String())
|
||||||
return b.String()
|
return b.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ type IPMIConfig struct {
|
||||||
Password string `yaml:"pass"`
|
Password string `yaml:"pass"`
|
||||||
Privilege string `yaml:"privilege"`
|
Privilege string `yaml:"privilege"`
|
||||||
Driver string `yaml:"driver"`
|
Driver string `yaml:"driver"`
|
||||||
|
Timeout uint32 `yaml:"timeout"`
|
||||||
Collectors []string `yaml:"collectors"`
|
Collectors []string `yaml:"collectors"`
|
||||||
ExcludeSensorIDs []int64 `yaml:"exclude_sensor_ids"`
|
ExcludeSensorIDs []int64 `yaml:"exclude_sensor_ids"`
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,14 @@ modules:
|
||||||
# module=default is specified.
|
# module=default is specified.
|
||||||
user: "default_user"
|
user: "default_user"
|
||||||
pass: "example_pw"
|
pass: "example_pw"
|
||||||
|
# The below settings correspond to driver-type, privilege-level, and
|
||||||
|
# session-timeout respectively, see `man 5 freeipmi.conf`.
|
||||||
driver: "LAN_2_0"
|
driver: "LAN_2_0"
|
||||||
privilege: "user"
|
privilege: "user"
|
||||||
|
# The session timeout is in milliseconds. Note that a scrape can take up
|
||||||
|
# to (session-timeout * #-of-collectors) milliseconds, so set the scrape
|
||||||
|
# timeout in Prometheus accordingly.
|
||||||
|
timeout: 10000
|
||||||
# Available collectors are bmc, ipmi, and dcmi
|
# Available collectors are bmc, ipmi, and dcmi
|
||||||
# If not specified, all three are used
|
# If not specified, all three are used
|
||||||
collectors:
|
collectors:
|
||||||
|
|
Loading…
Reference in New Issue