Check ASA VPN Sessions per Customer

Hi there,

our customers want to know, how many active vpn sessions are open on our cisco ASA devices.

It´s no problem to read out the value for all vpn sessions on the device, i´ve done this by changing the OIT in snmp_info of the cisco_asa_webvpnsessions check (cisco_asa_sessions extension)

from .", [38] to .", [3].

This OID returns the sum as int.

now, to seperate the sessions per customer, i have to count all values which i get from

snmpwalk [DEVICE]

the output looks like

. = STRING: “customer1”
. = STRING: “customer1”
. = STRING: “customer2”
. = STRING: “customer3”
. = STRING: “customer4”
. = STRING: “customer1”

and so one…

i think i have to count the diffent strings via parse function? and give back the different values like

yield {“active_sessions customer1”: int(sessions[‘customer1’])}
yield {“active_sessions customer2”: int(sessions[‘customer2’])}
yield {“active_sessions customer3”: int(sessions[‘customer3’])}

but i have no idea how to come to this point.

Any ideas, experiences ect. about such kind of check?



What you can do inside your parse function is to build a dictionary with the customer names as keys.
Now you have to add every VPN session found for this customer to a list of sessions inside the dictionary.

parsed = {}
parsed['customer1'] = []

add data here :slight_smile:

return parsed

now build your session data and append the entry to the empty list
To discover your items it is possible to use the discover() function as you have a dictionary with keys that can be used as items.

The easiest check later is then only count the length of your list to have the amount of active sessions for this customer. But you can also make more like traffic calculation and so on. If the data is stored in the list :slight_smile:

You might want to try this?