FlexLM client module for Xymon Monitor

Author Anna Jonna Armannsdottir
Compatibility Xymon 4.2
Requirements unix
Download None
Last Update 2008-06-20

The Flex License Manager holds licenses for proprietary systems like Matlab, Maple and Ansys. If the license manager is down or if all licenses are in use, then those systems are rendered useless, during the downtime. Using Xymon monitor, the uptime can be increased considerably, and the efficiency of the license usage, is registered automatically.

Client side

A shell script is to be installed on the client side. Also a few lines are added to the client configuration file. The text in the shell script describes the installation on the client side. After those changes, the client process should be restarted.

Server side

Only configuration files are changed on the server side. Two lines are changed in the configuration file hobbitserver.cfg:

TEST2RRD="cpu=la,disk, ... ,lines,flexlm=ncv"
GRAPHS="la,disk, ... ,lines,flexlm"

One line is added to the configuration file hobbitserver.cfg:

NCV_flexlm="*:GAUGE"

All of the file hobbitgraph.cfg.inc is inserted into the configuration file hobbitgraph.cfg. This should preferably be inserted at the end.

Show Code ⇲

Hide Code ⇱

#	$Id: hobbitgraph.cfg.inc,v 1.3 2008-06-27 18:37:22 annaj Exp $ 

[flexlm]
	TITLE Matlab License counts
	YAXIS #

	DEF:matlab=flexlm.rrd:MATLAB:AVERAGE
	LINE2:matlab#FF0000:Matlab
	COMMENT:\n
	GPRINT:matlab:LAST:Matlab \: %5.1lf%s (cur)
	GPRINT:matlab:MAX: \: %5.1lf%s (max)
	GPRINT:matlab:MIN: \: %5.1lf%s (min)
	GPRINT:matlab:AVERAGE: \: %5.1lf%s (avg)\n

