Ad Widget

Collapse

Monitor FlexLM licence status (not usage)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gwynll
    Junior Member
    • Apr 2021
    • 19

    #1

    Monitor FlexLM licence status (not usage)

    I've seen a couple of guides on how to get Zabbix to monitor how many FlexLM licenses are in use, but what I need instead is simpler than that - I just need to know if the licence is 'up' or not.

    I've set up an Item for 'net.tcp.listen[<port>]', and this does a good job in telling me whether there is a technical issue that stops the service from running for a particular licence file, however, it doesn't tell me when the licence itself has expired and no longer being issued. Because in those cases, the port is still listening, so as far as Zabbix is concerned everything is OK.

    Do you have any ideas of how I would monitor when a licence has expired?

    Thanks
  • gwynll
    Junior Member
    • Apr 2021
    • 19

    #2
    Hello,

    I've now done a bit more testing so I have more concrete info about what I need.

    Flex servers have an executable called 'lmutil' that's used by the licensing service, and running a status check on this gives the status of the license. This gives a load of text, but we can grep for "license server UP" and then count the number of times that that string appears, so we have a clear numerical indicator that Zabbix can use.

    This executable can be run remotely, using the port and server name that we're trying to monitor, so I can copy this file to a folder on the Zabbix server itself. Therefore if we can get Zabbix to run...

    lmutil lmstat -A -c 27009@licserver04 | grep -c "license server UP"

    Then it will give a numerical result of "1" if the licence is up, or a "0" if the licence is down.

    First question - where would be the most appropriate folder on the Zabbix server for me to copy the lmutil executable to?

    Then, would you be able to advise how to set this up in the Zabbix console? I must admit I'm new to Zabbix, but I'm guessing I'd need an Item and a trigger?

    Also, what would be really good is if the above could be set up in Zabbix in a way that the port number and server name are variables so that they can be used for the various combinations of flex licenses that we have over several servers and ports - about 20 in total).

    Many thanks for your help.

    Comment

    • gwynll
      Junior Member
      • Apr 2021
      • 19

      #3
      Thanks very much for that. OK here's what I've done...

      Firstly I saw that the externalscripts folder was not set in the zabbix_server.conf file, and running 'zabbix_server --help' showed me that the default location is /usr/share/zabbix/externalscripts. The externalscripts folder sisn't actually exist in this location, so I created it.

      I then created a file called /usr/share/zabbix/externalscripts/flexlm.sh with the following code:

      lmutil lmstat -A -c {$FLEXLM_PORT}@{$FLEXLM_SERVER} | grep -c "license server UP"

      I created a new group called 'FlexLM servers'.

      I created a new template called 'FlexLM licence status', assigned to the above group. In Macros section of the template, I've created two macros, {$FLEXLM_SERVER} and {$FLEXLM_PORT} - I left the 'value' fields blank because I didn't know what to put there. Then within the template I created a new Item, with Type = Script, and the following item key:

      flexlm.sh["{$FLEXLM_PORT}","{$FLEXLM_SERVER}"]

      Then, without changing anything else, I clicked Test, and in the 'Test item' box that popped up I set a value for both Macros.

      But when I click 'Get value' I get 'Cannot execute script: undefined return value'

      Do you know what I've done wrong?

      Thanks.

      Comment

      • gwynll
        Junior Member
        • Apr 2021
        • 19

        #4
        Hi, is it only within the flexlm.sh script that I should make the swap? i.e. do I need to also change the Item key and the Macros in the template? If the only change is within the bash script, what would be the relationship between the $1 and $2 variables and the 'proper' variable? i.e. do I use 'echo' statements like in the link you provided?

        Thanks.

        Comment

        • gwynll
          Junior Member
          • Apr 2021
          • 19

          #5
          I've been trying different things for the variables, but I'm still not able to get it right. I'm currently on this...

          #!/bin/sh
          1="FLEXLM_PORT"
          2="FLEXLM_SERVER"
          /usr/share/zabbix/externalscripts/lmutil lmstat -A -c $1@$2 | grep -c "license server UP"

          I've made it executable using chmod 755. I've probably got something wrong in the script as I'm still getting 'undefined return value'. Could you advise?

          I've also tried as above but swapping the two middle lines for these...

          echo "1 $FLEXLM_PORT";
          echo "2 $FLEXLM_SERVER";

          But that didn't work either

          Thanks.
          Last edited by gwynll; 09-06-2021, 17:51.

          Comment

          • cyber
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • Dec 2006
            • 4806

            #6
            To be honest, this is not really a Zabbix question.. I, for example, have no idea, what is flexLM.. Probably many others also...You should be searching answer to a question, how to identify expired license and only after that try to adopt this solution to Zabbix..

            Comment

            • cyber
              Senior Member
              Zabbix Certified SpecialistZabbix Certified Professional
              • Dec 2006
              • 4806

              #7
              Thee is a externalscripts folder in zabbix installation. Put it there. You probably need a wrapper script also, which puts lmutil and grep together. And then read

              Key paramters can be given via user macros, so here's your "variables"..

              Comment

              • cyber
                Senior Member
                Zabbix Certified SpecialistZabbix Certified Professional
                • Dec 2006
                • 4806

                #8
                I guess your shell script does not not know anything about {$FLEXLM_PORT} etc... I think you should replace that part in that flexlm.sh script with $1 and $2 in that ...
                https://www.baeldung.com/linux/use-c...in-bash-script

                Comment

                • cyber
                  Senior Member
                  Zabbix Certified SpecialistZabbix Certified Professional
                  • Dec 2006
                  • 4806

                  #9
                  Yes.. only script. No need to change items, keys etc...
                  Calling script as "flexlm.sh["{$FLEXLM_PORT}","{$FLEXLM_SERVER}"]" in GUI, Zabbix calls it as "flexlm.sh '{$FLEXLM_PORT}' '{$FLEXLM_SERVER}'", your script takes here {$FLEXLM_PORT} as $1 and {$FLEXLM_SERVER as $2 and executes "lmutil lmstat -A -c $1@$2 | grep -c "license server UP""
                  If this is absolutely alien talk to you, maybe you should ask someone, who has done some shell scripts...

                  Comment

                  Working...