Forum Discussion
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
- Sammi
Altocumulus
A long shot, but maybe some useful things here?
In order to have you sendmail command use a different from address you will have to edit the FromLineOverride=YES field in /etc/ssmtp/ssmtp.conf.
https://devcentral.f5.com/s/question/0D51T00006i7c5l/how-to-modify-smtp-fromaddress
- Reddy1
Altostratus
Thanks Sammi, let me read the article.
did that solve it for you?
- Clarkson2910
Nimbostratus
We need the ability to see who is using the licenses, what our peak use is, etc.
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.
- Reddy1
Altostratus
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
- Reddy1
Altostratus
Thanks Neils , let me look in to this.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com