Ad Widget

Collapse

Custom LLD with UserParameter and Powershell script

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sxboxer
    Junior Member
    • Jan 2024
    • 4

    #1

    Custom LLD with UserParameter and Powershell script

    Hello friends, I need some advice
    Information:
    Server - Zabbix 7.0
    Host PC - Zabix Agent 2.0
    Host PC - Windows 10

    Goal: Monitoring installed on windows PCs
    Tested:

    I would start using a powershell script: "get_installed_apps.ps1"


    $jsonOutput | ConvertTo-Json

    The return value is in JSON format

    [
    {
    "{#APPVERSION}": "12.0.40664",
    "{#APPNAME}": "Microsoft Visual C++ 2013 x86 Additional Runtime - 12.0.40664".
    },
    {
    "{#APPVERSION}": "4.80",
    "{#APPNAME}": "Software602 Form Filler".
    more...
    ]

    editing zabbix.conf

    UserParameter=installed.apps,powershell -NoProfile -ExecutionPolicy Bypass -File "C:\Program Files\Zabbix Agent 2\get_installed_apps.ps1"
    UnsafeUserParameters=1

    I created Discovery rules
    • Name: Installed Applications Discovery
    • Type: Zabbix agent
    • Key: installed.apps
    I created LLD Macro
    • Macro: {#APPNAME}
    • JSONPath: $.DisplayName
    I created Item Prototype
    • Name: Installed Application: {#APPNAME}
    • Type: Zabbix agent
    • Key: installed.app[{#APPNAME}]
    • Type of information: Character
    After these steps, I get an error value:

    Cannot create item: item with the same key "installed.app[{#APPNAME}]" already exists.
    Cannot create item: item with the same key "installed.app[{#APPNAME}]" already exists.

    I tried really many combinations and different ways, but everything ends the same. Unfortunately, the documentation for custom LLD using powershell script doesn't exist perhaps and I have drawn from various forums but have had no success. I am asking for your help in solving this problem, thank you. zz0.tguqk9irpbfzz
  • Answer selected by sxboxer at 19-06-2024, 18:20.
    Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1782

    If your discovery data already has the LLD macros (like "{#APPNAME}"), you don't use LLD macros tab for anything.



    The LLD macros tab allows to specify custom low-level discovery macros.

    Custom macros are useful in cases when the returned JSON does not have the required macros already defined.
    Markku
    Last edited by Markku; 19-06-2024, 16:50.

    Comment


    • sxboxer
      sxboxer commented
      Editing a comment
      Thank you very much, I really tried everything possible, but since I'm no specialist, I tried more than I needed to.
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1782

    #2
    If your discovery data already has the LLD macros (like "{#APPNAME}"), you don't use LLD macros tab for anything.



    The LLD macros tab allows to specify custom low-level discovery macros.

    Custom macros are useful in cases when the returned JSON does not have the required macros already defined.
    Markku
    Last edited by Markku; 19-06-2024, 16:50.

    Comment


    • sxboxer
      sxboxer commented
      Editing a comment
      Thank you very much, I really tried everything possible, but since I'm no specialist, I tried more than I needed to.
  • sxboxer
    Junior Member
    • Jan 2024
    • 4

    #3
    One additional question, is there any way to resolve this message ?
    Attached Files

    Comment

    • Markku
      Senior Member
      Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
      • Sep 2018
      • 1782

      #4
      "installed.app" vs "installed.apps"?

      Markku

      Comment


      • sxboxer
        sxboxer commented
        Editing a comment
        Unknown metric installed.app
    Working...