parent
6c455764e1
commit
27605997c1
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"Interval": {
|
||||
"OK": "6h0m0s",
|
||||
"Error": "6h"
|
||||
"Error": "6h",
|
||||
"Email": "15m"
|
||||
},
|
||||
"States": [
|
||||
"GA"
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import (
|
|||
|
||||
type Config struct {
|
||||
Interval struct {
|
||||
Email Duration
|
||||
OK Duration
|
||||
Error Duration
|
||||
}
|
||||
|
|
|
|||
17
main.go
17
main.go
|
|
@ -21,16 +21,15 @@ var stateFinder = regexp.MustCompile(`[A-Za-z]+`)
|
|||
func main() {
|
||||
lock := &sync.Mutex{}
|
||||
go func() {
|
||||
c := time.NewTicker(time.Minute)
|
||||
for range c.C {
|
||||
if !config.Get().EmailerEnabled {
|
||||
continue
|
||||
for {
|
||||
if config.Get().EmailerEnabled {
|
||||
lock.Lock()
|
||||
if err := email(); err != nil {
|
||||
log.Print(err)
|
||||
}
|
||||
lock.Unlock()
|
||||
}
|
||||
lock.Lock()
|
||||
if err := email(); err != nil {
|
||||
log.Print(err)
|
||||
}
|
||||
lock.Unlock()
|
||||
time.Sleep(config.Get().Interval.Email.Get())
|
||||
}
|
||||
}()
|
||||
if err := _main(); err != nil {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,10 @@ todo:
|
|||
- banlist criteria like vendors, brokers, metadata
|
||||
- quiet hours
|
||||
- setup pa on element
|
||||
- accept states via element for one system
|
||||
done:
|
||||
- configurable email interval
|
||||
- jitter on intervals, including dedicated err span
|
||||
- email doesnt get all matches
|
||||
- send jobs
|
||||
- read jobs
|
||||
|
|
|
|||
Loading…
Reference in New Issue