Ad Widget

Collapse

Monitoring FlexLM license usage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • StarDestroyer
    Junior Member
    • Jun 2014
    • 20

    #1

    Monitoring FlexLM license usage

    I wanted to be able to monitor usage on my FlexLM based license server, but was unable to find much to help out. Instead, I wrote my very first external script and figured I'd share it here for anybody else that may be interested.

    You first need to have lmutil working on your system. I was able to download it for my CentOS 6 system place it in /usr/local/bin. If you place the utility in another directory, you'll need to update the script below.

    This is not a LLD based script in any way, shape or form. Once you have the script in your externalscripts directory, you'll need to manually create two items for each license you want to monitor:
    1. lmstat.pl[-H,{HOST.CONN},-p,27000,-f,feature,--issued]
    2. lmstat.pl[-H,{HOST.CONN},-p,27000,-f,feature,--used]

    (Make sure you change the port, if necessary, and the feature.)

    You can then setup a trigger for the --issued item (.last(0)=0) if you desire to get an alert when it doesn't detect any issued licenses. You can also set up graphs if you so desire.

    lmstat.pl:
    PHP Code:
    #!/usr/bin/perl

    use strict;
    use Switch;

    my $lmutil '/usr/local/bin/lmutil';

    sub usage {
        print <<
    _END_USAGE_;
    This utility uses the 'lmutil' application to gather information from FlexLM.
    You must have 'lmutil' installed and accessibleThis utility only returns
    either the number of issued licenses 
    or the number of licenses in use.

    Usage:
      
    lmstat.pl -<hostname> -<port> -<feature> (--issued|--used)
        -
    <hostname>
            
    The hostname or IP address of the license server

        
    -<port>
            
    The port number for the license you want to gather information for.

        -
    <feature>
            
    Feature name

        
    (--issued|--used)
            
    Specify which statistic you want want information for.

    _END_USAGE_
        
    exit;
    }

    if (
    $ARGV[0eq '--help') {
        
    usage();
    }

    # Get configuration information for the running of this script
    my ($hostname$port$feature$stat);
    while (
    my $s shift(@ARGV)) {
        switch(
    $s) {
            case 
    "-H" $hostname shift(@ARGV); }
            case 
    "-p" $port shift(@ARGV); }
            case 
    "-f" $feature shift(@ARGV); }
            case 
    "--issued" $stat 'issued'; }
            case 
    "--used"   $stat 'used'; }
            else { print 
    "INVALID SYNTAX\n\n"usage(); }
        }
    }

    my $lmstat_out = `$lmutil lmstat -f $feature -c $port\@$hostname`;

    my $value "";
    foreach 
    my $line (split("\n"$lmstat_out)) {
        if (
    $line =~ /Users of \Q$feature\E:.+Total of ([0-9]+) licensesissued;\s+Total of ([0-9]+) licensesin use/) {
            switch (
    $stat) {
                case 
    "issued"  $value = $1; }
                case 
    "used"    $value = $2; }
            }
        }
    }

    # We do this because we can't seem to trigger on 'nodata'
    if ($stat eq 'issued' && $value eq '') {
        
    # If we're looking for how many licenses are issued and we got nothing,
        # then return a value of '0'. Keep the blank (error) for used licenses.
        
    $value 0;
    }

    print 
    "$value\n"
  • aib
    Senior Member
    • Jan 2014
    • 1615

    #2
    Thank you for sharing!
    Sincerely yours,
    Aleksey

    Comment

    • miramira007
      Member
      • Sep 2015
      • 89

      #3
      Thanks for posting! :-) Can some one tell me, where lmutil should run? When we are talking about external scripts, so it had to work on zabbix server side, or not?

      Comment

      • StarDestroyer
        Junior Member
        • Jun 2014
        • 20

        #4
        The lmutil binary and the lmutil.pl file above both need to be on the Zabbix server that will be doing the polling. In my environment, that's my server with zabbix-proxy installed.

        Comment

        • miramira007
          Member
          • Sep 2015
          • 89

          #5
          Ok, thanks i will try later. :-)

          Comment

          • limbooface
            Member
            • Jun 2016
            • 77

            #6
            Does this work with Zabbix 3.0

            lmstat.pl[-H,{HOST.CONN},-p,27000,-f,feature,--issued]
            lmstat.pl[-H,{HOST.CONN},-p,27000,-f,feature,--used]

            Does the above items work with zabbix 3.0?

            If so do I enter the above line the key field in the item?

            Comment

            • limbooface
              Member
              • Jun 2016
              • 77

              #7
              so I had this working on zabbix 3.0 and then I added a new license it does not work anymore.
              is not suitable for value type [Numeric (unsigned)] and data type [Decimal]

              Comment

              • wladimir50
                Junior Member
                • Nov 2018
                • 9

                #8
                Thanks for sharing!
                tested on 4,0 and works like a dream ... more detailed documentation for noobs like me will be great, but still great work !

                Comment

                • speculatrix
                  Junior Member
                  • Jan 2018
                  • 7

                  #9
                  I published a template, conf and script: https://github.com/speculatrix/zabbix-flexlm
                  works on linux only.

                  Comment

                  • m_pahlevanzadeh
                    Junior Member
                    • Jun 2022
                    • 28

                    #10
                    this is very useful link : https://www.zabbix.com/documentation...l/config/items

                    Comment

                    Working...