-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
42 lines (31 loc) · 981 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"logmonitor-homework/display"
"logmonitor-homework/monitoring"
"flag"
)
var (
//collectionInterval = flag.Int("collection-inteval", 10, "Collection Interval in Seconds")
avgThreshold = flag.Float64("avg-threshold", 10, "Total traffic threshold for alerting (hits/s)")
filename = flag.String("log-filename", "/tmp/access.log", "w3c-formatted HTTP access log to be consumed actively")
)
func main() {
flag.Parse()
cc := make(chan monitoring.Metrics)
ca := make(chan string)
//cs := make(chan float64)
monitoring := &monitoring.HttpLogMonitoring{AlertInterval: 10,
CollectionInterval: 10,
AlertThreshold: *avgThreshold,
CollectionChannel: cc,
AlertChannel: ca,
LogFilename: *filename,
}
go monitoring.Monitor()
dashboard := &display.Dashboard{AlertInterval: 10,
CollectionInterval: 10,
AlertThreshold: *avgThreshold,
CollectionChannel: cc,
AlertChannel: ca}
dashboard.DisplayStart()
}