-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
36 lines (33 loc) · 1.57 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
package main
import (
"github.com/prometheus/common/log"
"gopkg.in/alecthomas/kingpin.v2"
"github.com/prometheus/common/version"
"time"
)
func main() {
var (
listenAddress = kingpin.Flag("web.listen-address", "Address on which to expose metrics and web interface.").Default(":9483").String()
serviceName = kingpin.Flag("web.service-name", "service name to run cloudwatch/prometheus").Enum("cloudwatch", "prometheus")
prestoHost = kingpin.Flag("web.presto-host", "presto host").Default("localhost").String()
prestoPort = kingpin.Flag("web.presto-port", "presto port").Default("8080").String()
stackName = kingpin.Flag("web.stack-name", "presto stack name").Default("atlan-local-test-presto-stack").String()
cloudWatchNamespace = kingpin.Flag("web.cloudwatch-namespace", "cloudwatch namespace").Default("presto").String()
apiPrefix = kingpin.Flag("web.api-prefix", "API prefix to use for making requests to presto").Default("v1/").String()
cloudwatchRegion = kingpin.Flag("web.cloudwatch-region", "cloudwatch region").Default("ap-south-1").String()
)
log.AddFlags(kingpin.CommandLine)
kingpin.Version(version.Print("presto_exporter"))
kingpin.HelpFlag.Short('h')
kingpin.Parse()
if *serviceName == "cloudwatch" {
for {
cloudwatchAgentStart(*prestoHost, *prestoPort, *cloudWatchNamespace, *stackName, *apiPrefix, *cloudwatchRegion)
time.Sleep(10 * time.Second)
}
} else {
if *serviceName == "prometheus" {
prometheusExporterStart(*prestoHost, *prestoPort, *stackName, *listenAddress, *apiPrefix)
}
}
}