Hello,
Been a day trying to get a simple discovery rule to work, creating a couple of items from a JSON file fetched by a HTTP Agent. I assume there's just something very simple and small wrong in the configuration, but.. Cannot figure out what.
In short, I have an item which fetches the JSON file by HTTP and that works. I also have a discovery rule as a Dependant Item, and it only contains one LLD Macro: {#APNAME} -> $..name.
The JSON looks like this.
If I test with a preprocessing rule (JSONPath, $..name) in the discovery rule I get expected (?) results, it returns ["AP01 Upstairs","AP02 Lobby","Total-AP"]. Naturally the preprocessing rule is not left there, just used for testing and the {#APNAME} LLD macro is the only thing left in the discovery rule.
And now to the problem.. If I create a Item Prototype as Dependant Item the LLD Macro {#APNAME} is not resolved to invidual APs as expected, but to all three.
So basically the configuration:
Name: {{#APNAME} Clients
Key: unifi.ap.clients[{#APNAME}]
Type: Numeric
Preprocessing: JSONPath -> $.items[?(@.name == "{#UNIFIAPNAME}")].clients (Not sure if correct now, regsub will be added to remove the extra brackets etc)
Gives me item named:
AP Names Discovery: AP User Count: {["AP01 Upstairs","AP02 Lobby","Total-AP"] Clients
That doesn't naturally work.. And the keys etc are similarly named. So, it looks like the macro does not resolve to invidual items but to the list of items. Any ideas how t
Been a day trying to get a simple discovery rule to work, creating a couple of items from a JSON file fetched by a HTTP Agent. I assume there's just something very simple and small wrong in the configuration, but.. Cannot figure out what.
In short, I have an item which fetches the JSON file by HTTP and that works. I also have a discovery rule as a Dependant Item, and it only contains one LLD Macro: {#APNAME} -> $..name.
The JSON looks like this.
Code:
[{
"AP01 Upstairs": {
"name": "AP01 Upstairs",
"mac": "dfgdfg",
"type": "uap",
"intraclients": 2,
"guestclients": 1,
"clients": 3
},
"AP02 Lobby": {
"name": "AP02 Lobby",
"mac": "dfgdfg",
"type": "uap",
"intraclients": 2,
"guestclients": 3,
"clients": 5
},
"Total-AP": {
"name": "Total-AP",
"clients": 41,
"intraclients": 19,
"guestclients": 22,
"mac": "none",
"type": "none"
}
}]
And now to the problem.. If I create a Item Prototype as Dependant Item the LLD Macro {#APNAME} is not resolved to invidual APs as expected, but to all three.
So basically the configuration:
Name: {{#APNAME} Clients
Key: unifi.ap.clients[{#APNAME}]
Type: Numeric
Preprocessing: JSONPath -> $.items[?(@.name == "{#UNIFIAPNAME}")].clients (Not sure if correct now, regsub will be added to remove the extra brackets etc)
Gives me item named:
AP Names Discovery: AP User Count: {["AP01 Upstairs","AP02 Lobby","Total-AP"] Clients
That doesn't naturally work.. And the keys etc are similarly named. So, it looks like the macro does not resolve to invidual items but to the list of items. Any ideas how t


Comment