OpenVPN Instance Status in CLI

Hi,
I am trying to build a Blynk App to have OpenVPN connect to different instances (I have 3 different VPN servers in different countries that I want to use).

I already have created the 3 instances and can connect to them or disconnect but I would like to know if there is a way to know to which instance I am connected (if any). Basically, I would like to know the status of the VPN connection.

Due to how Blynk works I need to get this in either a log file that can be read and interpreted or in a command output. I can't read it from LUCI (I think).

Thanks for any help,
Mircea

You can use different interface names and subnets for different instances.
In that case link status, address or routes are enough to identify the instance.
To determine the status you can use ping via VPN interface or traceroute.
OpenVPN service log also has instance name prefix:

logread -e openvpn.instance

Hi, I decided to go with sth like this:

ps | grep -c _us

My 3 different instances have _us, _fr and _it in their name and I can see in the PS output which of the configs is used by OpenVPN.

Note that running process does not mean connected link.

I think that the best bet would be to assign meaningful dev names to those 3 VPN tunnels and use ifconfig to check for the connection.

You will also most likely be able to use network hotplug script to send notifications on up/down events of those connections.