Ad Widget

Collapse

zabbix_sender with JSON for LLD

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mauro
    Member
    • Jan 2017
    • 94

    #1

    zabbix_sender with JSON for LLD

    Hello.
    I search in the forum and on the Web, I found instructions but work at 100%.
    Briefly: I have created a template, on this a discovery rules key: status.backup, no filters, type zabbix trapper.
    One item prototype: type zabbix trapper, name Backup Status {#PLANS}, text, no more.
    Craete an host test_backup_host and linked this template.

    Ok, now I prepared a JSON File:
    test_backup_host status.backup{"data":[{"{#PLANS}":"Daily Backup"}]}

    and use zabbix_sender:
    zabbix_sender -z serverName -i file.json

    Perfect, in the host appear the new discoverd item status.backup[Daily Backup].

    Now I want to valorize it. With the sender and the -o it works but I want to execute only one data send, just with the json.
    I try many "configurations":
    test_backup_host status.backup{"data":[{"{#PLANS}":"Daily Backup","{status.acronis[Daily Backup]}":"ok"}]}
    test_backup_host status.backup{"data":[{"{#PLANS}":"Daily Backup","{status.acronis['Daily Backup']}":"ok"}]}
    test_backup_host status.backup{"data":[{"{#PLANS}":"Daily Backup","value":"ok"}]}
    ...
    nothing.
    the Item was created but the value still remain null.

    Where is the mistake?
    Thx


  • mauro
    Member
    • Jan 2017
    • 94

    #2
    I'm stupid.
    The key is status.backup and this is for autodiscover... I can't (in the same row) set the value for the new discovered item.
    two line is necessary for me:
    test_backup_host status.backup {"data":[{"{#PLANS}":"Daily Backup"}]}
    test_backup_host status.backup[Daily Backup] ok

    but in this way, sometimes the second row don't set the value: probably because the item has not yet been created, ie a few milliseconds have passed since the request from the previous sender.

    Other ideas are welcome.
    Last edited by mauro; 16-04-2019, 10:11.

    Comment

    Working...