Cacti FLEXlm Licensing template and script set


I've seen a few others on the Cacti lists working with graphing license utilization
from FLEXlm servers, but most are done with custom MIBs and net-snmpd. My case was 
a bit different.

I needed to graph license utilization for twelve separate licensed applications 
across three different license servers, and each licensed application has between
three and twelve individually licensed executables that I wanted to graph separately. 
Obviously, I needed a poller.

Since polling lmgrd license server processes is a textual adventure and actually
quite slow, I wrote a polling daemon in perl that polls each server process every
4.5 minutes, cataloging the licenses in use, total licenses, package name, etc. 
It writes the resulting hash to shared memory via Tie::ShareLite, and a companion 
query script reads that hash and outputs Cacti-friendly data. The poller requires 
that you have a copy of lmutil, which should be in your license server bin directory
somewhere. Copy this to /usr/local/sbin. You will need the version of lmutil that 
corresponds to the most recent version of lmgrd running in your network -- older
versions of lmutil will not work with newer lmgrd servers.

This method is rather complex, but having Cacti run a new query for each of maybe 
100 individual applications would take forever and waste bandwidth. With the poller,
queries happen once every 4.5 minutes, with a single query per lmgrd server process.
The result is that the data is instantly available to Cacti.

Usage:

Install Tie::ShareLite from CPAN. Then copy the lmgrd-poller.pl script to 
/usr/local/sbin or wherever, and modify it to reflect your environment. You will 
need to alter two hashes in this script, %tr and %licservers, to reflect your 
environment. This should be relatively self-explanatory. Run the lmgrd-poller.pl 
script and it should daemonize and begin polling. Copy the lmgrd_query.pl script 
to /var/www/cacti/scripts or wherever your Cacti scripts live, and run 
'perl ./lmgrd_query.pl test'. This should dump out the %licstatus hash to STDOUT. 
If there's data in it, all is well. Chown the lmgrd_query.pl script to the cacti 
user, and head to your Cacti page.

Import the templates and create a new device with the hostname/IP of a server 
running lmgrd. Use the 'FLEXlm Server' host template, *remove* the SNMP string, 
and *enter the lmgrd server's TCP port in the SNMP port field*. This is necessary 
since I'm basically doing an SNMP polling query without the SNMP, so I'm borrowing
host_snmp_port from the Cacti builtins to get that data to the script. By removing 
the SNMP community string here, you disable SNMP checks for this device within Cacti,
 but the query will now run.

Now, clicking create should show you the query output at the bottom, and clicking 
Create Graphs should present you with each individual application listed, along with
main package name and total available licenses. Group select those graphs, and click 
create. Rinse and repeat for every distinct lmgrd process in your network.

Enjoy!

-P
