Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Fri Jul 20, 2018 1:39 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 77 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: FLEXlm Template and script set
PostPosted: Mon Mar 13, 2006 12:43 pm 
Offline

Joined: Mon Mar 13, 2006 12:39 pm
Posts: 20
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 4449 times


Last edited by pvenezia on Thu May 04, 2006 12:39 pm, edited 1 time in total.
Top
 Profile  
 
 Post subject:
PostPosted: Thu May 04, 2006 12:12 pm 
Offline

Joined: Thu May 04, 2006 12:05 pm
Posts: 5
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 04, 2006 12:42 pm 
Offline

Joined: Mon Mar 13, 2006 12:39 pm
Posts: 20
Thanks for the note, the current attachment fixes that bit. This code does work on Windows FLEXlm servers, AFAIK.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 07, 2006 3:24 pm 
Offline

Joined: Wed May 24, 2006 9:40 am
Posts: 15
Location: md, us
This works GREAT!. I'm monitoring multiple servers on multiple box with cacti running on Linux and my lmservers on Windows.

Thanks for sharing.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 15, 2006 6:03 am 
Offline
Cacti User

Joined: Thu Oct 14, 2004 4:14 pm
Posts: 97
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?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 25, 2006 1:43 pm 
Offline

Joined: Sun Jun 25, 2006 1:41 pm
Posts: 2
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 16, 2006 9:54 am 
Offline

Joined: Mon Oct 16, 2006 9:50 am
Posts: 1
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?


Top
 Profile  
 
 Post subject: Re: FLEXlm Template and script set
PostPosted: Tue Oct 17, 2006 4:30 am 
Offline

Joined: Tue Oct 17, 2006 4:26 am
Posts: 1
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


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 11, 2006 2:18 pm 
Offline

Joined: Wed Jul 06, 2005 1:41 pm
Posts: 12
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!


Top
 Profile  
 
 Post subject: UPDATED VERSION!!
PostPosted: Mon Nov 13, 2006 2:51 pm 
Offline

Joined: Wed Jul 06, 2005 1:41 pm
Posts: 12
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 2557 times
Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 13, 2006 5:54 pm 
Offline

Joined: Wed Oct 04, 2006 9:55 pm
Posts: 15
Hi

When I run the command

perl lmgrd-query.pl test

I get alot of output that looks like this:

Code:
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:
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

--


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 13, 2006 7:19 pm 
Offline

Joined: Wed Jul 06, 2005 1:41 pm
Posts: 12
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.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 13, 2006 8:01 pm 
Offline

Joined: Wed Oct 04, 2006 9:55 pm
Posts: 15
well I actually used the ip address.
I will try with the FQDN...........

no go. same problem........


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 13, 2006 10:57 pm 
Offline

Joined: Wed Jul 06, 2005 1:41 pm
Posts: 12
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.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 13, 2006 11:59 pm 
Offline

Joined: Wed Oct 04, 2006 9:55 pm
Posts: 15
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??

--


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 77 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: Bing [Bot] and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group