Can not configuration prometheus listen port

How can i config prometheus listen port on tcp.

This is my /etc/crowdsec/config.yaml

prometheus:
  enabled: true
  level: full
  listen_addr: 0.0.0.0
  listen_port: 6060

But it only listen to tcp6

netstat -tuplen

tcp6       0      0 :::6060                 :::*                    LISTEN      0          46709      12668/crowdsec

I want it listen to 0.0.0.0:6060

I guess to ask the obvious question is port 6060 free on all ipv4 addresses?

Yes, this is all listening port

netstat -tuplen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode      PID/Program name    
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      0          20969      757/rpcbind         
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      0          131963     11584/crowdsec      
tcp        0      0 127.0.0.1:8081          0.0.0.0:*               LISTEN      1000       113009     9591/pprof          
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      0          29989      1552/dnsmasq        
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      0          26418      1211/sshd           
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      0          26860      1215/cupsd          
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      0          29089      1556/master         
tcp        0      0 0.0.0.0:9090            0.0.0.0:*               LISTEN      0          53950      3834/docker-proxy   
tcp6       0      0 :::6060                 :::*                    LISTEN      0          133524     11584/crowdsec      
tcp6       0      0 :::111                  :::*                    LISTEN      0          20972      757/rpcbind         
tcp6       0      0 :::22                   :::*                    LISTEN      0          26429      1211/sshd           
tcp6       0      0 ::1:631                 :::*                    LISTEN      0          26859      1215/cupsd          
tcp6       0      0 ::1:25                  :::*                    LISTEN      0          29090      1556/master         
tcp6       0      0 :::9090                 :::*                    LISTEN      0          53953      3841/docker-proxy 

And crowdsec’s version

crowdsec -version
version: v1.6.2-rpm-pragmatic-amd64-16bfab86
Codename: alphaga
BuildDate: 2024-05-31_09:15:35
GoVersion: 1.22.2
Platform: linux
libre2: C++
User-Agent: crowdsec/v1.6.2-rpm-pragmatic-amd64-16bfab86-linux
Constraint_parser: >= 1.0, <= 3.0
Constraint_scenario: >= 1.0, <= 3.0
Constraint_api: v1
Constraint_acquis: >= 1.0, < 2.0

Hmmm, I cant replicate the issue as mine is 0.0.0.0 and binds to ipv4 and ipv6 as that is intended behaviour. You can maybe try providing an empty string "" but then I dont know how cscli metrics would like that. Plus I guess if you specify a single IPV4 address like you local lan that would also work.

Edit: I dug up an old thread which I remember and it seems for the user they wanted to bind to ipv6 and ipv4 at same time. The only way I found was to put

listen_addr: 0.0.0.0 #-> binds only to ipv4
listen_addr: [::] #-> crashes crowdsec yaml invalid
listen_addr: "[::]" #-> binds to *:6060
# Bottom one seems to work on ipv4 and ipv6
1 Like