Anna, and All actual here how I modified your script.
Basicly I put a do loop around Anna version that parses a config file: params.lm. This is a list we use for an existing flexlm tracker.
With entries that look like:
'MATLAB_7.0_mysys 1700 at mysys'
Ok I've not the time to explain in detail but here are the key point ${LMSTATDIR}/lmstat -a -c $LIC Where $LIC is the last field on the line
I actually use the first field as $MACHINE and parse out the licencesname from $MACHINE into TEST TEST is very important as this sets the column name which MUST match the graph!
The very bad part of my scheme is if I want graphs I need for each license type MATLAB Maple LSF etc add/add-on 3 lines
trends="................LSF= GRAPHS="..............LSF" NCV_LSF="*:GAUGE"
Since my user are used to seeing a table formated like:
MATLAB_7.0_mysys today# thisweeks# lastweek# .....
I set up pseudo hosts like: 0.0.0.0 MATLAB_7.0_mysys # noconn TRENDS=:*,MATLAB:MATLAB|MATLAB1
So the hobbit page looks like: MATLAB info trends
MATLAB_7.0_mysys dot dot dot
You got to make your graphs defs too (MATLAB MATLAB1)
#!/usr/bin/bash
$Id: flexlm,v 1.10 2008-06-20 12:54:42 annaj Exp $
##################################################################
flexlm client module for Hobbit 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 Hobbit.
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.
##################################################################
while read L
do
set $L
MACHINE=$1
LIC=$2
TEST=echo $MACHINE | awk -F_ '{print $1}'
LMSTATDIR="/sw/matlab7.1/etc/"
#LMSTATDIR="/home/www/lmstat/"
LICENSEGREP="\: \(Total of"
for testing out of Hobbit environment
if [ -z "$EGREP" ]; then EGREP="/bin/egrep" fi
if [ -z "$SED" ]; then SED="/bin/sed" fi #SED="/usr/local/bin/sed" #if [ -z "$AWK" ]; then #AWK="/usr/bin/awk" #fi
AWK="/usr/local/bin/awk"
if [ -z "$LMSTATDIR" ]; then LMSTATDIR="/sw/matlab7.1/etc/"
LMSTATDIR="/opt/matlab/etc"
fi
if [ -z "$LICENSEGREP" ]; then LICENSEGREP="Total of" fi
TEST=echo $MACHINE | $AWK -F_ '{print $1}'
The license manager has a component that is
used to deliver output to a file
( ${LMSTATDIR}/lmstat -a -c $LIC ) > /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.
(
#echo $TEST >/tmp/lic.txt$$
echo $L >/tmp/lic.txt$$
echo "" >>/tmp/lic.txt$$
$EGREP "${LICENSEGREP}" |
$SED 's/://' |
$AWK '{printf "M%.19s : %d \n %.19s : %d \n", $3, $6, $3, $11 }'
#$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 Hobbit monitor.
UPTEST=cat /tmp/flexlm.txt$$ | $EGREP ".*: UP.*$v.*"
#UPTEST=cat /tmp/flexlm.txt | $EGREP ".*MLM: UP.*$"
#LOOK OUT the below LICSERVTEST IS a single line!
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 Hobbit Monitor.
$BB $BBDISP "status $MACHINE.$TEST $COLOUR date $SSTATUS
${FLEXLMSTATE} "
fi rm /tmp/flexlm.txt$$ rm /tmp/lic.txt$$ done < params.lm
On fös, 2008-07-18 at 08:15 -0400, michael nemeth wrote:
Anna, and All actual here how I modified your script.
Thanks! This is very interesting. It gives me some ideas to try out as a server side test. Maybe it is possible to take the script even further, and define it even further and define the host tests, like e.g. flexlm://mysys:1700 Then you would not even need the config file. Anyway it is just an idea.
It is very interesting to see this as a client side test and as a server side test. The users will be happy that they can choose themselves if they want the client side or the serverside test. If a user wants to have both sides on the same host, they can rename the tests to flexlms and flexlmc. So the user can have the best of both worlds.
-- Kindest Regards, Anna Jonna Ármannsdóttir, %& A: Because people read from top to bottom. Unix System Aministration, Computing Services, %& Q: Why is top posting bad? University of Iceland.
Not sure what you mean here how that would work:
and define the host tests, like e.g. flexlm://mysys:1700
I had thought of parsing the bb-hosts line but since I already had a list and one with a easy to parse naming convention I went that way. Also I was afraid that it would interfere with other stuff on e line.
Actual I test your script on the server side by hardcoding lmstat -a -c 2277 at mobile2 !
Anna Jonna Armannsdottir wrote:
On fös, 2008-07-18 at 08:15 -0400, michael nemeth wrote:
Anna, and All actual here how I modified your script.
Thanks! This is very interesting. It gives me some ideas to try out as a server side test. Maybe it is possible to take the script even further, and define it even further and define the host tests, like e.g. flexlm://mysys:1700 Then you would not even need the config file. Anyway it is just an idea.
It is very interesting to see this as a client side test and as a server side test. The users will be happy that they can choose themselves if they want the client side or the serverside test. If a user wants to have both sides on the same host, they can rename the tests to flexlms and flexlmc. So the user can have the best of both worlds.
participants (2)
-
annaj@hi.is
-
michael.nemeth@lmco.com