FLEXlm Template and script set

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

pvenezia
Posts: 20
Joined: Mon Mar 13, 2006 12:39 pm

FLEXlm Template and script set

Post by pvenezia »

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.

So, here's the full Cacti FLEXlm licensing template set and associated polling and querying scripts. Let me know if you run into any problems.

Ciao

-P
Attachments
cacti-flexlm-0.0.1.tar.gz
(5.58 KiB) Downloaded 4933 times
Last edited by pvenezia on Thu May 04, 2006 12:39 pm, edited 1 time in total.
mmethe
Posts: 5
Joined: Thu May 04, 2006 12:05 pm
Contact:

Post by mmethe »

Pretty cool stuff.

Just an FYI, missing ',' on line 33.

And, have you done any work on monitoring Windows based Flexlm servers?

Thanks

-Mike M
-Mike M
http://blatbox.freehostia.com
pvenezia
Posts: 20
Joined: Mon Mar 13, 2006 12:39 pm

Post by pvenezia »

Thanks for the note, the current attachment fixes that bit. This code does work on Windows FLEXlm servers, AFAIK.
wazoqaz
Posts: 15
Joined: Wed May 24, 2006 9:40 am
Location: md, us
Contact:

Post by wazoqaz »

This works GREAT!. I'm monitoring multiple servers on multiple box with cacti running on Linux and my lmservers on Windows.

Thanks for sharing.
tman
Cacti User
Posts: 97
Joined: Thu Oct 14, 2004 4:14 pm

Post by tman »

I'm very keen to use this, but my Cacti setup runs on Windows, and I will be monitoring Windows and Linux flexlm servers. Can't see the monitoring would be a problem, but I'm having great difficultly finding Windows compiled versions of IPC and TIE Sharelite perl packages.

I'm running ActiveState Perl 5.8x, and don't really want to have to install the entire Windows development tools to compile these tiny modules.

Can anyone help?
pould
Posts: 2
Joined: Sun Jun 25, 2006 1:41 pm

Post by pould »

As an alternative you might want to look into a very inexpensive tool to do the same job. It also interfaces with rrd and writes html pages as well as graphs.

Check out http://www.x-formation.com/license_statistics

-- Poul
w_jaede
Posts: 1
Joined: Mon Oct 16, 2006 9:50 am

Post by w_jaede »

hello, i tried to import the xml but got the error-message that this template was created with a newer version of cacti !?
but i'm using already version 0.8.6i ?!
before i tried to iport it in version ...h but i get the same errormessage ...

any idears?
djockheck
Posts: 1
Joined: Tue Oct 17, 2006 4:26 am

Re: FLEXlm Template and script set

Post by djockheck »

Hi!
I have a problem with creating the graphs:
Creating the graphs says:
"Error in data query"
Then I tried to debug the Query "FlexLm Applications" but I receive

<cut>
+ Running data query [10].
+ Found type = '4 '[script query].
+ Could not find data query XML file at '/srv/www/htdocs/cacti/resource/script_queries/lmgrd.xml'
+ Error parsing XML file into an array.
+ Could not find data query XML file at '/srv/www/htdocs/cacti/resource/script_queries/lmgrd.xml'
+ Could not find data query XML file at '/srv/www/htdocs/cacti/resource/script_queries/lmgrd.xml'
+ Could not find data query XML file at '/srv/www/htdocs/cacti/resource/script_queries/lmgrd.xml'
</cut>
It is right that there is no lmgrd.xml. Which programm should place the file there?

ciao
Detlef
nick@seakr.com
Posts: 12
Joined: Wed Jul 06, 2005 1:41 pm

Post by nick@seakr.com »

A couple of quick things. First off, I think this is a great product. I was looking into how to query FlexLM over SNMP and get the data into Cacti that way, which was proving to be very difficult. I stumbled across this post and found it quite useful. A couple of notes about it, though...

First, in our particular FlexLM configuration all of our products are on the same port number. The script pair seems to stumble on this and classifies all of my license features under the same "package" name. I haven't been able to figure out exactly why this happens, but I'm guessing it has something to do with how the Perl Dumper module stores the data in memory.

Second, I'd like the graphs to not only graph the number of license in use but also the total number available for each product. Again, I've attempted to figure out how to do this, but the total number of licenses doesn't seem to get passed through correctly. Again, I think this has something to do with the Perl script or the interaction between the script and Cacti, but I haven't been able to pinpoint it.

Any tips on either of these issues would be greatly appreciated!
nick@seakr.com
Posts: 12
Joined: Wed Jul 06, 2005 1:41 pm

UPDATED VERSION!!

Post by nick@seakr.com »

I've updated this software slightly to fit my functionality a bit more. Here's my addition to the "README" file found in the attached archive. I apologize in advance if the files are hard to interpret because I'm a bad perl programmer, my tabs are off, or I've done anything else incorrectly. It works very well for me, hopefully that will also be the case for you.

Also, to the user who was receiving errors in Cacti about the missing .XML file (and anyone else who may attempt to use this), please make sure you put the lmgrd.xml file in your cacti root's resources/script_queries directory - this is the source of the error messages you were receiving.

