For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Reddy1's avatar
Reddy1
Icon for Altostratus rankAltostratus
Mar 13, 2020

Automated script to email the vpn ccu license usage

Hi ,

 

We have the requirement to monitor the VPN CCU licenses on the F5 APM. At this point we manually run the command every hour generate the report. To automate the task , we have added a small script to the cron.hourly to send us an email. For some reason we do not receive the email. If we run the script manually at /var/tmp , it does send the email.

 

We took the tcpdump during the top of the hour , we noticed the recipient address picked by the cron job is different. We noticed its postmaster@devicehostname.

 

Not sure how this new email address is kicking in. As per the script, we do the file is getting generated in /var/tmp every hour.

 

 

Here is the script we added to cron.hourly

---------------------------------------------------------------------------------------------------------------------------------------------

#!/bin/sh

tmsh show apm license |grep 'total connectivity sessions\|current connectivity sessions' >

 

from="networking"

to="user@abc.com"

subject="APM Stats Report"

 

mail -s "$subject" -r "$from" -a "/var/tmp/apm-stats.txt" "$to" << EOF

Hi Team,

Please find the attached APM Stats report.

 

Thanks & Regards,

vpn device name

 

EOF

---------------------------------------------------------------------------------------------------------------------------------------------

 

It would be a great help if someone can guide me with the solution.

 

 

Thanks,

Reddy

9 Replies

  • We need the ability to see who is using the licenses, what our peak use is, etc.

    • boneyard's avatar
      boneyard
      Icon for MVP rankMVP

      that will require external monitoring, the peak i mean.

       

      for seeing who, that would require totally different approach.

       

      the APM module that the possibility to run reports, that might be helpful for you.

  • Hi Clarkson,

     

    Good question though!! Not sure how we can list the existing active users consuming the CCU license.

    • Try this:

      # sessiondump -all | grep license.conn | cut -c 1-8 | xargs -I % sh -c 'sessiondump --sid % | grep last.username'
  • It's also possible to query these variables through the API.

    # curl -sk -u 'admin:admin' -H "Content-Type: application/json"  https://localhost/mgmt/tm/apm/license | jq '.entries[].nestedStats[].totalConnectivitySessions.value'
    10
    # curl -sk -u 'admin:admin' -H "Content-Type: application/json"  https://localhost/mgmt/tm/apm/license | jq '.entries[].nestedStats[].currentConnectivitySessions.value'
    0