0

I trying to create a discovery rule to monitor a enterprise application, and my script return the follow JSON.

{
    "data": [{
            "{#NODENAME}": "node1",
            "{#NODEINTERFACE}": ["eth0", "eth1"]
        },
        {
            "{#NODENAME}": "node2",
            "{#NODEINTERFACE}": ["eth2", "eth3"]
        }
    ]
}

On Zabbix Interface i created the discovery with the follow parameters:

Name:: Discovery nodes and interfaces

Type: Zabbix agent

Key app.discovery

And in "Filters" TAB:

Type of calculation: And/Or


The expected behavior on Zabbix is to create the followings keys:

Format of keys:

app.getinfo["{#NODENAME}","{#NODEINTERFACE}]

That is, for each NODENAME create N keys, one for each interface

Discovery keys:

app.getInfo["node1","eth0"]
app.getInfo["node1","eth1"]

app.getInfo["node2","eth2"]
app.getInfo["node2","eth3"]

The behavior received its:

If Type of calculation is And/Or, Zabbix not create the items

And if Type of calculation is Or, Zabbix create one item for each NODENAME, and ignore/not recognize the NODEINTERFACE


My doubt is, How to create an discovery rule, For each NODENAME, create N items with the NODEINTERFACE information

1 Answer 1

0

First, the prototype key is likely wrong - quotes are not closed in app.getinfo["{#NODENAME}","{#NODEINTERFACE}].

Second, your JSON should be like this:

{
    "data": [
    {
        "{#NODENAME}": "node1",
        "{#NODEINTERFACE}": "eth0"
    },
    {
        "{#NODENAME}": "node1",
        "{#NODEINTERFACE}": "eth1"
    },
    {
        "{#NODENAME}": "node2",
        "{#NODEINTERFACE}": "eth2"
    }
    {
        "{#NODENAME}": "node2",
        "{#NODEINTERFACE}": "eth3"
    }
]
}

Note how each entry must hold a single set of values you want to be represented in the created entities.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .