-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
60 lines (56 loc) · 1.17 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package main
import (
"os"
"github.com/urfave/cli"
)
var (
host string
user string
password string
port int
)
func main() {
app := cli.NewApp()
app.Name = "check_mysql"
app.Version = "0.1"
app.Usage = "mysql performance metric collector"
app.Authors = []cli.Author{
cli.Author{
Name: "yingsong",
Email: "wyingsong@163.com",
},
}
app.Copyright = "2011 (c) TalkingData.com"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "host",
Value: "127.0.0.1",
Usage: "Connect to host.",
EnvVar: "mysql_host",
Destination: &host,
},
cli.StringFlag{
Name: "user",
Value: "root",
Usage: "User for login if not current user",
EnvVar: "mysql_user",
Destination: &user,
},
cli.StringFlag{
Name: "password",
Value: "",
Usage: "Password to use when connecting to server.",
EnvVar: "mysql_password",
Destination: &password,
},
cli.IntFlag{
Name: "port",
Value: 3306,
Usage: "Port number to use for connection",
EnvVar: "mysql_port",
Destination: &port,
},
}
app.Action = FetchData
app.Run(os.Args)
}