[flexlm1]
	TITLE Matlab Extended License counts
	YAXIS #

	DEF:simulink=flexlm.rrd:SIMULINK:AVERAGE
	LINE2:simulink#660000:Simulink
	COMMENT:\n
	GPRINT:simulink:LAST:Simulink \: %5.1lf%s (cur)
	GPRINT:simulink:MAX: \: %5.1lf%s (max)
	GPRINT:simulink:MIN: \: %5.1lf%s (min)
	GPRINT:simulink:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:commtlb=flexlm.rrd:CommunicationToolb:AVERAGE
	LINE2:commtlb#66CC66:Communication Toolb
	COMMENT:\n
	GPRINT:commtlb:LAST:Communication Toolb \: %5.1lf%s (cur)
	GPRINT:commtlb:MAX: \: %5.1lf%s (max)
	GPRINT:commtlb:MIN: \: %5.1lf%s (min)
	GPRINT:commtlb:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:ctrltlb=flexlm.rrd:ControlToolbox:AVERAGE
	LINE2:ctrltlb#6666CC:Control Toolbox
	COMMENT:\n
	GPRINT:ctrltlb:LAST:Control Toolbox \: %5.1lf%s (cur)
	GPRINT:ctrltlb:MAX: \: %5.1lf%s (max)
	GPRINT:ctrltlb:MIN: \: %5.1lf%s (min)
	GPRINT:ctrltlb:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:fintlb=flexlm.rrd:FinancialToolbox:AVERAGE
	LINE2:fintlb#FFBB00:Financial Toolbox
	COMMENT:\n
	GPRINT:fintlb:LAST:Financial Toolbox \: %5.1lf%s (cur)
	GPRINT:fintlb:MAX: \: %5.1lf%s (max)
	GPRINT:fintlb:MIN: \: %5.1lf%s (min)
	GPRINT:fintlb:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:fztlb=flexlm.rrd:FuzzyToolbox:AVERAGE
	LINE2:fztlb#00FF00:Fuzzy Toolbox
	COMMENT:\n
	GPRINT:fztlb:LAST:Fuzzy Toolbox \: %5.1lf%s (cur)
	GPRINT:fztlb:MAX: \: %5.1lf%s (max)
	GPRINT:fztlb:MIN: \: %5.1lf%s (min)
	GPRINT:fztlb:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:imgtlb=flexlm.rrd:ImageToolbox:AVERAGE
	LINE2:imgtlb#0000FF:Image Toolbox
	COMMENT:\n
	GPRINT:imgtlb:LAST:Image Toolbox \: %5.1lf%s (cur)
	GPRINT:imgtlb:MAX: \: %5.1lf%s (max)
	GPRINT:imgtlb:MIN: \: %5.1lf%s (min)
	GPRINT:imgtlb:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:compiler=flexlm.rrd:Compiler:AVERAGE
	LINE2:compiler#000066:Compiler
	COMMENT:\n
	GPRINT:compiler:LAST:Compiler \: %5.1lf%s (cur)
	GPRINT:compiler:MAX: \: %5.1lf%s (max)
	GPRINT:compiler:MIN: \: %5.1lf%s (min)
	GPRINT:compiler:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:neuralnettlb=flexlm.rrd:NeuralNetworkTool:AVERAGE
	LINE2:neuralnettlb#FFFF00:Neural Network Tool
	COMMENT:\n
	GPRINT:neuralnettlb:LAST:Neural Network Tool \: %5.1lf%s (cur)
	GPRINT:neuralnettlb:MAX: \: %5.1lf%s (max)
	GPRINT:neuralnettlb:MIN: \: %5.1lf%s (min)
	GPRINT:neuralnettlb:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:opttlb=flexlm.rrd:OptimizationToolbo:AVERAGE
	LINE2:opttlb#00FFFF:Optimization Toolbo
	COMMENT:\n
	GPRINT:opttlb:LAST:Optimization Toolbo \: %5.1lf%s (cur)
	GPRINT:opttlb:MAX: \: %5.1lf%s (max)
	GPRINT:opttlb:MIN: \: %5.1lf%s (min)
	GPRINT:opttlb:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:distributedtlb=flexlm.rrd:DistribComputingT:AVERAGE
	LINE2:distributedtlb#CC66CC:Distrib Computing T
	COMMENT:\n
	GPRINT:distributedtlb:LAST:Distrib Computing T \: %5.1lf%s (cur)
	GPRINT:distributedtlb:MAX: \: %5.1lf%s (max)
	GPRINT:distributedtlb:MIN: \: %5.1lf%s (min)
	GPRINT:distributedtlb:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:pdetlb=flexlm.rrd:PDEToolbox:AVERAGE
	LINE2:pdetlb#CCCC66:PDE Toolbox
	COMMENT:\n
	GPRINT:pdetlb:LAST:PDE Toolbox \: %5.1lf%s (cur)
	GPRINT:pdetlb:MAX: \: %5.1lf%s (max)
	GPRINT:pdetlb:MIN: \: %5.1lf%s (min)
	GPRINT:pdetlb:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:signaltlb=flexlm.rrd:SignalToolbox:AVERAGE
	LINE2:signaltlb#66CCCC:Signal Toolbox
	COMMENT:\n
	GPRINT:signaltlb:LAST:Signal Toolbox \: %5.1lf%s (cur)
	GPRINT:signaltlb:MAX: \: %5.1lf%s (max)
	GPRINT:signaltlb:MIN: \: %5.1lf%s (min)
	GPRINT:signaltlb:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:simulctrl=flexlm.rrd:SimulinkControlDe:AVERAGE
	LINE2:simulctrl#CCCC00:Simulink Control
	COMMENT:\n
	GPRINT:simulctrl:LAST:Simulink Control \: %5.1lf%s (cur)
	GPRINT:simulctrl:MAX: \: %5.1lf%s (max)
	GPRINT:simulctrl:MIN: \: %5.1lf%s (min)
	GPRINT:simulctrl:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:stattlb=flexlm.rrd:StatisticsToolbox:AVERAGE
	LINE2:stattlb#999966:Statistics Toolbox
	COMMENT:\n
	GPRINT:stattlb:LAST:Statistics Toolbox \: %5.1lf%s (cur)
	GPRINT:stattlb:MAX: \: %5.1lf%s (max)
	GPRINT:stattlb:MIN: \: %5.1lf%s (min)
	GPRINT:stattlb:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:symboltlb=flexlm.rrd:SymbolicToolbox:AVERAGE
	LINE2:symboltlb#660066:Symbolic Toolbox
	COMMENT:\n
	GPRINT:symboltlb:LAST:Symbolic Toolbox \: %5.1lf%s (cur)
	GPRINT:symboltlb:MAX: \: %5.1lf%s (max)
	GPRINT:symboltlb:MIN: \: %5.1lf%s (min)
	GPRINT:symboltlb:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:idtlb=flexlm.rrd:IdentificationTool:AVERAGE
	LINE2:idtlb#FF00FF:Identification Tool
	COMMENT:\n
	GPRINT:idtlb:LAST:Identification Tool \: %5.1lf%s (cur)
	GPRINT:idtlb:MAX: \: %5.1lf%s (max)
	GPRINT:idtlb:MIN: \: %5.1lf%s (min)
	GPRINT:idtlb:AVERAGE: \: %5.1lf%s (avg)\n

