I'm trying to convert my hyper-v monitoring templates and scripts to work without any installing scripts on the hyper-v servers.
For this, I can get the list of VM on the Hyper-V host via the
key.
This then returns a json structure, just fine to create hosts.
With a filter to take out the _Total values I get the remaining sv03 and sv04 values to use it a name prototypes.
The name of the host prototypes is then: {#INSTANCE}
This works fine and it creates two new hosts sv03 and sv04 in Zabbix.
But unfortunally this is not good enough, since we need to have the name of the hyper-v host included somewhere in the new hosts names.
So basically if the Hyper-V host is named: HYPERV01, then I wish to have the VM hosts named HYPERV01_sv03 and HYPERV01_sv04
But adding {HOST.NAME}_{#INSTANCE} does not work, as the {HOST.NAME} seems to be unknown inside the discovery run.
Any ideas how to get the host name of the Hyper-V server present inside the discovery process?
For this, I can get the list of VM on the Hyper-V host via the
Code:
perf_instance_en.discovery["Hyper-V VM Vid Partition"]
This then returns a json structure, just fine to create hosts.
Code:
[{"{#INSTANCE}":"_Total"},{"{#INSTANCE}":"sv03"},{"{#INSTANCE}":"sv04"}]
The name of the host prototypes is then: {#INSTANCE}
This works fine and it creates two new hosts sv03 and sv04 in Zabbix.
But unfortunally this is not good enough, since we need to have the name of the hyper-v host included somewhere in the new hosts names.
So basically if the Hyper-V host is named: HYPERV01, then I wish to have the VM hosts named HYPERV01_sv03 and HYPERV01_sv04
But adding {HOST.NAME}_{#INSTANCE} does not work, as the {HOST.NAME} seems to be unknown inside the discovery run.
Any ideas how to get the host name of the Hyper-V server present inside the discovery process?
Comment