Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: help need with flexlm

by blue_cowdawg (Prior)
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


Comment on Re: help need with flexlm
Select or Download Code
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1032015]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-09-01 11:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (6 votes), past polls