[flexlm2]
	TITLE Maple License counts
	YAXIS #

	DEF:maple11=flexlm.rrd:Maple11:AVERAGE
	LINE2:maple11#330033:Maple 11
	COMMENT:\n
	GPRINT:maple11:LAST:Maple 11 \: %5.1lf%s (cur)
	GPRINT:maple11:MAX: \: %5.1lf%s (max)
	GPRINT:maple11:MIN: \: %5.1lf%s (min)
	GPRINT:maple11:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:maplexls=flexlm.rrd:Maple11Excel:AVERAGE
	LINE2:maplexls#003333:Maple 11 Excel
	COMMENT:\n
	GPRINT:maplexls:LAST:Maple 11 Excel \: %5.1lf%s (cur)
	GPRINT:maplexls:MAX: \: %5.1lf%s (max)
	GPRINT:maplexls:MIN: \: %5.1lf%s (min)
	GPRINT:maplexls:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:mapleread=flexlm.rrd:MapleReader11:AVERAGE
	LINE2:mapleread#000033:Maple Reader 11
	COMMENT:\n
	GPRINT:mapleread:LAST:Maple Reader 11 \: %5.1lf%s (cur)
	GPRINT:mapleread:MAX: \: %5.1lf%s (max)
	GPRINT:mapleread:MIN: \: %5.1lf%s (min)
	GPRINT:mapleread:AVERAGE: \: %5.1lf%s (avg)\n

