Hello all:
I have a discovery rule that runs a script and returns valid JSON. The rule has one item prototype and one host prototype. Here is the rule:
Template App SST FLEX Zone discovery which runs
system.run["/usr/lib/zabbix/externalscripts/sst-sstzones-ds.php {HOST.HOST} FLEX"]
The host prototype is:
sstzone-{#ZONE}
the host prototype attach's a couple of templates to the dynamically created host. The host prototype works great, hosts are created as expected, here is a sample JSON output of the above script, only one macro element per entity:
All so far so good. Now on the SAME discovery rule I also have an item prototype as follows:
Name: sstzone-{#ZONE} Indoor Enabled
Key: indoor_enabled[(#ZONE}]
Type: trapper
When the lld script executes, the hosts are created from the host prototype just fine, however I would exect an item to be created on the host running the lld script, one for each zone returned by the JSON. I am not getting the items created, and looking in the zabbix_server.log I do see these so it implies the item prototype is being evaluated:
But the item does not get created from the prototype. The lld prototype does not contain any error, stays enabled, etc. I just don't get the ultimate item created. The workflow is
no errors appear anywhere that I can see. I have other lld scripts that create items from item prototypes just fine, so I am not sure what is happening here. Any ideas?
I have a discovery rule that runs a script and returns valid JSON. The rule has one item prototype and one host prototype. Here is the rule:
Template App SST FLEX Zone discovery which runs
system.run["/usr/lib/zabbix/externalscripts/sst-sstzones-ds.php {HOST.HOST} FLEX"]
The host prototype is:
sstzone-{#ZONE}
the host prototype attach's a couple of templates to the dynamically created host. The host prototype works great, hosts are created as expected, here is a sample JSON output of the above script, only one macro element per entity:
Code:
{"data":[{"{#ZONE}":"Zone1"},{"{#ZONE}":"Zone2"},{"{#ZONE}":"Zone3"},{"{#ZONE}":"Zone4"},{"{#ZONE}":"Zone5"}]}
All so far so good. Now on the SAME discovery rule I also have an item prototype as follows:
Name: sstzone-{#ZONE} Indoor Enabled
Key: indoor_enabled[(#ZONE}]
Type: trapper
When the lld script executes, the hosts are created from the host prototype just fine, however I would exect an item to be created on the host running the lld script, one for each zone returned by the JSON. I am not getting the items created, and looking in the zabbix_server.log I do see these so it implies the item prototype is being evaluated:
Code:
9105:20150514:154115.506 In substitute_discovery_macros() data:'sstzone-{#ZONE} Indoor Enabled'
9105:20150514:154115.506 End of substitute_discovery_macros():SUCCEED data:'sstzone-BirminghamALEast Indoor Enabled'
- RollupHostFoo has discovery template
- RollupHostFoo runs discovery
- Many hosts are created from the lld host prototype
- I expect an item created on RollupHostFoo for each discovered element, example indoor_enabled[Zone1]
- No items are created on RollupHostFoo
no errors appear anywhere that I can see. I have other lld scripts that create items from item prototypes just fine, so I am not sure what is happening here. Any ideas?