L
lynto
Guest
Greetings:
We are seeing some strange behavior with "lmstat". It's the same on
Solaris and Linux. What happens is that it's not reporting the users
properly. I've written a perl script to count the number of licenses
in use and report. This does: "lmutil lmstat -a -c $lfile" where
"$lfile" is $CDS_LIC_FILE. I can see jobs running in LSF, however they
don't show up on the "lmstat" command. Any one else seen this
behavior? Any idea how to fix it? I've included the script at the
bottom of this message.
Thanks
Tom
#!/usr/local/bin/perl -w
#
#$Id: lcnt,v 1.3 2003/07/29 12:44:56 lynch Exp $
#
# Counts the number of licenses in use.
# by: Tom L.
#
use Getopt::Std;
#
# Check Command Line
#
if ($ARGV[0] eq "") {
print "ERROR: No Input!\n";
&usage;
}
#
# Get the command line options.
#
getopts("l:") || die &usage;
#
if ($opt_l) {
@license_file = split(/:/,$opt_l);
}
#
# Got through the lmstat routine and make a count and user list.
#
foreach $lfile (@license_file) {
print "\n+++ Checking $lfile +++\n\n";
@license_list = `lmutil lmstat -a -c $lfile`;
$hit = 0;
$count = 0;
LINE:
foreach $line (@license_list) {
$_ = $line;
@x = $_;
@x = split;
if ((/Users of/) && ($hit == 0)) {
$name = $x[2];
$total = $x[5];
$count = 0;
$hit = 1;
next LINE;
}
elsif ((/Users of/) && ($hit == 1)) {
&printusage;
undef %users;
$name = $x[2];
$total = $x[5];
$count = 0;
next LINE;
}
elsif (/start/) {
$count++;
$users{$x[0]}++;
}
}
}
&printusage;
print "\n";
exit (0);
#
# Usage
#
sub usage {
print "Usage: $0 -l \$LM_LICENSE_FILE\n";
exit (1);
}
#
# Print out the License usage information, including user name and
total for user and total for license.
#
sub printusage {
printf "Feature %-35s Current Licenses In Use: %3s, Total:
%3s\n",$name, $count, $total;
if ($count == $total) {
$name =~ s/://;
print "*** Warning: All Licenses In Use For \"$name\"!
***\n";
}
while (($key,$value) = each %users) {
printf "\t User: %-12s has %3s
license.\n",$key,$value;
}
}
We are seeing some strange behavior with "lmstat". It's the same on
Solaris and Linux. What happens is that it's not reporting the users
properly. I've written a perl script to count the number of licenses
in use and report. This does: "lmutil lmstat -a -c $lfile" where
"$lfile" is $CDS_LIC_FILE. I can see jobs running in LSF, however they
don't show up on the "lmstat" command. Any one else seen this
behavior? Any idea how to fix it? I've included the script at the
bottom of this message.
Thanks
Tom
#!/usr/local/bin/perl -w
#
#$Id: lcnt,v 1.3 2003/07/29 12:44:56 lynch Exp $
#
# Counts the number of licenses in use.
# by: Tom L.
#
use Getopt::Std;
#
# Check Command Line
#
if ($ARGV[0] eq "") {
print "ERROR: No Input!\n";
&usage;
}
#
# Get the command line options.
#
getopts("l:") || die &usage;
#
if ($opt_l) {
@license_file = split(/:/,$opt_l);
}
#
# Got through the lmstat routine and make a count and user list.
#
foreach $lfile (@license_file) {
print "\n+++ Checking $lfile +++\n\n";
@license_list = `lmutil lmstat -a -c $lfile`;
$hit = 0;
$count = 0;
LINE:
foreach $line (@license_list) {
$_ = $line;
@x = $_;
@x = split;
if ((/Users of/) && ($hit == 0)) {
$name = $x[2];
$total = $x[5];
$count = 0;
$hit = 1;
next LINE;
}
elsif ((/Users of/) && ($hit == 1)) {
&printusage;
undef %users;
$name = $x[2];
$total = $x[5];
$count = 0;
next LINE;
}
elsif (/start/) {
$count++;
$users{$x[0]}++;
}
}
}
&printusage;
print "\n";
exit (0);
#
# Usage
#
sub usage {
print "Usage: $0 -l \$LM_LICENSE_FILE\n";
exit (1);
}
#
# Print out the License usage information, including user name and
total for user and total for license.
#
sub printusage {
printf "Feature %-35s Current Licenses In Use: %3s, Total:
%3s\n",$name, $count, $total;
if ($count == $total) {
$name =~ s/://;
print "*** Warning: All Licenses In Use For \"$name\"!
***\n";
}
while (($key,$value) = each %users) {
printf "\t User: %-12s has %3s
license.\n",$key,$value;
}
}