Description: You can use the instructions here to monitor and record data on the number of concurrent users during a specific timeframe: daily, weekly, monthly, or yearly. You can choose to do this using one of two options: enabling debug flags to record the information to your logs; or using the sacli tool to output the number of concurrent users at a moment in time.
Enable debug flags to record the number of concurrent users
Enable the below debug flags:
LOG_N_CLIENTS_CHANGE=1
DEBUG_SUBSCRIPTION=2
You will be able to see this data in the log files in the /var/log/openvpnas.log directory.
For details about how to enable the debug flags, refer to Access Server Debug Flags.
Note: The data from the above debug flags will only be visible after any of these debug flags are enabled. So, any prior data before enabling these debug flags won't display.
Output number of concurrent users with sacli tool
The below commands depend on which license key model you have: subscription licenses or fixed licenses.
Fixed license
For fixed license, run the following commands:
sudo su
cd /usr/local/openvpn_as/scripts/
./sacli VPNSummary
./sacli LicUsage
For ./sacli VPNSummary, you will see something like this:
root@openvpn-access-server-Brandon:/usr/local/openvpn_as/scripts# ./sacli VPNSummary
{
"n_clients": 20
}
This means there are 20 VPN clients connected when you ran the VPNSummary command.
For ./sacli LicUsage, you will see something like this:
root@openvpn-access-server-Brandon:/usr/local/openvpn_as/scripts# ./sacli LicUsage
[
20,
50
]
The first number is the number of VPN clients connected at the time you ran the LicUsage command.
The second number is the number of connections allowed by your license key.
Subscription license
For subscription license, run the following commands:
sudo su
cd /usr/local/openvpn_as/scripts/
./sacli VPNSummary
./sacli SubscriptionStatus
For ./sacli VPNSummary, you will see something like this:
root@openvpn-access-server-Brandon:/usr/local/openvpn_as/scripts# ./sacli VPNSummary
{
"n_clients": 20
}
This means there are 20 VPN clients connected when you ran the VPNSummary command.
For ./sacli SubscriptionStatus, you will see something two different outputs depending on your Access Server version:
For Access Server lower than 2.12.0:
root@openvpn-access-server-Brandon:/usr/local/openvpn_as/scripts# ./sacli SubscriptionStatus
{'agent_disabled': False,
'agent_id': '9549154430622747219',
'cc_limit': 50,
'current_cc': 20,
'error': None,
'fallback_cc': 50,
'grace_period': 30,
'last_successful_update': 1694370579,
'last_successful_update_age': 50,
'max_cc': 50,
'name': 'Subscriptions 2',
'next_update': 1694370779,
'next_update_in': 149,
'notes': [],
'overdraft': False,
'server': 'asb.sts.openvpn.net',
'state': 'SUBSCRIPTION_OK',
'type': '-',
'updates_failed': 0}
The value you're looking for is 'current_cc'. That's the number of active connections to your Access Server when you ran the SubscriptionStatus command.
For Access Server 2.12.0 and newer:
root@openvpn-access-server-Brandon:/usr/local/openvpn_as/scripts# ./sacli SubscriptionStatus
{'agent_disabled': False,
'agent_id': '727817785155774865',
'cc_limit': 50,
'current_cc': 20,
'error': None,
'fallback_cc': 50,
'grace_period': 30,
'last_successful_update': 1694370802,
'last_successful_update_age': 10,
'max_cc': 50,
'name': 'Subscriptions 2',
'next_update': 1694371002,
'next_update_in': 189,
'notes': [],
'overdraft': False,
'server': 'asb.sts.openvpn.net',
'state': 'SUBSCRIPTION_OK',
'total_cc': 20,
'type': '-',
'updates_failed': 0}
The SubscriptionStatus command gives you information about your total number of connections for the subscription license as well as the total number of connections to the specific Access Server:
- current_cc: This is the total number of active connections on the specific Access Server.
- total_cc: This is the total number of active connections for the subscription license.
In our example, 'total_cc' and 'current_cc' are the same value, 20. You may see different values for subscription licenses used across more than one Access Server.
For instance, if you share a subscription license across three Access Servers:
- Your subscription license allows up to 100 concurrent connections.
- AS1 has 10 connected users.
- AS2 has 20 connected users.
- AS3 has 50 connected users.
You'll see these numbers for your SubscriptionStatus command on each Access Server:
AS1:
- 'current_cc': 10
- 'total_cc': 80
AS2:
- 'current_cc': 20
- 'total_cc': 80
AS3:
- 'current_cc': 50
- 'total_cc': 80
Automating data collection
The above commands can be automated to run every few minutes or so and the output can then be sent to a text file for later analysis such as converting the data to a graph.
If you have additional questions, please submit a ticket.
Comments
0 comments
Please sign in to leave a comment.