New functionality: license seat tracking

740 views
Skip to first unread message

Gregory Neagle

unread,
Jul 12, 2013, 2:32:12 PM7/12/13
to munki-w...@googlegroups.com
I've committed the code for a new feature for MunkiWebAdmin. This was designed for us to more easily track the number of installs of a given application or product suite.

If you are using virtualenv and git, upgrading should go like this:

cd into the virtualenv directory containing MWA:

bash-3.2# cd /Volumes/munki/munkiwebadmin_env/

Activate the virtualenv (requires bash shell):

bash-3.2# source bin/activate

Stop the MWA server process. In my case, it's run via launchd:
(munkiwebadmin_env)bash-3.2# launchctl unload /Library/LaunchDaemons/com.googlecode.munki.munkiwebadmin.plist

Change into the munkiwebadmin dir:
(munkiwebadmin_env)bash-3.2# cd munkiwebadmin

Use git to update munkiwebadmin:
(munkiwebadmin_env)bash-3.2# git pull

Make sure your database tables are updated (important to add the new tables to track license seats):
(munkiwebadmin_env)bash-3.2# python manage.py syncdb

Restart MunkiWebAdmin (again, in my case, using launchd):
(munkiwebadmin_env)bash-3.2# launchctl load /Library/LaunchDaemons/com.googlecode.munki.munkiwebadmin.plist

This new functionality is basically a set of stored queries that query the inventory items database to count the number of machines that have a specific thing installed.
To add items to the license seat tables, login to the admin interface (http:/your.munkiwebadmin.server/admin) -- you may need to use your superuser account):


Click on "Licenses".


Click the "Add license" button.


Item name contains the name of the thing you are tracking. To take advantage of upcoming integration with the Munki client and Optional installs, this should be the same as the name of the related pkginfo item.

Total is the total number of seats you have available (values seen here are fake).
Cost per seat can be used to track your "per seat" license cost (values seen here are fake).

The next four fields control the query that will be done to find entries in the inventory items table.

Inventory name matches the name of the item in the inventory items table. This is the application name part of the path (minus .app).
Inventory version is the version number of the item. This value supports * as a wildcard to allow you to match all items starting with a major version number.
Inventory bundleid is the CFBundleIdentifier of the item
Inventory bundlename is the CFBundleName of the item
Inventory path is the full pathname of the item.

For any given item, you would use one of Inventory name|Inventory bundleid|Inventory bundlename|Inventory path and optionally Inventory version.

In the example above, the query would be for all items with bundleid="com.apple.iWork.Keynote" and version starting with "5." Machines with this item are considered to have iWork09 installed.

For each item you wish to track, you need to specify a unique item to count. For single applications, this is straightforward. For application "suites" this can be a bit trickier and may require some judgement calls.

For Adobe CS4, CS5, and CS6 installs, I am using the presence of the _uninstaller_ application as the thing to count. This allows the mechanism to distinguish between the various suites and individual products.

Outside of the admin interface, tracked installs display like this:


You can click on the Installed Seats count to see a list of Inventory Clients with the found item. Here is AdobePhotoshopCS5:


I'm sure there will be lots of questions, and requests for "can it/will it to this or that"? Please play with the feature for a bit -- it currently is a reporting feature only and does not cause anything to "happen". It actually does not provide any new data you could not have extracted from the MWA database already; it just stores certain queries and makes them available under defined names.

Coming soon is a new Munki feature that will make use of this data to allow you to add items to Optional installs that check their seat availability. This would allow you to add, say, AdobePhotoshopCS6 to optional_installs. As long as there are available license seats, it would remain available for "self-service" install. Once the install count reaches or exceeds the total available seats, AdobePhotoshopCS6 would no longer be available for self-service install. If AdobePhotoshopCS6 is subsequently removed from some machines so that the total number of installed machines < total number of licensed seats, AdobePhotoshopCS6 would become available for self-service install once again.

-Greg

Ken Elliott

unread,
Jul 13, 2013, 12:51:04 AM7/13/13
to munki-w...@googlegroups.com
Hi Greg,

Licenses is showing as an option in the menubar,
No License options appear in Site Administration.
I am logged in as superuser.
I've reinstalled from the web instruction and updated from the email update instruction, no diff.

If I click on Licenses on the menu bar I get the following error.

Ken

TemplateDoesNotExist at /licenses/

licenses/index.html
Request Method:GET
Request URL:http://127.0.0.1:8000/licenses/
Django Version:1.5.1
Exception Type:TemplateDoesNotExist
Exception Value:
licenses/index.html
Exception Location:/Users/Shared/munkiwebadmin_env/lib/python2.7/site-packages/django/template/loader.py in find_template, line 139
Python Executable:/Users/Shared/munkiwebadmin_env/bin/python
Python Version:2.7.2
Python Path:
['/Users/Shared/munkiwebadmin_env/munkiwebadmin',
 '/Users/Shared/munkiwebadmin_env/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
 '/Users/Shared/munkiwebadmin_env/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg',
 '/Users/Shared/munkiwebadmin_env/lib/python27.zip',
 '/Users/Shared/munkiwebadmin_env/lib/python2.7',
 '/Users/Shared/munkiwebadmin_env/lib/python2.7/plat-darwin',
 '/Users/Shared/munkiwebadmin_env/lib/python2.7/plat-mac',
 '/Users/Shared/munkiwebadmin_env/lib/python2.7/plat-mac/lib-scriptpackages',
 '/Users/Shared/munkiwebadmin_env/Extras/lib/python',
 '/Users/Shared/munkiwebadmin_env/lib/python2.7/lib-tk',
 '/Users/Shared/munkiwebadmin_env/lib/python2.7/lib-old',
 '/Users/Shared/munkiwebadmin_env/lib/python2.7/lib-dynload',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/Users/Shared/munkiwebadmin_env/lib/python2.7/site-packages']
Server time:Sat, 13 Jul 2013 16:44:51 +1200

Template-loader postmortem

Django tried loading these templates, in this order:
  • Using loader django.template.loaders.filesystem.Loader:
    • /Users/Shared/munkiwebadmin_env/munkiwebadmin/templates/licenses/index.html (File does not exist)
  • Using loader django.template.loaders.app_directories.Loader:
    • /Users/Shared/munkiwebadmin_env/lib/python2.7/site-packages/django/contrib/auth/templates/licenses/index.html (File does not exist)
    • /Users/Shared/munkiwebadmin_env/lib/python2.7/site-packages/django/contrib/admin/templates/licenses/index.html (File does not exist)
    • /Users/Shared/munkiwebadmin_env/munkiwebadmin/reports/templates/licenses/index.html (File does not exist)
    • /Users/Shared/munkiwebadmin_env/munkiwebadmin/catalogs/templates/licenses/index.html (File does not exist)
    • /Users/Shared/munkiwebadmin_env/munkiwebadmin/manifests/templates/licenses/index.html (File does not exist)
    • /Users/Shared/munkiwebadmin_env/munkiwebadmin/inventory/templates/licenses/index.html (File does not exist)

Gregory Neagle

unread,
Jul 13, 2013, 1:04:30 AM7/13/13
to munki-w...@googlegroups.com
Thanks. I just reproduced this issue doing an install from scratch. To fix:

1) Stop MWA.
2) Edit settings.py, adding 'licenses' to the list of installed apps:

    # Uncomment the next line if you've installed django_wsgiserver
    # and want to serve this Django app using it
    'django_wsgiserver',
    'reports',
    'catalogs',
    'manifests',
    'inventory',
    'licenses',
)

3) python manage.py syncdb
4) Restart MWA.

-Greg


--
You received this message because you are subscribed to the Google Groups "MunkiWebAdmin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to munki-web-adm...@googlegroups.com.
Visit this group at http://groups.google.com/group/munki-web-admin.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ken Elliott

unread,
Jul 13, 2013, 6:49:20 AM7/13/13
to munki-w...@googlegroups.com
Hi Greg,

Apologies for my slow reply, when your attention to munki is so prompt.
As you would say fixed.
Thanks to you

Cheers Ken

PS Think sleep, you do seem to be 24hr
Reply all
Reply to author
Forward
0 new messages