Greetings! I've been trying to get this working for a couple of days now, but just can't seem to wrap my head around the process of correctly setting up Discovery rules and Item prototypes in Zabbix 6.0
Long story short, I have a device that has an API that allows me to retrieve devices that are connected to it. The JSON output looks like this:
Code:
{
"dev": {
"receivers": {
"8c:6d:c4:01:0c:40": {
"alerts": {
"testBuild": {
"brief": "TEST BUILD",
"count": 1,
"desc": "Running firmware for test only: do not use in production",
"severity": 4,
"since": 69316
}
},
"alertsCount": 1,
"alertsSeverity": 4,
"camera": {
"disabledStream": 0,
"enabled": true
},
"counters": {
"apRetries": 0,
"apTimeouts": 0,
"ethernetErrors": 0,
"frameErrors": 0,
"macErrors": 0,
"reboots": 1252
},
"distroBoxMac": "8c:6d:c4:00:a2:7f",
"distroBoxPort": 1,
"fans": {
"Fan1": 0,
"Fan2": 0
},
"groupId": -1,
"identifyEnabled": false,
"info": {
"backupConnected": false,
"backupMac": "",
"backupProcessor": "",
"name": "EC1.5",
"pixelsH": 180,
"pixelsW": 320,
"serial": "4",
"version": {
"firmware": "p23.07.14.21625 DEBUG"
}
},
"ldms": {
"1": {
"info": {
"serial": "SP154S017700"
}
},
"2": {
"info": {
"serial": "SP154S017697"
}
},
"3": {
"info": {
"serial": "SP154S017694"
}
},
"4": {
"info": {
"serial": "SP154S017690*"
}
},
"5": {
"info": {
"serial": "SP154S017699"
}
},
"6": {
"info": {
"serial": "SP154S017696"
}
},
"7": {
"info": {
"serial": "SP154S017693"
}
},
"8": {
"info": {
"serial": "SP154S017689*"
}
},
"9": {
"info": {
"serial": "SP154S017698"
}
},
"10": {
"info": {
"serial": "SP154S017695"
}
},
"11": {
"info": {
"serial": "SP154S017692"
}
},
"12": {
"info": {
"serial": "SP154S017691*"
}
}
},
"notes": {
"color": 4294967295,
"modified": -1,
"text": ""
},
"rotation": 0,
"string": 0,
"switchId": "",
"switchPort": -1,
"temps": {
"CPU": 51.28,
"Hub": 33.82,
"PHY_B": 35,
"PHY_L": 31,
"PHY_R": 43,
"PHY_T": 37
},
"x": 0,
"y": 0
}
}
}
}
I've created my Discovery rule as such:
- Name: Discover Receivers
- Type: HTTP Agent
- Key: dev.receivers.discovery
- URL: http://{HOST.IP}/api/v1/public?dev.receivers
- Request method: GET
- Preprocessing:
- JSONPath: $.dev.receivers.*
- LLD Macro:
- Macro: {#MAC}
- JSONPath: $.dev.receivers.*
- Name: Receiver name for {#MAC}
- Type: HTTP Agent
- Key: dev.receiver.name[{#MAC}]
- URL: http://{HOST.IP}/api/v1/public?dev.receivers
- Request method: GET
- Preprocessing:
- JSONPath: $.dev.receivers["{#MAC}"].info.name
When I run the individual steps, everything appears to be working. However, upon executing the Discovery rule I'm getting error messages such as "Cannot create item: item with the same key "dev.receiver.name[{#MAC}]" already exists."
I've tried various combination of HTTP Agents, Dependent items, etc. with no real luck. Would really appreciate some help before I give up on this project completely.
Thanks!