📜 ⬆️ ⬇️

Zabbix: LLD monitoring of FlexLM services (UPDATED)

image

This article - a more detailed study of the previous one . Now the template is unified for use in both Windows (PowerShell) and Linux (Bash). If you used the previous template, then everything should get bolt-on.

What can: find servers / licenses, read server status, read the total and used number of licenses, in case of errors, sends status codes (description line) and reports them.
')
The scheme is the same:




Template


Everything is simple here: imported and forgotten. The template was designed in Zabbix version 3.2, keep this in mind.

As well as last time, for readability, macros of the {$ {# ID}} structure are used in the names of elements and triggers. The template already contains a number of macros; you simply add your transformations based on the elements found.

Also inside there are already several basic triggers for monitoring the status of servers and individual licenses.

Template
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>3.2</version>
<date>2017-08-27T16:36:39Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Software - FlexLm</template>
<name>Software - FlexLm</name>
<description> FlexLm.&#13;
, .&#13;
&#13;
UserParameter:&#13;
UserParameter=ZScript[*],powershell C:\System\Zabbix\Scripts$1.ps1 $2 $3&#13;
UserParameter=ZScript[*],bash /etc/zabbix/scripts/$1.sh $2 $3&#13;
&#13;
:&#13;
flex.ps1 -&gt; C:\System\Zabbix\Scripts\&#13;
flex.sh -&gt; /etc/zabbix/scripts/&#13;
&#13;
Windows:&#13;
(Path) lmutil.exe.&#13;
: C:\Program Files (x86)\CSoft\CS License Server&#13;
&#13;
Linux:&#13;
flex.sh</description>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>FlexLm</name>
</application>
</applications>
<items/>
<discovery_rules>
<discovery_rule>
<name> </name>
<type>0</type>
<snmp_community/>
<snmp_oid/>
<key>ZScript[flex,discovery2]</key>
<delay>3600</delay>
<status>0</status>
<allowed_hosts/>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<delay_flex/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<filter>
<evaltype>0</evaltype>
<formula/>
<conditions/>
</filter>
<lifetime>7</lifetime>
<description/>
<item_prototypes>
<item_prototype>
<name> {${#ID}}</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>ZScript[flex,{#ID},status]</key>
<delay>60</delay>
<history>90</history>
<trends>0</trends>
<status>0</status>
<value_type>1</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>FlexLm</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<application_prototypes/>
</item_prototype>
</item_prototypes>
<trigger_prototypes>
<trigger_prototype>
<expression>{Software - FlexLm:ZScript[flex,{#ID},status].regexp(^UP.*)}&lt;&gt;1</expression>
<recovery_mode>0</recovery_mode>
<recovery_expression/>
<name>FLEXLM- {${#ID}} {HOST.NAME}</name>
<correlation_mode>0</correlation_mode>
<correlation_tag/>
<url/>
<status>0</status>
<priority>3</priority>
<description/>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>
<tags/>
</trigger_prototype>
</trigger_prototypes>
<graph_prototypes/>
<host_prototypes/>
</discovery_rule>
<discovery_rule>
<name> </name>
<type>0</type>
<snmp_community/>
<snmp_oid/>
<key>ZScript[flex,discovery]</key>
<delay>3600</delay>
<status>0</status>
<allowed_hosts/>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<delay_flex/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<filter>
<evaltype>0</evaltype>
<formula/>
<conditions/>
</filter>
<lifetime>7</lifetime>
<description/>
<item_prototypes>
<item_prototype>
<name>{${#ID}} - </name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>ZScript[flex,{#ID},active]</key>
<delay>60</delay>
<history>30</history>
<trends>90</trends>
<status>0</status>
<value_type>0</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>FlexLm</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<application_prototypes/>
</item_prototype>
<item_prototype>
<name>{${#ID}} - </name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>ZScript[flex,{#ID},total]</key>
<delay>1800</delay>
<history>30</history>
<trends>90</trends>
<status>0</status>
<value_type>0</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>FlexLm</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<application_prototypes/>
</item_prototype>
</item_prototypes>
<trigger_prototypes>
<trigger_prototype>
<expression>{Software - FlexLm:ZScript[flex,{#ID},active].last()}&lt;0</expression>
<recovery_mode>0</recovery_mode>
<recovery_expression/>
<name> {${#ID}} {HOST.NAME}</name>
<correlation_mode>0</correlation_mode>
<correlation_tag/>
<url/>
<status>0</status>
<priority>3</priority>
<description/>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>
<tags/>
</trigger_prototype>
</trigger_prototypes>
<graph_prototypes/>
<host_prototypes/>
</discovery_rule>
</discovery_rules>
<httptests/>
<macros>
<macro>
<macro>{$ACD_2006_0F}</macro>
<value>AutoCAD 2013</value>
</macro>
<macro>
<macro>{$ACD_2013_0F}</macro>
<value>AutoCAD 2006</value>
</macro>
<macro>
<macro>{$ADSKFLEX}</macro>
<value>Autodesk</value>
</macro>
<macro>
<macro>{$CSOFT}</macro>
<value>CSoft</value>
</macro>
<macro>
<macro>{$NANOCONSTRSUITE}</macro>
<value>NanoCAD </value>
</macro>
<macro>
<macro>{$NANOCONSTRSUITE_FOUND}</macro>
<value>NanoCAD ()</value>
</macro>
<macro>
<macro>{$NANOCONSTRSUITE_RFCONCR}</macro>
<value>NanoCAD ()</value>
</macro>
<macro>
<macro>{$NANOELS}</macro>
<value>NanoCAD </value>
</macro>
<macro>
<macro>{$NANOSOFT}</macro>
<value>NanoSoft</value>
</macro>
<macro>
<macro>{$SPDS}</macro>
<value> Graphics</value>
</macro>
</macros>
<templates/>
<screens/>
</template>
</templates>
</zabbix_export>
view raw Software - FlexLm.xml hosted with ❤ by GitHub


Windows script


The script for Windows was written under Windows 7 SP1 on PSv4, on XP it does not work . Of course, the server should allow running PowerShell scripts ( Set-ExecutionPolicy Unrestricted ).

flex.ps1
# 2017/08/24 AcidVenom v3
# FlexLm Zabbix
param($1,$2)
# FlexLm
# : discovery
if ($1 -eq "discovery") {
$items = lmutil lmstat -a | ? {$_ -match "Users of "}
if ($items -eq $null) {exit}
else {
write-host -NoNewline "{`"data`":["
$n = 0
foreach ($obj in $items) {
$n = $n + 1
$obj = $obj.trimstart("Users of ")
$obj = $obj.substring(0,$obj.IndexOf(":")).ToUpper()
$line = "{`"{#ID}`":`"" + $obj + "`"}"
If ($n -lt $items.Count) { $line = "$line,"}
write-host -NoNewline $line
}
write-host -NoNewline "]}"
}
}
# FlexLm
# : discovery2
elseif ($1 -eq "discovery2") {
$items = lmutil lmstat -vg | ? {$_ -match "^\s" -and $_ -notmatch "status" -and $_ -notmatch "license"}
if ($items -eq $null) {exit}
else {
write-host -NoNewline "{`"data`":["
$n = 0
foreach ($obj in $items) {
$n = $n + 1
$obj = $obj.substring(0,$obj.IndexOf(":")).trim( ).ToUpper()
$line = "{`"{#ID}`":`"" + $obj + "`"}"
If ($n -lt $items.Count) { $line = "$line,"}
write-host -NoNewline $line
}}
write-host -NoNewline "]}"
}
#
# : discovery
else {
if ($2 -eq "status") {
$out = lmutil lmstat -vg
$error = $out -match "license server UP"
if ($error -ne $False) {
$obj = $out -match "$1`:"
$obj = $obj.trim( )
$obj = $obj.substring($obj.IndexOf(":")+2,$obj.Length-$obj.IndexOf(":")-2)
}
else {
$obj = $out -match "Error"
$obj = $obj.substring($obj.IndexOf(":")+2,$obj.Length-$obj.IndexOf(":")-2)
}
}
else {
$out = lmutil lmstat -a | ? {$_ -match "Users of $1`:"}
$error = $out -match "Error"
if ($error -eq $False) {
if ($2 -eq "active") {
$obj = $out.substring($out.LastIndexOf("Total of")+9,$out.LastIndexOf("license")-$out.LastIndexOf("Total of")-9)
}
elseif ($2 -eq "total") {
$obj = $out.substring($out.IndexOf("Total of")+9,$out.IndexOf("license")-$out.IndexOf("Total of")-9)
}
}
else {
$obj = -1
}
}
Write-Output $obj
}
view raw flex.ps1 hosted with ❤ by GitHub


Indicators of the licensing server are taken from the utility lmutil.exe , which is included in the distributions of different vendors. For normal operation of the script, it is necessary to register the path to it in the system environment variables in the Path variable without quotes. For example, the default for CSoft v11.5 is the folder “ C: \ Program Files (x86) \ CSoft \ CS License Server ”, and for Autodesk v11.13.1 - “ C: \ Autodesk \ Network License Manager ”. Use ";" as a separator.

If you are using an Autodesk license server, then look at the feature under the spoiler.

Spoiler
With this developer it turned out not so simple. Out of the box lmutil gives an error -1.359. Although if you specify the port @ host, then everything is fine.



This behavior is most likely due to the fact that in older versions of FLEXlm lmutil compares the paths of the variables LM_LICENSE_FILE and VENDOR_LICENSE_FILE. These paths are standard and do not exist by default.

To solve this, it is enough to take lmutil.exe version 11.5 from an arbitrary package ( CSoft / Nanosoft ). Or execute a command on the host

lmutil lmpath -override all "path_to_file_ your_lend_ license"



Similarly, you can use the command

lmutil lmpath -add "arbitrary_ vendor_name" "path_to_file_length_file"

These commands must be executed on behalf of the system account, otherwise the Zabbix agent will not be able to work with the utility. You can do this using the PsExec utility with the -s key: psexec -s cmd and enter the necessary commands in the opened command line window.

You can learn more about these and other commands from the licensing instructions , I recommend reading them during debugging.

Linux Script


And this script was written under Ubuntu. How to install the Autodesk license server on Ubuntu step by step, read below (Ubuntu is not officially supported).

You copy the script to an arbitrary folder on the server (its path is specified in the agent's config, below), do not forget to give the appropriate rights for its execution.

You must also specify in the script the directory of the utility lmutil in the section "User variables".

flex.sh (updated 2017/10/26)
Fixed regulars for detecting the number of licenses
Fixed server detection when their> = 2
#!/bin/bash
# 2017/10/26 AcidVenom v2.1
# FlexLm Zabbix
#
lmutil="/opt/flexnetserver/lmutil"
#
IFS=$'\n'
JSON="{\"data\":["
SEP=""
#
# : discovery
if [ "$1" = "discovery" ]
then
licenses=`$lmutil lmstat -a | grep "Users of "`
for license in $licenses
do
ID=`echo $license | sed 's/:.*$\|Users of //g' | sed 's/ //g' | sed 's/[[:lower:]]/\u&/g'`
JSON=$JSON"$SEP{\"{#ID}\":\"$ID\"}"
SEP=", "
done
JSON=$JSON"]}"
echo $JSON
#
# : discovery2
elif [ "$1" = "discovery2" ]
then
servers=`$lmutil lmstat -vg | grep "^\s" | grep -vi "license"`
for server in $servers
do
ID=`echo $server | sed "s/ \|:.*//g" | sed 's/[[:lower:]]/\u&/g'`
JSON=$JSON"$SEP{\"{#ID}\":\"$ID\"}"
SEP=", "
done
JSON=$JSON"]}"
echo $JSON
#
# : discovery
else
if [ "$2" = "status" ]
then
out=`$lmutil lmstat -vg`
error=`echo "$out" | grep "license server UP"`
if [ -n "$error" ]
then
status=`echo "$out" | grep -i "$1:" | sed 's/^.*: //'`
echo $status
else
status=`echo "$out" | grep "Error" | sed 's/^.*: //'`
echo $status
fi
else
out=`$lmutil lmstat -a | grep -i "Users of $1:"`
error=`echo "$out" | grep "Error"`
if [ -n "$error" ]
then
echo "-1"
else
if [ "$2" = "active" ]
then
active=`echo "$out" | sed 's/^.*; *Total of \| license.*//g'`
echo $active
elif [ "$2" = "total" ]
then
total=`echo "$out" | sed 's/ license.*\|.*(Total of //g'`
echo $total
fi
fi
fi
fi
view raw flex.sh hosted with ❤ by GitHub


Zabbix agent configuration


To achieve simultaneous operation of different systems from one template allows the correct configuration of the agent, or rather its part UserParameter. This method is also allowed to forget once and for all about restarting the agent if new functionality is added in the form of scripts. This is important for high-load servers, where you can lose some of the metrics when you restart the agent.

So, in this case the line is used:

for Windows - UserParameter = ZScript [*], powershell C: \ Zabbix \ Scripts \ $ 1.ps1 $ 2 $ 3 $ 4

for Linux - UserParameter = ZScript [*], bash /etc/zabbix/scripts/$1.sh $ 2 $ 3 $ 4
Ways and number of variables you specify. Variables can be specified with a margin, it will not be superfluous. And the necessary scripts can be accessed using the ZScript key [$ 1, $ 2, $ 3, $ 4] .

Thanks for attention!

Thanks
I would like to thank my employer for the motivation to write an article. If it were not for you, then I would not have to optimize the load on our weak servers, transferring services to Ubuntu Server!


Update! 2017/12/26


In connection with the latest trends, I decided to rewrite everything for a server version of work without user parameters and scripts on clients. You will need a template and script in the external checks directory (for Ubuntu - / usr / lib / zabbix / externalscripts ). Do not forget to give the appropriate rights to execute this file. Template exported from version 3.4.4. From innovations: now Zabbix gets a list of active users of this or that license.
Software - FlexLM.xml
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>3.4</version>
<date>2017-12-26T07:45:55Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Software - FlexLM</template>
<name>Software - FlexLM</name>
<description> FlexLM ( )&#13;
&#13;
zabbix_get flexlm.sh .</description>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>FlexLM</name>
</application>
</applications>
<items/>
<discovery_rules>
<discovery_rule>
<name> </name>
<type>10</type>
<snmp_community/>
<snmp_oid/>
<key>flexlm.sh[{HOST.CONN},discoveryl]</key>
<delay>1h</delay>
<status>0</status>
<allowed_hosts/>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<filter>
<evaltype>0</evaltype>
<formula/>
<conditions/>
</filter>
<lifetime>3d</lifetime>
<description/>
<item_prototypes>
<item_prototype>
<name>{${#LICENSE}} - </name>
<type>10</type>
<snmp_community/>
<snmp_oid/>
<key>flexlm.sh[{HOST.CONN},{#LICENSE},active]</key>
<delay>2m</delay>
<history>90d</history>
<trends>365d</trends>
<status>0</status>
<value_type>0</value_type>
<allowed_hosts/>
<units/>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>FlexLM</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<application_prototypes/>
<master_item_prototype/>
</item_prototype>
<item_prototype>
<name>{${#LICENSE}} - </name>
<type>10</type>
<snmp_community/>
<snmp_oid/>
<key>flexlm.sh[{HOST.CONN},{#LICENSE},total]</key>
<delay>10m</delay>
<history>90d</history>
<trends>365d</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>FlexLM</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<application_prototypes/>
<master_item_prototype/>
</item_prototype>
<item_prototype>
<name>{${#LICENSE}} - </name>
<type>10</type>
<snmp_community/>
<snmp_oid/>
<key>flexlm.sh[{HOST.CONN},{#LICENSE},users]</key>
<delay>2m</delay>
<history>90d</history>
<trends>0</trends>
<status>0</status>
<value_type>4</value_type>
<allowed_hosts/>
<units/>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>FlexLM</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<application_prototypes/>
<master_item_prototype/>
</item_prototype>
<item_prototype>
<name> lmutil lmstat -f {#LICENSE}</name>
<type>0</type>
<snmp_community/>
<snmp_oid/>
<key>system.run[&quot;lmutil lmstat -f {#LICENSE}&quot;]</key>
<delay>5m</delay>
<history>1h</history>
<trends>0</trends>
<status>1</status>
<value_type>4</value_type>
<allowed_hosts/>
<units/>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>FlexLM</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<application_prototypes/>
<master_item_prototype/>
</item_prototype>
</item_prototypes>
<trigger_prototypes>
<trigger_prototype>
<expression>{Software - FlexLM:flexlm.sh[{HOST.CONN},{#LICENSE},active].last()}=-1</expression>
<recovery_mode>0</recovery_mode>
<recovery_expression/>
<name> {${#LICENSE}} {HOST.NAME}</name>
<correlation_mode>0</correlation_mode>
<correlation_tag/>
<url/>
<status>0</status>
<priority>3</priority>
<description/>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>
<tags/>
</trigger_prototype>
</trigger_prototypes>
<graph_prototypes/>
<host_prototypes/>
<jmx_endpoint/>
</discovery_rule>
<discovery_rule>
<name> </name>
<type>10</type>
<snmp_community/>
<snmp_oid/>
<key>flexlm.sh[{HOST.CONN},discoverys]</key>
<delay>1h</delay>
<status>0</status>
<allowed_hosts/>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<filter>
<evaltype>0</evaltype>
<formula/>
<conditions/>
</filter>
<lifetime>3d</lifetime>
<description/>
<item_prototypes>
<item_prototype>
<name> {${#SERVER}}</name>
<type>10</type>
<snmp_community/>
<snmp_oid/>
<key>flexlm.sh[{HOST.CONN},{#SERVER},status]</key>
<delay>1m</delay>
<history>90d</history>
<trends>0</trends>
<status>0</status>
<value_type>1</value_type>
<allowed_hosts/>
<units/>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>FlexLM</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<application_prototypes/>
<master_item_prototype/>
</item_prototype>
<item_prototype>
<name> {${#SERVER}}</name>
<type>18</type>
<snmp_community/>
<snmp_oid/>
<key>flexlm.status.[{#SERVER}]</key>
<delay>0</delay>
<history>90d</history>
<trends>0</trends>
<status>1</status>
<value_type>1</value_type>
<allowed_hosts/>
<units/>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>FlexLM</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing>
<step>
<type>5</type>
<params>\{#SERVER\}: (.*)
\1</params>
</step>
</preprocessing>
<jmx_endpoint/>
<application_prototypes/>
<master_item_prototype>
<key>system.run[&quot;lmutil lmstat -vd{#SERVER}&quot;]</key>
</master_item_prototype>
</item_prototype>
<item_prototype>
<name> lmutil lmstat -vd {#SERVER}</name>
<type>0</type>
<snmp_community/>
<snmp_oid/>
<key>system.run[&quot;lmutil lmstat -vd{#SERVER}&quot;]</key>
<delay>5m</delay>
<history>1h</history>
<trends>0</trends>
<status>1</status>
<value_type>4</value_type>
<allowed_hosts/>
<units/>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>FlexLM</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<application_prototypes/>
<master_item_prototype/>
</item_prototype>
</item_prototypes>
<trigger_prototypes>
<trigger_prototype>
<expression>{Software - FlexLM:flexlm.sh[{HOST.CONN},{#SERVER},status].regexp(^UP .*$)}=1</expression>
<recovery_mode>0</recovery_mode>
<recovery_expression/>
<name>FlexLM- {${#SERVER}} {HOST.NAME}</name>
<correlation_mode>0</correlation_mode>
<correlation_tag/>
<url/>
<status>0</status>
<priority>3</priority>
<description/>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>
<tags/>
</trigger_prototype>
</trigger_prototypes>
<graph_prototypes/>
<host_prototypes/>
<jmx_endpoint/>
</discovery_rule>
</discovery_rules>
<httptests/>
<macros>
<macro>
<macro>{$ACD_2006_0F}</macro>
<value>AutoCAD 2006</value>
</macro>
<macro>
<macro>{$ACD_2013_0F}</macro>
<value>AutoCAD 2013</value>
</macro>
<macro>
<macro>{$ADSKFLEX}</macro>
<value>Autodesk</value>
</macro>
<macro>
<macro>{$CSOFT}</macro>
<value>CSoft</value>
</macro>
<macro>
<macro>{$NANOCONSTRSUITE}</macro>
<value>NanoCAD </value>
</macro>
<macro>
<macro>{$NANOCONSTRSUITE_FOUND}</macro>
<value>NanoCAD ()</value>
</macro>
<macro>
<macro>{$NANOCONSTRSUITE_RFCONCR}</macro>
<value>NanoCAD ()</value>
</macro>
<macro>
<macro>{$NANOELS}</macro>
<value>NanoCAD </value>
</macro>
<macro>
<macro>{$NANOSOFT}</macro>
<value>Nanosoft</value>
</macro>
<macro>
<macro>{$NANOSPDS}</macro>
<value>NanoCAD </value>
</macro>
<macro>
<macro>{$SPDS}</macro>
<value> Graphics</value>
</macro>
</macros>
<templates/>
<screens/>
</template>
</templates>
</zabbix_export>
view raw Software - FlexLM.xml hosted with ❤ by GitHub


flexlm.sh
#!/bin/bash
# 2017/12/26 AcidVenom v1.0
# FlexLM LLD Zabbix ( )
#
# : discoverys
IFS=$'\n'
JSON="{\"data\":["
SEP=""
if [[ $2 = "discoverys" ]]
then
get=`zabbix_get -s $1 -k system.run["lmutil lmstat -vd"] | grep " " | grep -v "localhost" | sed "s/\(:.*\| *\)//g" | sed "s/[[:lower:]]/\u&/g"`
for server in $get
do
JSON=$JSON"$SEP{\"{#SERVER}\":\"$server\"}"
SEP=", "
done
JSON=$JSON"]}"
echo $JSON
#
# : discoveryl
elif [[ $2 = "discoveryl" ]]
then
get=`zabbix_get -s $1 -k system.run["lmutil lmstat -a"] | grep "Users of" | sed "s/\(Users of \|: .*\)//g" | sed "s/[[:lower:]]/\u&/g"`
for license in $get
do
JSON=$JSON"$SEP{\"{#LICENSE}\":\"$license\"}"
SEP=", "
done
JSON=$JSON"]}"
echo $JSON
else
#
if [[ $3 = "status" ]]
then
get=`zabbix_get -s $1 -k system.run["lmutil lmstat -vd"] | grep -i "$2" | sed "s/.*://"`
echo $get
#
elif [[ $3 = "total" ]]
then
get=`zabbix_get -s $1 -k system.run["lmutil lmstat -f $2"] | grep "Users of" | sed "s/ license.*//" | sed "s/.*Total of //"`
echo $get
#
elif [[ $3 = "active" ]]
then
error=`zabbix_get -s $1 -k system.run["lmutil lmstat -f $2"] | grep "Users of" | grep "Error"`
if [[ $error = "" ]]
then
get=`zabbix_get -s $1 -k system.run["lmutil lmstat -f $2"] | grep "Users of" | sed "s/.*Total of //" | sed "s/ license.*//"`
echo $get
else
echo "-1"
fi
#
elif [[ $3 = "users" ]]
then
get=`zabbix_get -s $1 -k system.run["lmutil lmstat -f $2"] | grep "start"`
echo $get
fi
fi
view raw flexlm.sh hosted with ❤ by GitHub


The template is universal and works for both Windows and Linux. Additional settings require:

lmutil from Autodesk NLM 11.13
www95.zippyshare.com/v/MOawVaur/file.html
SHA-1: 02EF9BBF03C058A82AD31B3764B670EA7063C80E
SHA-256: F9343E73B2ACCC4ABF7F7011C1E4CA123BB82D1E66412494E42F8A473D6ACCFB

Source: https://habr.com/ru/post/336570/


All Articles