blob: ba21ddc4050302d0c84a091123cae8d089d9a418 [file] [log] [blame]
package main
import (
"log"
"os"
"time"
"github.com/jbub/pgbouncer_exporter/cmd"
"github.com/jbub/pgbouncer_exporter/collector"
_ "github.com/lib/pq"
"github.com/prometheus/common/version"
"github.com/urfave/cli"
)
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.DurationFlag{
Name: "store-timeout",
Usage: "Per method store timeout.",
EnvVars: []string{"STORE_TIMEOUT"},
Value: time.Second * 2,
},
},
Commands: []*cli.Command{
cmd.Server,
},
Version: version.Info(),
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}