# Monitoring Tower license usage

**URL:** <https://forum.ansible.com/t/monitoring-tower-license-usage/30175>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [April 24, 2019, 2:50pm UTC](https://forum.ansible.com/t/monitoring-tower-license-usage/30175 "2019-04-24T14:50:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dan\_linder](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dan_linder/32/3833_2.png) [@dan\_linder](https://forum.ansible.com/u/dan_linder)\
**Post date:** [April 24, 2019, 2:50pm UTC](https://forum.ansible.com/t/monitoring-tower-license-usage/30175/1 "2019-04-24T14:50:48Z")

</div>

My team uses Ansible Tower (the RedHat licensed product) and we track the license usage change day-to-day with this python script. We have two environments, so the system will use the LOGIN\_INFO dictionary to login and record each sites current instances. There’s also an example how to call it from a crontab. The script does send data to the screen (stdout) as well as the CSV file - in the future I might update this to be an option to disable for crontab usage.

If you have a single instance, update the “envs” variable to just note “Prod” like this:  
`envs = {'Prod', 'Sandbox', 'Total'}`  
`and remove the corresponding LOGIN_INFO entry.`

If you have three or more sites, add them to the envs:  
`envs = {'Prod', 'Sandbox', 'Lab', 'DMZ', 'Total'}`

`and add additional LOGIN_INFO entries.`

`I'd love feedback if this works to monitor server counts in the AWX project too.`

`Code is supplied " **AS-IS, NO WARRANTY**" but it should be safe enough once you've reviewed it for yourself.`

`  
#!/usr/bin/env python

---

<div class="post-metadata">

**Author:** ![rpetrell](https://avatars.discourse-cdn.com/v4/letter/r/b4bc9f/32.png) [@rpetrell](https://forum.ansible.com/u/rpetrell)\
**Post date:** [April 24, 2019, 3:00pm UTC](https://forum.ansible.com/t/monitoring-tower-license-usage/30175/2 "2019-04-24T15:00:43Z")

</div>

Hey Dan,

This is neat, thanks for sharing.

You might want to check out a new feature we just merged into AWX (which will be in a future version of Ansible Tower):

[https://github.com/ansible/awx/issues/1963](https://github.com/ansible/awx/issues/1963)

~ curl -ks “[https://ryan:ryan@awx.example.org/api/v2/metrics/](https://ryan:ryan@awx.example.org/api/v2/metrics/)” | grep free\_instances  
awx\_system\_info{ansible\_version=“2.7.10”,external\_logger\_enabled=“False”,external\_logger\_type=“None”, **free\_instances=“0”** ,insights\_analytics=“True”,install\_uuid=“95d325fc-43b1-4f72-8c4f-658c43ade26b”,license\_expiry=“8516103533”,license\_type=“enterprise”,pendo\_tracking=“detailed”,tower\_url\_base=“[https://yossarian:8043](https://yossarian:8043)”,tower\_version=“4.0.0-372-ge78ef8238”}