--README Additions--
-Instead of the hashes being in the form servers -> servername -> daemon -> port, I've rearranged things so that the hash is servers -> servername -> port -> daemon. I did this because the previous method was not keeping vendors daemons that were running on the same port separated correctly (probably due to how the Tie::Sharelite module or Perl overall indexes the hashes). The new method allows you to correctly identify and graph features for each vendor (called "package" in the graphing part) when your vendor daemons are running on the same FlexLM port (as is the case in my setup). If that's unclear, see the actual poller script to see how it's done. The new hash looks like this:
my %licservers = (
'server1' => {
'port1' => {
'daemon1' => 'Nice Name 1',
'daemon2' => 'Nice Name 2',
},
'port2' => {
'daemon1' => 'Nice Name 1',
},
},
'server2' => {
'port1' => {
'daemon1' => 'Nice Name 1',
},
},
);


-With the above change, I also changed the call to lmutil to call each vendor
daemon separately instead of getting the status of all of the daemons each time.This speeds the polling up noticeably.
-Also, with the first change, I've done away with the "translation table" in
favor of storing the nice package name as the second part of the daemon hash. See the section above that lays out the actual hash.
-I wanted to be able to graph both the inuse licesnes and the total licenses.
In order to do this I had to change the lmgrd-query.pl script slightly so that
the "get" function can get more than just the inuse licenses - it can also get
the total licenses.
-I've also made minor modifications to data query templates, graph templates, etc., so that the total number of licenses is a default on the graphs, which is signified by a solid blue line (red area is still the inuse licenses).
Attachments
cacti-flexlm-0.0.2.tar.gz
(7.21 KiB) Downloaded 2926 times
slay
Posts: 15
Joined: Wed Oct 04, 2006 9:55 pm

Post by slay »

Hi

When I run the command

perl lmgrd-query.pl test

I get alot of output that looks like this:

Code: Select all

Dumping hash...
$VAR1 = 'host.domain.com';
$VAR2 = {
          'Assura_LVS' => {
                            'inuse' => '0',
                            'port' => '5280',
                            'total' => '3',
                            'package' => 'Cadence'
                          },
          'Assura_DRC' => {
                            'inuse' => '0',
                            'port' => '5280',
                            'total' => '3',
                            'package' => 'Cadence'
                          },
          'Assura_MP' => {
                           'inuse' => '0',
                           'port' => '5280',
                           'total' => '1',
                           'package' => 'Cadence'
                         },
          'LEAPFROG-CV' => {
                             'inuse' => '0',
                             'port' => '5280',
                             'total' => '9',
                             'package' => 'Cadence'
However whenI create the host as a FlexLM server it doesn't seem to get the info. I have taken the snmp community string out and added the port for the license server to the SNMP port field. I also added lmgrd.xml to the ~/cacti/resource/script_queries directory.

When I run a verbose quesry on the host from cacti I get this

Code: Select all

Running data query [14].
+ Found type = '4 '[script query].
+ Found data query XML file at '/var/www/html/cacti/resource/script_queries/lmgrd.xml'
+ XML file parsed ok.
+ Executing script for list of indexes 'perl /var/www/html/cacti/scripts/lmgrd-query.pl <ipaddr> 5280 index'
+ Executing script query 'perl /var/www/html/cacti/scripts/lmgrd-query.pl <ipaddr> 5280 query appname'
+ Executing script query 'perl /var/www/html/cacti/scripts/lmgrd-query.pl <ipaddr> 5280 query package'
+ Found data query XML file at '/var/www/html/cacti/resource/script_queries/lmgrd.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/script_queries/lmgrd.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/script_queries/lmgrd.xml'

I see nothing though. The data query section says "Success: 0 Items 0 Rows.

Any clues what might be happening? Or what I missed? Everything seems OK????

Thanks

--
nick@seakr.com
Posts: 12
Joined: Wed Jul 06, 2005 1:41 pm

Post by nick@seakr.com »

When you specified the hostname when adding the device, did you specify the FQDN (host.domain.com) and not just the host part of it? This is important, as the script uses this value to pull the data from the poller.
slay
Posts: 15
Joined: Wed Oct 04, 2006 9:55 pm

Post by slay »

well I actually used the ip address.
I will try with the FQDN...........

no go. same problem........
nick@seakr.com
Posts: 12
Joined: Wed Jul 06, 2005 1:41 pm

Post by nick@seakr.com »

slay wrote:well I actually used the ip address.
I will try with the FQDN...........

no go. same problem........
Double-check your settings - the settings you use in Cacti for the hostname and port number need to match the settings in the poller script exactly. Also, instead of just correcting the settings, try deleting the device and starting all over.
slay
Posts: 15
Joined: Wed Oct 04, 2006 9:55 pm

Post by slay »

right on


I will try this. It's funny cuz the test works ok but then no data. Everything checks out. I am using 0.8.6i if that means anything......

Does it work with the latest version??

--
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests