flant / ovpn-admin

Simple web UI to manage OpenVPN users.
Apache License 2.0
1.39k stars 261 forks source link

Better Prometheus metrics #139

Open ziXet opened 2 years ago

ziXet commented 2 years ago

Hi,

Thanks for your awesome work.

I have a suggestion regarding the Prometheus metrics. I would like to know what's the VPN IP of each client's public ip.

So, I see these two in the /mertrics: ovpn_client_connection_info ovpn_client_connection_from

one of them gives me the local VPN IP address and the other one gives me the public IP address of the client.

The issue is that, we allow duplicate-cn which means with one client profile, you can have multiple clients connecting to the VPN server. So, I cannot join these two metrics to find which public IP belongs to which connected VPN IP.

On the other hand, I can retrive the following from the openvpn-status.log

Virtual Address,Common Name,Real Address,Last Ref
10.8.0.5,client,74.198.xxx.xxx:20140,Thu Sep  1 18:37:42 2022
10.8.0.2,client,198.84.xxx.xxx:58994,Thu Sep  1 17:31:50 2022

This clearly shows me the relation beween the public IP address of the client and its assigned VPN IP in the network.

So, I believe some changes in the /metrics can solve this issue.

Let me know if more clarification is needed.

Thanks.