Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: help need with flexlm

by blue_cowdawg (Monsignor)
on May 04, 2013 at 10:00 UTC ( #1032015=note: print w/replies, xml ) Need Help??

in reply to help need with flexlm

so... what have you tried? Are you concerned about total number of licenses of all products or each product? Either way it is a fairly straight forward detection of what lines you are on

if ( $line =~ m@Users of Product@ ) { $line =~ m@Product(\d+):@; # match and capture product number $product = $1l
and tallying the user's product usage
$line = s/\s+//; #get rid of the leading spaces my @f=split(/[\s\t]+/,$line); my $user=$f[0]; # if our hash does not contain an entry for our user $counter{$user} = [] if ( ! defined($counter{$user}) ) ; $counter{$user}->{$product}++;
Once you have your counts I'm sure you can work out how to calculate percentages. As far as making your script send email there are plenty of articles on that on PM (try a super search) and my own blog has examples of how to do that (offsite link) here.

Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

Replies are listed 'Best First'.
Re^2: help need with flexlm
by vkknava (Initiate) on May 04, 2013 at 13:16 UTC
    I need for each product. If a user uses 30% of the total number of a product, I need an email. I will try with what you have suggested and let you know with the result.

      I tried with the first half of the code. But it is not printing the number.

      Another thing is I have many products in the output file. I am calculating the usage of each product.

      #!/usr/bin/perl local $/; open(DAT, "output1.txt") || die("Could not open file!"); my $line = <DAT>; my $product; if ( $line =~ m/Users of/ ) { $line =~ m@Product(\d+):@; $product = $1; print $product; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1032015]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2018-05-23 06:08 GMT
Find Nodes?
    Voting Booth?