Ad Widget

Collapse

Is it possible to make LLD from output of powershell external script?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cenzoooo
    Member
    • Jul 2015
    • 37

    #1

    Is it possible to make LLD from output of powershell external script?

    Hello!

    I have external python script which connects over winrm to Win Server and execute certaion powershell commands located in ps file.

    This is example of output of script:

    zabbix@zbx_server:/usr/lib/zabbix/externalscripts$ python testwinrm.py 'ip_address' 'username' 'password' 'name_of_ps_file.ps'
    [
    {
    "DeviceID": "C:",
    "FreeSpace": 74742448128,
    "Size": 160533835776,
    "VolumeName": ""
    },
    {
    "DeviceID": "D:",
    "FreeSpace": 151431086080,
    "Size": 268234129408,
    "VolumeName": "Advanced baza"
    },
    {
    "DeviceID": "E:",
    "FreeSpace": 150398631936,
    "Size": 429295403008,
    "VolumeName": "Standard baza"
    },
    {
    "DeviceID": "F:",
    "FreeSpace": 624149921792,
    "Size": 857718390784,
    "VolumeName": "VIP baza"
    }
    ]


    So "Master Item" in zabbix will contain this data. Is it possible to create LLD from this output, with macros for Device ID, FreeSpace, Size etc... ?
    I can't figure it out how to make this work... Anyone smarter?
  • splitek
    Senior Member
    • Dec 2018
    • 101

    #2
    If you want this file to work with LLD, then it need to contain LLD macros. LDD macro start with #
    "#DeviceID": "C:"
    "#DeviceID": "D:"
    now strings #DeviceID are LLD macro, and expand in items into C: D:....

    Comment

    • luistro
      Junior Member
      • Jan 2019
      • 3

      #3
      absolutely. the general idea is to take an array of data and output a json with MACRO association that can get imported into your custom discovery

      Comment

      • Cenzoooo
        Member
        • Jul 2015
        • 37

        #4
        Hello,

        I still have not figure it out. I understand about "Macro" concept, OK I can make script which will put DeviceID as {#ID1}, FreeSpace as {#ID2} and so on... But how to populate values then from this kind of output?
        What kind of item prototype that would be?

        Any1 has an idea?

        Comment

        Working...