forked from jbub/pgbouncer_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
91 lines (86 loc) · 2.01 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package main
import (
"log"
"os"
"time"
"github.com/jbub/pgbouncer_exporter/cmd"
"github.com/jbub/pgbouncer_exporter/internal/collector"
_ "github.com/lib/pq"
"github.com/prometheus/common/version"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Name: collector.Name,
Usage: collector.Name,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "web.listen-address",
Usage: "Address on which to expose metrics and web interface.",
EnvVars: []string{"WEB_LISTEN_ADDRESS"},
Value: ":9127",
},
&cli.StringFlag{
Name: "web.telemetry-path",
Usage: "Path under which to expose metrics.",
EnvVars: []string{"WEB_TELEMETRY_PATH"},
Value: "/metrics",
},
&cli.StringFlag{
Name: "database-url",
Usage: "Database connection url.",
EnvVars: []string{"DATABASE_URL"},
},
&cli.BoolFlag{
Name: "export-stats",
Usage: "Export stats.",
EnvVars: []string{"EXPORT_STATS"},
Value: true,
},
&cli.BoolFlag{
Name: "export-pools",
Usage: "Export pools.",
EnvVars: []string{"EXPORT_POOLS"},
Value: true,
},
&cli.BoolFlag{
Name: "export-databases",
Usage: "Export databases.",
EnvVars: []string{"EXPORT_DATABASES"},
Value: true,
},
&cli.BoolFlag{
Name: "export-lists",
Usage: "Export lists.",
EnvVars: []string{"EXPORT_LISTS"},
Value: true,
},
&cli.BoolFlag{
Name: "export-servers",
Usage: "Export servers.",
EnvVars: []string{"EXPORT_SERVERS"},
Value: true,
},
&cli.BoolFlag{
Name: "export-clients",
Usage: "Export clients.",
EnvVars: []string{"EXPORT_CLIENTS"},
Value: true,
},
&cli.DurationFlag{
Name: "store-timeout",
Usage: "Per method store timeout.",
EnvVars: []string{"STORE_TIMEOUT"},
Value: time.Second * 2,
},
},
Commands: []*cli.Command{
cmd.Server,
cmd.Health,
},
Version: version.Info(),
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}