Ad Widget

Collapse

Cannot create item: item with the same key already exists.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • who_care
    Member
    • Sep 2017
    • 30

    #1

    Cannot create item: item with the same key already exists.

    Привет! Помогите пожалуйста разобраться, что я делаю не так с LLD?
    Посылаю, например с помощью
    Code:
    zabbix_sender -vv -c /etc/zabbix/zabbix_agentd.conf --input-file
    на сервер JSON вида
    Code:
    {
        "data": [
            {
                "{#CLUSTER}": "misc", 
                "{#NODE}": "test1"
            }, 
            {
                "{#CLUSTER}": "misc", 
                "{#NODE}": "test2"
            }, 
            {
                "{#CLUSTER}": "misc", 
                "{#NODE}": "test3"
            }, 
            {
                "{#CLUSTER}": "web", 
                "{#NODE}": "hello1"
            }, 
            {
                "{#CLUSTER}": "web", 
                "{#NODE}": "hello2"
            }, 
            {
                "{#CLUSTER}": "web", 
                "{#NODE}": "hello3"
            }
        ]
    }
    В вебе в правилах обнаружения получаю
    Code:
    Cannot create item: item with the same key "shard_all_members[{#CLUSTER}]" already exists.
    Cannot create item: item with the same key "shard_inconsistent_nodes[{#CLUSTER}]" already exists.
    Cannot create item: item with the same key "shard_maintenance_nodes[{#CLUSTER}]" already exists.
    Cannot create item: item with the same key "shard_masters_count[{#CLUSTER}]" already exists.
    Cannot create item: item with the same key "shard_master_id[{#NODE}]" already exists.
    Cannot create item: item with the same key "shard_running_members[{#CLUSTER}]" already exists.
    Cannot create item: item with the same key "shard_servers[{#CLUSTER}]" already exists.
    Cannot create item: item with the same key "shard_servers[{#NODE}]" already exists.
    Cannot create item: item with the same key "shard_all_members[{#CLUSTER}]" already exists.
    Cannot create item: item with the same key "shard_inconsistent_nodes[{#CLUSTER}]" already exists.
    Cannot create item: item with the same key "shard_maintenance_nodes[{#CLUSTER}]" already exists.
    Cannot create item: item with the same key "shard_masters_count[{#CLUSTER}]" already exists.
    Cannot create item: item with the same key "shard_master_id[{#NODE}]" already exists.
    Cannot create item: item with the same key "shard_running_members[{#CLUSTER}]" already exists.
    Cannot create item: item with the same key "shard_servers[{#CLUSTER}]" already exists.
    Cannot create item: item with the same key "shard_servers[{#NODE}]" already exists.
    При этом элементы создаются и данные по ним приходят.

    В обнаружении 8 прототипов элементов данных с ключами:
    Code:
    shard_master_id[{#NODE}]
    shard_masters_count[{#CLUSTER}]
    shard_all_members[{#CLUSTER}]
    shard_running_members[{#CLUSTER}]
    shard_inconsistent_nodes[{#CLUSTER}]
    shard_maintenance_nodes[{#CLUSTER}]	
    shard_servers[{#CLUSTER}]
    shard_servers[{#NODE}]
    Я подозреваю что как-то криво составил JSON, но я не пойму как мне его правильно сделать?
    Last edited by who_care; 19-10-2017, 18:10.
  • who_care
    Member
    • Sep 2017
    • 30

    #2
    Кажется понял, что надо разделить это на два отдельных lld: первое для cluster, второе для node. Эхх

    Comment

    • Kos
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Aug 2015
      • 3404

      #3
      Ну да, оно же открытым текстом говорит, что для каждого элемента данных ключ должен быть уникальным, а при использовании в прототипах только одного макроса (у которого в Вашем примере значения повторяются) уникальности не получается.

      Как вариант, можно в прототипах элементов данных использовать оба макроса, тогда и ключи получатся уникальными.
      Например:
      Code:
      shard_all_members[{#CLUSTER},{#NODE}]
      (используя два параметра в ключе)
      или же:
      Code:
      shard_all_members[{#CLUSTER}-{#NODE}]
      (слепляя всё это в одно длинное значение единственного параметра)

      Comment

      Working...