Ad Widget

Collapse

Error Cannot create item: item with the same key

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stu
    Junior Member
    • Jun 2017
    • 12

    #1

    Error Cannot create item: item with the same key

    Hi

    I have several apps running on a single server. Some of these use sidekiq. I am trying to monitor whether sidekiq is running for these apps.

    I have the following LLD script configured

    Code:
    #!/bin/bash
    
    echo "{"
    echo "\"data\":["
    
    /usr/bin/find /home/ubuntu/*/current/config -name "sidekiq.yml"|awk -F"/" '{ print "{\"{#DIRNAME}\":\""$4"\"}," }' | head -c -2
    
    echo "]"
    echo "}"
    This correctly generates the following


    {
    "data":[
    {"{#DIRNAME}":"app1"},
    {"{#DIRNAME}":"app2"},
    {"{#DIRNAME}":"app3"}]
    }


    Now each sidekiq process is called the same as the folder, so there is a process running called app1 (which is the sidekiq process for app1) etc.

    On the client I have the following configured


    UserParameter=folder.discovery[*],/etc/zabbix/scripts/sidekiq.sh

    In Zabbix I have the following configured

    Discovery Rule:

    Name: Discover apps using sidekiq
    Type: Zabbix agent
    Key: folder.discovery


    Item prototypes:-

    Name: Check if sidekiq is running
    Type: Zabbix agent
    Key: proc.num[#DIRNAME,ubuntu,,]


    However, i'm getting the following error:-

    Cannot create item: item with the same key "proc.num[#DIRNAME,ubuntu,,]" already exists.

    Cannot create item: item with the same key "proc.num[#DIRNAME,ubuntu,,]" already exists.

    Cannot create item: item with the same key "proc.num[#DIRNAME,ubuntu,,]" already exists.




    What am I doing wrong?

    Thanks
  • wick
    Member
    • May 2017
    • 57

    #2
    Hi stu,

    change your key for :

    proc.num[{#DIRNAME},ubuntu,,]

    After that I think it will work better

    Comment

    • stu
      Junior Member
      • Jun 2017
      • 12

      #3
      Great that works a lot better...thanks for your help.....

      Comment

      • wick
        Member
        • May 2017
        • 57

        #4
        It was a pleasure I'm new to zabbix but when i can help i try to do it

        Comment

        Working...