Ad Widget

Collapse

Discovery of discovery?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • clevelas
    Junior Member
    • Mar 2015
    • 22

    #1

    Discovery of discovery?

    Here's what I'm trying to do (zabbix 4.4.4):

    I have a directory on the zabbix server (though it could be any host potentially). In it are a bunch of flexlm license.dat files (basically just pointers to the actual running license servers).

    What I want to do is:

    1. Have a discover that finds all of these license files
    2. For each license file, run a script that gets the raw output of 'lmutil lmstat -c license.dat -a'. Actually for this, I've massaged the output into an array of 'feature' => [ 'used' => 10, 'total' => 100]
    3. For each feature, I want an item created for 'used' and 'total'

    So I'm thinking I need a discovery of a discovery. Is that possible? I was playing with a host prototype. Maybe create a pseudo host out of each license and that would then pull the raw data and then do a discovery of that inside that new host. But I didn't know if I could pass a macro from the previous discovery. Early attempts at this have not been successful. Is there another route entirely for monitoring a bunch of flexlm licenses aside from manually entering them? That would be maybe a generic template and then one template per license file, each with a macro set for which license file to use?

    Any help is appreciated.
  • clevelas
    Junior Member
    • Mar 2015
    • 22

    #2
    I tried the method of using a generic "FlexLM license" template and linking "FlexLM matlab" and "Flexlm autocad" to it with different macro variables. But I apparently can't attach a template more than once, even if it's through another linked template. So that idea won't work.

    Comment

    • clevelas
      Junior Member
      • Mar 2015
      • 22

      #3
      I went back to trying the Host Prototype approach. I can create a host for each "License" I find in that directory. While it doesn't appear Host Macros are a thing yet (ZBXNEXT-2297) and would be the 'proper' solution, one of the suggestions I found in the comments (https://support.zabbix.com/browse/ZB...comment-241907) lead me to a solution that mostly works:

      On the zabbix server (could be any host), I have a script that returns of list of available license files. Output looks like this:
      Code:
      [
        {
          "{#LICENSE}": "matlab"
        }
      ]
      I created a template that attaches to the zabbix server with a discovery that runs that script (could be agent key or external script). That discovery includes a Host Prototype. It sets the Host name to "FlexLM.{#LICENSE}" and attaches another template.

      The second template has an item called "License details" that has the key: flexlm.getlicensedetail["{HOST.HOST}"]

      That key runs another script (actually the same script with a different argument) that looks at the passed argument and strips out the "FlexLM." part and returns all of the data for that license. Output looks like this:
      Code:
      {
        "lld": [
          {
            "{#FEATURE}": "MATLAB"
          },
          {
            "{#FEATURE}": "SIMULINK"
          }
        ],
        "values": {
          "MATLAB": {
            "total": "10000",
            "used": "109"
          },
          "SIMULINK": {
            "total": "10000",
            "used": "6"
          }
        }
      }
      So every 5 minutes, it pulls all of the data for that license.

      I then created a discovery rule for the features. It is a 'depenedent item' that uses that main item as the master. It then uses a Preprocessing rule of JSONPath with a parameter of "$.lld". I got that trick from how Block Devices Discovery works in the default linux template.

      Then there are item prototypes for "FlexLM Features {#FEATURE} " total and used. They use Preprocessing JSONPath with a parameter of $['values']["{#FEATURE}"]['total'] and $['values']["{#FEATURE}"]['used']

      The solution seems a little convoluted, but gets me the data that I want without having to create a bunch of stuff by hand for each license.
      Last edited by clevelas; 22-01-2020, 23:42.

      Comment

      Working...