Hi,
I am often confronted with this problem.
I use a PowerShell script for a "Low Discovery" and then I use another script to make a check on a "prototype item" and trigger it if necessary.
It works, but requires me to run an instance of my PS script for each item detected by my discovery. If I have a lot of items, my server running my powershell script has to instantiate a large number of powershell sessions.
This is not very optimized, especially when I can sometimes have my value to test directly in my discovery.
For example, I want to trigger an alert when a snapshot made on my VMs in VMWARE exceeds 10GB.
I use a first powershell discovery script that will trace back to Zabbix a JSON with for each snapshot, a key "{#SNAPSHOTNAME}", "{#SNAPSHOTVM}", "{#SNAPID}".
ex: {
"{#SNAPSHOTNAME}": "VEEAM BACKUP TEMPORARY SNAPSHOT",
"{#SNAPSHOTVM}": "MYVM",
"{#SNAPID}": "VirtualMachineSnapshot-snapshot-39709"
},
Then, I use an item-prototype which takes as parameter [{#SNAPSHOTVM,{#SNAPID}] to trigger a script that will recover the size of the snapshot.
This second script will have to run as many times as I have snapshots.
It's a pity, because I could very well find in my discovery script, an additional key {#SNAPSHOTSIZE}. This way, I will have the size of the snapshots directly via a single execution of my discovery script.
My problem is that I don't know how to evaluate in a trigger my {#SNAPSHOTSIZE} key or create an ITEM directly on this key without having to play a second script.
Thanks for your Help
Zabbix Version : 5.2.1
I am often confronted with this problem.
I use a PowerShell script for a "Low Discovery" and then I use another script to make a check on a "prototype item" and trigger it if necessary.
It works, but requires me to run an instance of my PS script for each item detected by my discovery. If I have a lot of items, my server running my powershell script has to instantiate a large number of powershell sessions.
This is not very optimized, especially when I can sometimes have my value to test directly in my discovery.
For example, I want to trigger an alert when a snapshot made on my VMs in VMWARE exceeds 10GB.
I use a first powershell discovery script that will trace back to Zabbix a JSON with for each snapshot, a key "{#SNAPSHOTNAME}", "{#SNAPSHOTVM}", "{#SNAPID}".
ex: {
"{#SNAPSHOTNAME}": "VEEAM BACKUP TEMPORARY SNAPSHOT",
"{#SNAPSHOTVM}": "MYVM",
"{#SNAPID}": "VirtualMachineSnapshot-snapshot-39709"
},
Then, I use an item-prototype which takes as parameter [{#SNAPSHOTVM,{#SNAPID}] to trigger a script that will recover the size of the snapshot.
This second script will have to run as many times as I have snapshots.
It's a pity, because I could very well find in my discovery script, an additional key {#SNAPSHOTSIZE}. This way, I will have the size of the snapshots directly via a single execution of my discovery script.
My problem is that I don't know how to evaluate in a trigger my {#SNAPSHOTSIZE} key or create an ITEM directly on this key without having to play a second script.
Thanks for your Help
Zabbix Version : 5.2.1