Skip to content

Commit

Permalink
add listen addr flag
Browse files Browse the repository at this point in the history
  • Loading branch information
thebinary committed Jul 13, 2020
1 parent e8e2114 commit 734253b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The exporter can be started with:
./flow-exporter --brokers=kafka.fqdn.com:9092 --topic=pmacct.acct --asn=15169
```

- `--addr`: Listening address (default = :9590)
- `--brokers`: A comma separated list of Kafka brokers (with their corresponding ports) to consume flows from
- `--topic`: The Kafka topic to consume flows from
- `--asn`: The autonomous system number that the flows are being monitored from
Expand Down
5 changes: 3 additions & 2 deletions cmd/flow-exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var (
topic = flag.String("topic", "", "The Kafka topic to consume from")
partitions = flag.String("partitions", "all", "The partitions to consume, can be 'all' or comma-separated numbers")
asn = flag.Int("asn", 0, "The ASN being monitored")
addr = flag.String("addr", ":9590", "Listening Address")
)

func main() {
Expand All @@ -39,9 +40,9 @@ func main() {
}

go func() {
log.Info("Starting Prometheus web server, available at: http://localhost:9590/metrics")
log.Infof("Starting Prometheus web server, available at: http://%s/metrics", *addr)
http.Handle("/metrics", promhttp.Handler())
http.ListenAndServe(":9590", nil)
http.ListenAndServe(*addr, nil)
}()

consumer.Consume(*brokers, *topic, *partitions, *asn, asns)
Expand Down

0 comments on commit 734253b

Please sign in to comment.