Ad Widget

Collapse

Dynamically create or update hosts based on json output from different host(s)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • akam
    Junior Member
    • Sep 2011
    • 22

    #1

    Dynamically create or update hosts based on json output from different host(s)

    Hello,

    is it possible to implement this in Zabbix:
    - I have a host and item(lets say every minute update) with JSON output
    Code:
    {
      "jsonrpc":  "2.0",
      "result": {
        "NRSETS": 1,
        "RECORDS":  [{
            "SET":  {
              "ID": 999,
              "TARGETS":  [{
                  "DEST": {
                    "URI":  "sip:1.202.79.67",
                    "FLAGS":  "AP",
                    "PRIORITY": 0,
                    "LATENCY":  {
                      "AVG":  0,
                      "STD":  0,
                      "EST":  0,
                      "MAX":  0,
                      "TIMEOUT":  1481
                    }
                  }
                }, {
                  "DEST": {
                    "URI":  "sip:124.89.90.34",
                    "FLAGS":  "AP",
                    "PRIORITY": 0,
                    "LATENCY":  {
                      "AVG":  0,
                      "STD":  0,
                      "EST":  0,
                      "MAX":  0,
                      "TIMEOUT":  1481
                    }
                  }
                }, {
                  "DEST": {
                    "URI":  "sip:220.249.100.164",
                    "FLAGS":  "AP",
                    "PRIORITY": 0,
                    "ATTRS":  {
                      "BODY": "zabbix-host=synopsys-cn58",
                      "DUID": null,
                      "MAXLOAD":  0,
                      "WEIGHT": 0,
                      "RWEIGHT":  0,
                      "SOCKET": null,
                      "SOCKNAME": null,
                      "OBPROXY":  null
                    },
                    "LATENCY":  {
                      "AVG":  0,
                      "STD":  0,
                      "EST":  0,
                      "MAX":  0,
                      "TIMEOUT":  1481
                    }
                  }
                }]
            }
          }]
      },
      "id": 1541869
    }
    - I want to create hosts or update latency items if such hosts already exist
    - Hostnames and IPs for the new hosts in DEST.URI
    - I want to apply some extra items and triggers to these hosts, for example, ICMP ping, but this ping should be performed from the "ROOT" host because these hosts are not accessible from the Zabbix server


    what should I use? JSON preprocessing? Discovery rules? Other things?
    Thank you in advance for your answers
    Last edited by akam; 04-04-2024, 07:08.
  • akam
    Junior Member
    • Sep 2011
    • 22

    #2
    I created a discovery rule
    Click image for larger version  Name:	image.png Views:	0 Size:	70.7 KB ID:	481838
    Click image for larger version  Name:	image.png Views:	0 Size:	43.8 KB ID:	481839

    and host prototype
    Click image for larger version  Name:	image.png Views:	0 Size:	89.3 KB ID:	481840

    Preprocessing test is successful, but no new host was created and nothing in the logs

    Comment

    Working...