Ad Widget

Collapse

Autodiscovery message for active client

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vadv
    Junior Member
    • Jan 2016
    • 5

    #1

    Autodiscovery message for active client

    How to form messages for sending autodiscovery information to zabbix-server right?
    For example for sending items I should send message this format:
    {
    "request":"sender data",
    "data": [
    {"host":"", "value":"", "key":""}
    ],
    ...
    }
    What should I send in case of autodiscovery message for active client?
    data - is an array of hashes such as [ { "{#DISCOVERY1}":"VAL1" } ]. Is it right? What I need to specify as request?
  • BDiE8VNy
    Senior Member
    • Apr 2010
    • 680

    #2
    There is no 'Autodiscovery' in Zabbix.
    Can you please clarify whether you're referring to Network discovery, Low-Level discovery or Agent auto-registration?

    Common information about Zabbix protocols may be found here:
    Join the friendly and open Zabbix community on our forums and social media platforms.

    Comment

    • vadv
      Junior Member
      • Jan 2016
      • 5

      #3
      I mean message from active client with autodiscovery message.
      This message working for me for zbx server 2.4:
      { "key": "KEY_OF_AUTODISCOVERY_MSG",
      "value": "{\"data\": [ {\"#{DISCORVERY_1}\":\"VAL_1\", ....} ] }",
      "host": "fqdn"}

      Comment

      • BDiE8VNy
        Senior Member
        • Apr 2010
        • 680

        #4
        Again, there does not exist anything named "autodiscovery" in Zabbix!
        What you're most likely referring to is sending a JSON formatted value for a Low-Level-Discovery rule via Zabbix sender protocol.

        In fact the answer is: Exactly as described in the Online documentation resp. the Wiki.
        But take care of proper escaping.

        You could also see what what Zabbix sender would make out of it, when sending a LLD JSON value to Zabbix server:

        Code:
        [baz@example~]# cat /tmp/json.data
        {
                "data": [{
                        "{#IFNAME}": "lo"
                }, {
                        "{#IFNAME}": "eth0"
                }, {
                        "{#IFNAME}": "venet0"
                }]
        }
        [baz@example ~]# nc -l 49152 &
        [1] 901645
        [baz@example ~]# zabbix_sender -z 127.0.0.1 -p 49152 -s example.com -k foobar -o "$(cat /tmp/json.data)"
        ZBXD▒{"request":"sender data","data":[{"host":"example.com","key":"foobar","value":"{\n\t\"data\": [{\n\t\t\"{#IFNAME}\": \"lo\"\n\t}, {\n\t\t\"{#IFNAME}\": \"eth0\"\n\t}, {\n\t\t\"{#IFNAME}\": \"venet0\"\n\t}]\n}"}]}
        or a bit beautified:
        Code:
        {
        	"request": "sender data",
        	"data": [{
        		"host": "example.com",
        		"key": "foobar",
        		"value": "{\n\t\"data\": [{\n\t\t\"{#IFNAME}\": \"lo\"\n\t}, {\n\t\t\"{#IFNAME}\": \"eth0\"\n\t}, {\n\t\t\"{#IFNAME}\": \"venet0\"\n\t}]\n}"
        	}]
        }
        If this is not what you were asking for, then please be more specific and use the correct definitions in respect of Zabbix.

        Comment

        Working...