cloudflare / gortr

The RPKI-to-Router server used at Cloudflare
https://rpki.cloudflare.com
BSD 3-Clause "New" or "Revised" License
309 stars 39 forks source link

Select a unique Prometheus metrics port #91

Open natesales opened 3 years ago

natesales commented 3 years ago

Currently, the default metrics HTTP server is available at :8080 which may conflict with other processes as 8080 is a common HTTP port. Prometheus suggests picking a unique and publicly-documented port (default port allocations are listed on their GitHub wiki) for exporters.

I would be happy to document an available port and submit a PR for this change, but wanted to check in before doing so. Thanks!

stypr commented 2 years ago

Hi,

I got the same issue as yours, and it looks like you can change the metrics port by setting the -metrics.addr option.

Consider reading the gortr.go file https://github.com/cloudflare/gortr/blob/v0.14.7/cmd/gortr/gortr.go#L51-L55

In my example, I've changed to 127.0.0.1:8283 so that it only listens on localhost..

$ cat /etc/default/gortr 
# Run "gortr -h" to see the available command line options and their
# defaults.
#
# Other useful resources are https://github.com/cloudflare/gortr and
# https://github.com/cloudflare/cfrpki .

GORTR_ARGS=-bind 127.0.0.1:8282 -metrics.addr 127.0.0.1:8283 -verify.key /etc/cf.pub -cache https://rpki.cloudflare.com:443/rpki.json 

$ service gortr restart
$ netstat -tulpn | grep gortr
tcp        0      0 127.0.0.1:8282          0.0.0.0:*               LISTEN      16656/gortr         
tcp        0      0 127.0.0.1:8283          0.0.0.0:*               LISTEN      16656/gortr