VictorRobellini / pfSense-Dashboard

A functional and useful dashboard for pfSense that utilizes influxdb, grafana and telegraf
671 stars 187 forks source link

OpenVPN Interfaces #35

Closed djrarky closed 3 years ago

djrarky commented 3 years ago

Hey mate,

I'm wondering if it's possible to pull ovpn interface's with telegraf_pfinterface.php?

Do you know if it's possible?

Thanks in advance!

bigjohns97 commented 3 years ago

Mine does this by default, no changes needed.

VictorRobellini commented 3 years ago

@bigjohns97 is correct.

djrarky commented 3 years ago

Mine doesn't? Doesn't pull anything for ovpn interfaces. Running 2.4.5

Only interfaces that are pulled are pppoe0, vmx1.40, vmx1.4093.

On Tue, 30 Mar 2021, 02:18 VictorRobellini, @.***> wrote:

@bigjohns97 https://github.com/bigjohns97 is correct.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/VictorRobellini/pfSense-Dashboard/issues/35#issuecomment-809831590, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSVH56JR3KNYIVFCUBIP4TTGERGNANCNFSM4Z7NYDIQ .

djrarky commented 3 years ago

Only interfaces are pppoe0, vmx1.40, vmx1.4093

bigjohns97 commented 3 years ago

I am not sure what this screenshot is supposed to show us.

djrarky commented 3 years ago

It's influxdb measurements.... Obviously doesn't include openvpn interfaces

On Tue, 30 Mar 2021, 14:42 bigjohns97, @.***> wrote:

I am not sure what this screenshot is supposed to show us.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/VictorRobellini/pfSense-Dashboard/issues/35#issuecomment-810258412, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSVH5552S5FFELVS3GDITDTGHINRANCNFSM4Z7NYDIQ .

bigjohns97 commented 3 years ago

Show your vpn interfaces from the pfsense side.

djrarky commented 3 years ago

Yeah, no worries. See attached.

On Tue, 30 Mar 2021, 14:45 bigjohns97, @.***> wrote:

Show your vpn interfaces from the pfsense side.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/VictorRobellini/pfSense-Dashboard/issues/35#issuecomment-810261766, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSVH574EQAXGRPUP57KI23TGHIYPANCNFSM4Z7NYDIQ .

djrarky commented 3 years ago

Screenshot_20210330-145033_Firefox~2 Screenshot_20210330-145135_Firefox~2 Screenshot_20210330-145043_Firefox~2

VictorRobellini commented 3 years ago

Do those interfaces show up under pfsense Status->Interfaces?

I'm not running a server, but my client shows up just fine

bigjohns97 commented 3 years ago

I'm running two servers and they both show up fine. I am not sure why his aren't showing up.

djrarky commented 3 years ago

Do those interfaces show up under pfsense Status->Interfaces?

No, why would they? They're OpenVPN s2s tunnels using OSPF, I've never configured them as pfsense interfaces

VictorRobellini commented 3 years ago

My openvpn interfaces show up in pfSense as well as my Dashboard but I'm not running frr/ospf. In your initial request, you asked if it's possible to pull ovpn interface's with telegraf_pfinterface.php, which is what lead to the confusion. My guess is that the FRR daemon has the data you want, I'm not sure since I've never messed with it. I don't have it set up so I can't do much here. The code that populates the interface measurements uses pfsense PHP calls to pull data. If you find a solution, I'll be more than happy to add it to the dashboard as long as it doesn't impact anything else. Sorry I can't be of more help.

djrarky commented 3 years ago

I appreciate it, thank you. Spent some time on it yesterday and managed to pull the stats from openvpn directly.

On Sun, 11 Apr 2021, 03:00 VictorRobellini, @.***> wrote:

My openvpn interfaces show up in pfSense as well as my Dashboard but I'm not running frr/ospf. In your initial request, you asked if it's possible to pull ovpn interface's with telegraf_pfinterface.php, which is what lead to the confusion. My guess is that the FRR daemon has the data you want, I'm not sure since I've never messed with it. I don't have it set up so I can't do much here. The code that populates the interface measurements https://github.com/VictorRobellini/pfSense-Dashboard/blob/158a63b51e164bf47ce90b2ddef89d36e6233bdd/plugins/telegraf_pfinterface.php#L5 uses pfsense PHP https://github.com/pfsense/pfsense/blob/master/src/etc/inc/interfaces.inc calls to pull data. If you find a solution, I'll be more than happy to add it to the dashboard as long as it doesn't impact anything else. Sorry I can't be of more help.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/VictorRobellini/pfSense-Dashboard/issues/35#issuecomment-817234260, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSVH5Y2ODI4WONYMHEZIPLTID7FFANCNFSM4Z7NYDIQ .

VictorRobellini commented 3 years ago

This piqued my interest so I started reading. Since I just have a client setup that's all I can toy with. The default Ovpn config uses a local socket for the mgmt interface for the client and I would suspect it does the same for servers.

I would imagine that one of the most important parts of monitoring ovpn would be to check the state. This is a rough way of doing it, but I may clean it up or look for a better way to get the data.

echo state | nc -U /var/etc/openvpn/client1/sock -N | awk -F',' 'NR==2 {printf "Established=%s,Status=%s,dontknow=%s,Assigned_IP=%s,Remote_Server_IP=%s,Remote_Server_Port=%s,Local_Ext_IP=%s,Local_Port=%s\n", $1,$2,$3,$4,$5,$6,$7,$8,$9}'

Output: Established=1617750506,Status=CONNECTED,dontknow=SUCCESS,Assigned_IP=10.39.112.15,Remote_Server_IP=212.102.37.151,Remote_Server_Port=1198,Local_Ext_IP=76.109.105.222,Local_Port=61613

What data are you pulling?