Real-time performance monitoring and troubleshooting
Post Reply
t481
Enthusiast
Posts: 82
Liked: 1 time
Joined: Apr 28, 2015 7:52 am
Contact:

[Q] Script to remediate on VM

Post by t481 »

Hello,
I have a few alerts defined that will alarm when the system drive gets below a certain level. I have a script that clears some specific directories. If I associate a script with the alarm in Veeam ONE would it automatically trigger the script against the entity generating the alarm i.e. the virtual machine?
wishr
Veteran
Posts: 3077
Liked: 453 times
Joined: Aug 07, 2018 3:11 pm
Full Name: Fedor Maslov
Contact:

Re: [Q] Script to remediate on VM

Post by wishr »

Hi T481,

Yes, this is possible. You can specify the name of the object using “%2” variable after the path to the script to pass it to the script.

Example:

Code: Select all

powershell.exe "D:\ps.ps1" %2
Please, note that to make this work the alarm should have a VM as a target (source) and not something like a backup server. In the latter case, the name of the backup server will be passed to the script.

Reference table:
1 – alarm name;
2 – alarm object name (source);
3 – the time when alarm triggered;
4 – alarm status;
5 – alarm triggering parameters in .XML format (mostly used internally);
6 - triggered alarm ID, which is unique for each alarm-object bundle.

The first variable specified in the script path line will be passed to the script as an argument with the number 0, the second variable with the number 1, the third with the number 2, etc.

Example of the script:

Code: Select all

$text = 'node name - ' + $Args[0]
Write-Output $text
Thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests