My Scripts for lmgrd License Daemon

Me and my colleagues teach students system and simulation programming at MIPT. We use Wind River Simics installation obtained under an academic license. Its 50 floating licenses are managed by central Flexera Flexnet license manager daemon. The main executable of this software is called lmgrd. Upon startup, its process opens up a network port and waits for connections from client software asking for licenses for particular features. The very same licensing software is used by many other engineering software packages, including Maple, Intel Compiler, Mathematica, ARM’s Keil MDK etc.

Init.d Scripts

A manual setup was well documented and went pretty straightforward. Still, a proper automatic start/stop functionality, as a Linux service, was nowhere to be found. This lead to annoying issues like stale lock files. So I wrote an init.d script to fix this. I installed it at the  Debian-based server with help of update-rc.d and had no problems with lmgrd so far: now it shuts down and starts up correctly.

Usage Metrics Collection

Then, I wanted to know how much my students use Simics and its features. When started with certain options, lmgrd logs its events to a file. The idea was to parse this log periodically and extract data from it.

There is always a big scary warning in this log at the daemon’s startup:

 0:50:20 (lmgrd) -----------------------------------------------
 0:50:20 (lmgrd)   Please Note:
 0:50:20 (lmgrd) 
 0:50:20 (lmgrd)   This log is intended for debug purposes only.
 0:50:20 (lmgrd)   In order to capture accurate license
 0:50:20 (lmgrd)   usage data into an organized repository,
 0:50:20 (lmgrd)   please enable report logging. Use Flexera Software, Inc.'s
 0:50:20 (lmgrd)   software license administration  solution,
 0:50:20 (lmgrd)   FLEXnet Manager, to  readily gain visibility
 0:50:20 (lmgrd)   into license usage data and to create
 0:50:20 (lmgrd)   insightful reports on critical information like
 0:50:20 (lmgrd)   license availability and usage. FLEXnet Manager
 0:50:20 (lmgrd)   can be fully automated to run these reports on
 0:50:20 (lmgrd)   schedule and can be used to track license
 0:50:20 (lmgrd)   servers and usage across a heterogeneous
 0:50:20 (lmgrd)   network of servers including Windows NT, Linux
 0:50:20 (lmgrd)   and UNIX. Contact Flexera Software, Inc. at
 0:50:20 (lmgrd)   www.flexerasoftware.com for more details on how to
 0:50:20 (lmgrd)   obtain an evaluation copy of FLEXnet Manager
 0:50:20 (lmgrd)   for your enterprise.
 0:50:20 (lmgrd) 
 0:50:20 (lmgrd) -----------------------------------------------

Apparently, Flexera wants me to buy a separate software package that can do the accounting for me. No thanks, I’ll do it myself.

In the log, a typical line for a license feature checkout looks like this:

17:31:17 (simics) OUT: "simics" grigory.rechistov@linux-ep5w

It was pretty easy to parse all of them with Python’s regular expressions. So, the script produces per-user statistics of all features checked, along with some extra info, like list of all users, all hosts etc. Enough for my needs, and maybe useful to someone else.

The script is not tied to Simics specifics, so it should be useful for other software’s lmgrd logs, granted the format is the same.

The last touch — I instructed logrotate to serve lmgrd’s log files periodically and to keep last 52 files, one per week.

References

1. init.d script

2. parse_lmgrd.py script


Written by Grigory Rechistov in Uncategorized on 02.10.2014. Tags: licensing, lmgrd, simics,


Copyright © 2024 Grigory Rechistov