Ad Widget

Collapse

Error Cannot create item: item with the same key

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • atom63
    Junior Member
    • Mar 2020
    • 3

    #1

    Error Cannot create item: item with the same key

    Hi!
    I create custom ldd rule with UserParameter
    Code:
    UserParameter=system.processes,powershell -command "$proc = Get-Process | select-object ProcessName | Sort-Object | Get-Unique -AsString; $json=@(ConvertTo-Json $proc); $names='{ \"data\": }'; $names=$names.Insert(9,$json); $names.replace('ProcessName','{#PROC.NAME}'); "
    It returns json object as said in docs
    Example:
    Code:
    zabbix_get -s server.name -k system.processes
    { "data":[
        {
            "{#PROC.NAME}":  "svchost"
        },
        {
            "{#PROC.NAME}":  "sqlwriter"
        },
        {
            "{#PROC.NAME}":  "spoolsv"
        },
        {
            "{#PROC.NAME}":  "smss"
        },
        {
            "{#PROC.NAME}":  "snmp"
        },
        {
            "{#PROC.NAME}":  "sqlservr"
        },
        {
            "{#PROC.NAME}":  "svchost"
        },
        {
            "{#PROC.NAME}":  "vds"
        },
        {
            "{#PROC.NAME}":  "vncagent"
        },
        {
            "{#PROC.NAME}":  "taskhostw"
        },
        {
            "{#PROC.NAME}":  "UpdaterDisabler"
        },
        {
            "{#PROC.NAME}":  "vncserver"
        },
        {
            "{#PROC.NAME}":  "winlogon"
        },
        {
            "{#PROC.NAME}":  "zabbix_agentd"
        },
        {
            "{#PROC.NAME}":  "vncserverui"
        },
        {
            "{#PROC.NAME}":  "wininit"
        },
        {
            "{#PROC.NAME}":  "System"
        },
        {
            "{#PROC.NAME}":  "svchost"
        },
        {
            "{#PROC.NAME}":  "sihost"
        },
        {
            "{#PROC.NAME}":  "dfsrs"
        },
        {
            "{#PROC.NAME}":  "dfssvc"
        },
        {
            "{#PROC.NAME}":  "csrss"
        },
        {
            "{#PROC.NAME}":  "distnoted"
        },
        {
            "{#PROC.NAME}":  "dwm"
        },
        {
            "{#PROC.NAME}":  "explorer"
        },
        {
            "{#PROC.NAME}":  "dllhost"
        },
        {
            "{#PROC.NAME}":  "dns"
        },
        {
            "{#PROC.NAME}":  "conhost"
        },
        {
            "{#PROC.NAME}":  "AppleMobileDeviceService"
        },
        {
            "{#PROC.NAME}":  "audiodg"
        },
        {
            "{#PROC.NAME}":  "alg"
        },
        {
            "{#PROC.NAME}":  "AppleMobileDeviceHelper"
        },
        {
            "{#PROC.NAME}":  "cmd"
        },
        {
            "{#PROC.NAME}":  "conhost"
        },
        {
            "{#PROC.NAME}":  "cmd"
        },
        {
            "{#PROC.NAME}":  "conhost"
        },
        {
            "{#PROC.NAME}":  "GoogleCrashHandler"
        },
        {
            "{#PROC.NAME}":  "notepad"
        },
        {
            "{#PROC.NAME}":  "powershell"
        },
        {
            "{#PROC.NAME}":  "mmc"
        },
        {
            "{#PROC.NAME}":  "msdtc"
        },
        {
            "{#PROC.NAME}":  "RuntimeBroker"
        },
        {
            "{#PROC.NAME}":  "services"
        },
        {
            "{#PROC.NAME}":  "ShellExperienceHost"
        },
        {
            "{#PROC.NAME}":  "SearchUI"
        },
        {
            "{#PROC.NAME}":  "ServerManager"
        },
        {
            "{#PROC.NAME}":  "Microsoft.ActiveDirectory.WebServices"
        },
        {
            "{#PROC.NAME}":  "iashost"
        },
        {
            "{#PROC.NAME}":  "Idle"
        },
        {
            "{#PROC.NAME}":  "GoogleCrashHandler64"
        },
        {
            "{#PROC.NAME}":  "GoogleUpdate"
        },
        {
            "{#PROC.NAME}":  "lsass"
        }
    ] }
    Most of received processes are services too so item was created for them before by standard template. But items was created not for all procs from list . I added only 1 macro {#PROC.NAME} with jsonpath $.data. My template for discovered item has this key proc_info[{#PROC.NAME}].
    I receive problem in zabbix:
    Code:
    Cannot create item: item with the same key "proc_info[{#PROC.NAME}]" already exists.
    Cannot create item: item with the same key "proc_info[{#PROC.NAME}]" already exists.
    Cannot create item: item with the same key "proc_info[{#PROC.NAME}]" already exists.
    ...
    If i try to search item, for example, for "vncserver", i find it(it's service because), but if i try "vncserverui", i dont(not a service).
    So what i do wrong? Thanks

    P.S. I tried another key, but got the same error
    Code:
    Cannot create item: item with the same key "perf_counter[\Process({#PROC.NAME})\% Processor Time]" already exists.
    Cannot create item: item with the same key "perf_counter[\Process({#PROC.NAME})\% Processor Time]" already exists.
    Cannot create item: item with the same key "perf_counter[\Process({#PROC.NAME})\% Processor Time]" already exists...
    Last edited by atom63; 04-04-2020, 23:30. Reason: windows,
  • Atsushi
    Senior Member
    • Aug 2013
    • 2028

    #2
    Items with the same key cannot be registered for one host. For example, in the JSON described, there are three svchosts and two cmds, so an error may have occurred because the following two keys were attempted to be registered.

    proc_info[svchost]
    proc_info[cmd]

    Comment

    Working...