Skip to content

gitnol/PRTG_FlexLM_License_Usage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

PRTG FlexLM License Usage Sensor Script

This script is designed to be used as a PRTG custom sensor to monitor FlexLM license usage. It parses license usage logs and reports the number of currently checked-out licenses for various products, providing multiple channels for monitoring each product.

Features

  • Retrieves FlexLM license usage data from the specified server.
  • Parses log files and extracts detailed information about license usage (checkout and return events).
  • Provides multiple channels in PRTG, one for each license type, displaying the number of active licenses.
  • Dynamically adjusts the monitored license count based on log activity.

How to Use

  1. Copy the script
    Place the script on the PRTG Server C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML

  2. Create a Custom Sensor

    • Log into your PRTG interface.
    • Create a new custom sensor on the device that should monitor the license server.
    • Select "EXE/Script Advanced" as the sensor type.
    • Point the sensor to the script file and provide the required parameter (Servername) in the sensor settings.
      • Parameters = -Servername %device

      • image

      • Security Context = Use Windows credentials of parent device (make sure to specify the credentials, which have the rights to access the target server via Powershell, try Enter-PSSession -ComputerName $myServer -Credentials (Get-Credential)

      • Scanning interval = 10 Minutes (should be sufficient. The script may run for some seconds depending on the size of the C:\Program Files (x86)\SOLIDWORKS Corp\SolidNetWork License Manager\lmgrd.log

      • image

  3. Script Parameters

    • Servername: The name of the FlexLM license server that the script should connect to. Keep in mind to use %device within PRTG.
  4. Channels
    The script dynamically creates a PRTG sensor channel for each unique license found in the log file. For each channel, the number of licenses currently checked out will be reported.

    Example Output of the script for PRTG

    <prtg>
    <result>
      <channel>ProductA</channel>
      <value>5</value>
    </result>
    <result>
      <channel>ProductB</channel>
      <value>2</value>
    </result>
    <result>
      <channel>ProductC</channel>
      <value>0</value>
    </result>
    </prtg>
    

    Each tag represents a license type and the corresponding number of checked-out licenses.

  5. Requirements

  • PowerShell 5.1 or later
  • Access to the FlexLM license manager's log files
  • PRTG with permissions to run PowerShell scripts on the probe
  1. Problems

    • On any problems try to execute the script in a powershell session and add the credential parameter.
      $cred = Get-Credential
      Invoke-Command -ScriptBlock $scriptblock -ComputerName $Servername -Credential $cred
      
  2. Bonus / Additional Export

    • If you aditionally want to export the license usage to a specific folder, just uncomment the following two lines in the script.
      $filename = "C:\LicenseUsage\lmgrd_log_analyze_" + (get-date).ToString("yyyyMMdd_HHmmss") + ".csv"
      $result | Export-Csv -LiteralPath $filename -NoClobber -Encoding UTF8 -Delimiter ";"
      
    • (Keep in mind, that the lmgrd logfile is being resetted on every server restart / service restart and that the logfile is being overwritten by the service.)
  3. License

  • This script is provided as-is, with no warranty or support. Feel free to modify it to suit your environment.

About

PRTG sensor to monitor license usage of products (FlexLM Logfile Analyzer)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published