Changed interval to duration, added outline for alarm configuration
This commit is contained in:
parent
59971d75d2
commit
5c930cd409
8
alrmrc
8
alrmrc
@ -1,4 +1,10 @@
|
|||||||
set interval 30
|
set interval 30s
|
||||||
|
|
||||||
|
#alarm people email
|
||||||
|
# to test1@localhost
|
||||||
|
# to test2@localhost
|
||||||
|
# smtp localhost
|
||||||
|
# from alrm@localhost
|
||||||
|
|
||||||
monitor group webservers
|
monitor group webservers
|
||||||
host www1.example.com address 10.11.135.101
|
host www1.example.com address 10.11.135.101
|
||||||
|
@ -2,12 +2,12 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AlrmConfig struct {
|
type AlrmConfig struct {
|
||||||
Groups map[string]*AlrmGroup
|
Groups map[string]*AlrmGroup
|
||||||
Interval int
|
Interval time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ac *AlrmConfig) NewGroup(name string) (*AlrmGroup, error) {
|
func (ac *AlrmConfig) NewGroup(name string) (*AlrmGroup, error) {
|
||||||
@ -25,7 +25,7 @@ func (ac *AlrmConfig) NewGroup(name string) (*AlrmGroup, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ac *AlrmConfig) SetInterval(val string) error {
|
func (ac *AlrmConfig) SetInterval(val string) error {
|
||||||
interval, err := strconv.Atoi(val)
|
interval, err := time.ParseDuration(val)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user