forked from open-falcon/mymon
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
42 lines (36 loc) · 797 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
// MySQL Performance Monitor(For open-falcon)
// Write by coraldane<coraldane@163.com>
package main
import (
"flag"
"fmt"
"github.com/coraldane/mymon/cron"
"github.com/coraldane/mymon/db"
"github.com/coraldane/mymon/g"
log "github.com/cihub/seelog"
"os"
)
func main() {
defer log.Flush()
logger, err := log.LoggerFromConfigAsFile("log.xml")
if err != nil {
log.Critical("err parsing config log file", err)
return
}
log.ReplaceLogger(logger)
cfg := flag.String("c", "cfg.json", "configuration file")
version := flag.Bool("v", false, "show version")
flag.Parse()
if *version {
fmt.Println(g.VERSION)
os.Exit(0)
}
if err := g.ParseConfig(*cfg); err != nil {
log.Error(err)
log.Flush()
os.Exit(0)
}
go db.InitDatabase()
go cron.Heartbeat()
select {}
}