[flexlm3]
	TITLE Abacus License counts
	YAXIS #

	DEF:abaqus=flexlm.rrd:abaqus:AVERAGE
	LINE2:abaqus#006600:abaqus
	COMMENT:\n
	GPRINT:abaqus:LAST:abaqus \: %5.1lf%s (cur)
	GPRINT:abaqus:MAX: \: %5.1lf%s (max)
	GPRINT:abaqus:MIN: \: %5.1lf%s (min)
	GPRINT:abaqus:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:aqua=flexlm.rrd:aqua:AVERAGE
	LINE2:aqua#660000:aqua
	COMMENT:\n
	GPRINT:aqua:LAST:aqua \: %5.1lf%s (cur)
	GPRINT:aqua:MAX: \: %5.1lf%s (max)
	GPRINT:aqua:MIN: \: %5.1lf%s (min)
	GPRINT:aqua:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:design=flexlm.rrd:design:AVERAGE
	LINE2:design#330000:design
	COMMENT:\n
	GPRINT:design:LAST:design \: %5.1lf%s (cur)
	GPRINT:design:MAX: \: %5.1lf%s (max)
	GPRINT:design:MIN: \: %5.1lf%s (min)
	GPRINT:design:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:parallel=flexlm.rrd:parallel:AVERAGE
	LINE2:parallel#003300:parallel
	COMMENT:\n
	GPRINT:parallel:LAST:parallel \: %5.1lf%s (cur)
	GPRINT:parallel:MAX: \: %5.1lf%s (max)
	GPRINT:parallel:MIN: \: %5.1lf%s (min)
	GPRINT:parallel:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:cae=flexlm.rrd:cae:AVERAGE
	LINE2:cae#000066:cae
	COMMENT:\n
	GPRINT:cae:LAST:cae \: %5.1lf%s (cur)
	GPRINT:cae:MAX: \: %5.1lf%s (max)
	GPRINT:cae:MIN: \: %5.1lf%s (min)
	GPRINT:cae:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:cadparasol=flexlm.rrd:cadporterparasolid:AVERAGE
	LINE2:cadparasol#660066:cadporter parasolid
	COMMENT:\n
	GPRINT:cadparasol:LAST:cadporter parasolid \: %5.1lf%s (cur)
	GPRINT:cadparasol:MAX: \: %5.1lf%s (max)
	GPRINT:cadparasol:MIN: \: %5.1lf%s (min)
	GPRINT:cadparasol:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:standart=flexlm.rrd:standard:AVERAGE
	LINE2:standart#666600:standard
	COMMENT:\n
	GPRINT:standart:LAST:standard \: %5.1lf%s (cur)
	GPRINT:standart:MAX: \: %5.1lf%s (max)
	GPRINT:standart:MIN: \: %5.1lf%s (min)
	GPRINT:standart:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:explicit=flexlm.rrd:explicit:AVERAGE
	LINE2:explicit#006666:explicit
	COMMENT:\n
	GPRINT:explicit:LAST:explicit \: %5.1lf%s (cur)
	GPRINT:explicit:MAX: \: %5.1lf%s (max)
	GPRINT:explicit:MIN: \: %5.1lf%s (min)
	GPRINT:explicit:AVERAGE: \: %5.1lf%s (avg)\n

	DEF:foundation=flexlm.rrd:foundation:AVERAGE
	LINE2:foundation#333300:foundation
	COMMENT:\n
	GPRINT:foundation:LAST:foundation \: %5.1lf%s (cur)
	GPRINT:foundation:MAX: \: %5.1lf%s (max)
	GPRINT:foundation:MIN: \: %5.1lf%s (min)
	GPRINT:foundation:AVERAGE: \: %5.1lf%s (avg)\n

After those changes have been made to the Xymon Monitor server configuration files, the server process should be restarted.

To get all the graphs, in trends, the bb-hosts TRENDS tag needs to be added for each monitored Flex License Manager server eg:

 
10.0.0.10 host.example.net # TRENDS:*,flexlm:flexlm|flexlm1|flexlm2|flexlm3

flexlm

Show Code ⇲

Hide Code ⇱

#!/bin/sh
# 	$Id: flexlm,v 1.10 2008-06-20 12:54:42 annaj Exp $	
##################################################################
#                                                                #
# flexlm client module for Xymon monitor  V 1.0                 #
#                                                                #
# Copyright (C) 2008 Anna Jonna Armannsdottir                    #
#                                                                #
# Actually this is after the recipie given in:                   #
# http://www.hswn.dk/hobbit/help/howtograph.html                 #
#                                                                #
# This program is free software; you can redistribute it and/or  # 
# modify it under the terms of the GNU General Public License    #
# as published by the Free Software Foundation; either version 2 #
# of the License, or (at your option) any later version.         #
#                                                                #
# This program is distributed in the hope that it will be useful,#
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  #
# GNU General Public License for more details.                   #
#                                                                #
# You should have received a copy of the GNU General Public      #
# License along with this program; if not, write to the          #
# Free Software Foundation, Inc., 51 Franklin Street,            #
# Fifth Floor, Boston, MA  02110-1301, USA.                      #
#                                                                #
# This file is to be installed on each client that is to be      #
# monitored for Flex License Manager.                            #
# The link above says it all, but here is a quick install:       #
# Find the directory where the program lmstat is. Change the     #
# variable LMSTATDIR below to that directory. That is the only   #
# thing a user needs to change in this script. Copy this         #
# script to ~hobbit/client/ext/                                  #
# and make it executable for Xymon.                             #
#                                                                #
# For testing and verifying: Run the script in a shell and       #
# check that the  output is in /tmp/lic.txt                      #
#                                                                #
# In the file:                                                   #
# ~hobbit/client/etc/clientlaunch.cfg                            #
# Add the following section:                                     #
# [flexlminfo]                                                   #
#  ENVFILE $HOBBITCLIENTHOME/etc/hobbitclient.cfg                #
#  CMD $HOBBITCLIENTHOME/ext/flexlm                              #
#  INTERVAL 5m                                                   #
#                                                                #
# This is all that needs to be done on the client side.          #
#                                                                #
##################################################################
#

