Added default interval
This commit is contained in:
parent
5c930cd409
commit
f108090967
@ -10,6 +10,13 @@ type AlrmConfig struct {
|
|||||||
Interval time.Duration
|
Interval time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewConfig() *AlrmConfig {
|
||||||
|
return &AlrmConfig{
|
||||||
|
// Default check interval, 30 seconds
|
||||||
|
Interval: time.Second * 30,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (ac *AlrmConfig) NewGroup(name string) (*AlrmGroup, error) {
|
func (ac *AlrmConfig) NewGroup(name string) (*AlrmGroup, error) {
|
||||||
if ac.Groups == nil {
|
if ac.Groups == nil {
|
||||||
ac.Groups = make(map[string]*AlrmGroup)
|
ac.Groups = make(map[string]*AlrmGroup)
|
||||||
|
@ -33,7 +33,7 @@ func (p *Parser) Parse(fn string) (*AlrmConfig, error) {
|
|||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
config := &AlrmConfig{}
|
config := NewConfig()
|
||||||
|
|
||||||
scan := bufio.NewScanner(file)
|
scan := bufio.NewScanner(file)
|
||||||
scan.Split(p.Split)
|
scan.Split(p.Split)
|
||||||
|
Loading…
Reference in New Issue
Block a user