FLEXlm Template and script set
Moderators: Developers, Moderators
FLEXlm 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.
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
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.
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?
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?
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
Check out http://www.x-formation.com/license_statistics
-- Poul
Re: FLEXlm Template and script set
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
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
-
- Posts: 12
- Joined: Wed Jul 06, 2005 1:41 pm
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!
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!
-
- Posts: 12
- Joined: Wed Jul 06, 2005 1:41 pm
UPDATED VERSION!!
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).
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
Hi
When I run the command
perl lmgrd-query.pl test
I get alot of output that looks like this:
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
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
--
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'
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
--
-
- Posts: 12
- Joined: Wed Jul 06, 2005 1:41 pm
-
- Posts: 12
- Joined: Wed Jul 06, 2005 1:41 pm
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 wrote:well I actually used the ip address.
I will try with the FQDN...........
no go. same problem........
Who is online
Users browsing this forum: No registered users and 1 guest