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