4 # check_flexlm.pl license_file
6 # Check available flexlm license managers.
7 # Use lmstat to check the status of the license server
8 # described by the license file given as argument.
9 # Check and interpret the output of lmstat
10 # and create returncodes and output.
12 # Contrary to the nagios concept, this script takes
13 # a file, not a hostname as an argument and returns
14 # the status of hosts and services described in that
15 # file. Use these hosts.cfg entries as an example
17 #host[anchor]=any host will do;some.address.com;;check-host-alive;3;120;24x7;1;1;1;
18 #service[anchor]=yodel;24x7;3;5;5;unix-admin;60;24x7;1;1;1;;check_flexlm!/opt/lic/licfiles/yodel_lic
19 #service[anchor]=yeehaw;24x7;3;5;5;unix-admin;60;24x7;1;1;1;;check_flexlm!/opt/lic/licfiles/yeehaw_lic
20 #command[check_flexlm]=/some/path/libexec/check_flexlm.pl $ARG1$
23 # - you need the lmstat utility which comes with flexlm.
24 # - set the correct path in the variable $lmstat.
26 # initial version: 9-10-99 Ernst-Dieter Martin edmt@infineon.com
27 # current status: looks like working
29 # Copyright Notice: Do as you please, credit me, but don't blame me
32 # Just in case of problems, let's not hang Nagios
34 print "No Answer from Client\n";
39 $lmstat = "/opt/lic/sw/cadadm/default/bin/lmstat";
45 open CMD
,"$lmstat -c $licfile |";
50 if ( /^License server status: [0-9]*@([-0-9a-zA-Z_]*),[0-9]*@([-0-9a-zA-Z_]*),[0-9]*@([-0-9a-zA-Z_]*)/ ) {
54 $lf1 = $lf2 = $lf3 = 0;
56 } elsif ( /^License server status: [0-9]*@([-0-9a-zA-Z_]*)/ ) {
59 $lf1 = $lf2 = $lf3 = 0;
61 } elsif ( / *$ls1: license server UP/ ) {
64 } elsif ( / *$ls2: license server UP/ ) {
67 } elsif ( / *$ls3: license server UP/ ) {
70 } elsif ( / *([^:]*: UP .*)/ ) {
71 print " license server for $1\n";
75 if ( $serverup == 0 ) {
76 print " license server not running\n";
80 exit 0 if ( $servers == $lf1 + $lf2 + $lf3 );
81 exit 1 if ( $servers == 3 && $lf1 + $lf2 + $lf3 == 2 );