LMSTATDIR="/opt/matlab/etc"
LICENSEGREP="\:  \(Total of"

# ":  (Total of"
# "\:  \(Total of"
# "Total of"

# for testing out of Xymon environment 
if [ -z "$EGREP" ]; then
    EGREP="/bin/egrep"
fi

if [ -z "$SED" ]; then
    SED="/bin/sed"
fi

if [ -z "$AWK" ]; then
    AWK="/usr/bin/awk"
fi

if [ -z "$LMSTATDIR" ]; then
    LMSTATDIR="/opt/matlab/etc"
fi

if [ -z "$LICENSEGREP" ]; then
    LICENSEGREP="Total of"
fi

# The license manager has a component that is 
# used to deliver output to a file 
(
${LMSTATDIR}/lmstat -a  
) > /tmp/flexlm.txt

# The output from the license manager is 
# searched for lines that count actual license 
# usage. The result is delivered in /tmp/lic.txt file. 
(
$EGREP "${LICENSEGREP}" | \
$SED 's/://' | \
$AWK '{printf "%.19s : %d \n", $3, $11 }'
)< /tmp/flexlm.txt > /tmp/lic.txt

# The actual state of the license manager is checked 
# and prepared as part of report to Xymon monitor. 
UPTEST=`cat /tmp/flexlm.txt | $EGREP ".*MLM: UP.*$"`
LICSERVTEST=`cat /tmp/flexlm.txt | $EGREP ".*license server UP.*$" | $SED 's/://' | $AWK '{printf "%s\n", $1 }'`

if [ -n "$BB" ]; then

    if [ -n "$UPTEST" ]; then
	SSTATUS="Licenses OK"
	COLOUR="green"
	FLEXLMSTATE=`cat /tmp/lic.txt`
	if [ -n "$LICSERVTEST" ]; then
	    SSTATUS="Licenses on $LICSERVTEST OK"
	fi
    else
	SSTATUS="DOWN"
	COLOUR="red"
	FLEXLMSTATE=`cat /tmp/flexlm.txt`
    fi

# Finally, the gathered information is sent to the Xymon Monitor.     
$BB $BBDISP "status $MACHINE.flexlm $COLOUR `date` $SSTATUS

${FLEXLMSTATE}
"

fi

The monitor will send an alert if the monitored Flex LM is down, it will NOT send alerts if a partner Flex LM is down.

  • In version 1.1 fix the alerting, so it also alerts about partner Flex LM is down.
  • In version 2.0 use multi_ncv instead of the vanilla ncv. This simplifies configuration and gives all graphics on the test page.
  • Rewrite the module to enable alerts for license usage, similar to disk usage in Xymon Monitor.
  • The Xymon User mailing list.
  • Some existing Flex LM monitors are on deadcat.net and only the GPL ones were scrutinized, before I decided to write this monitor completely from scratch.
  • 2008-06-30
    • Initial release
  • monitors/flexlm.txt
  • Last modified: 2009/11/23 05:47
  • (external edit)