Now you’re less likely to miss what’s been brewing in our knowledge base with this weekly digest
There are two possibilities to run a script with Veeam ONE:
To run a custom script, in the Action list, select Run script and enter the path to the executable file in the field on the right. You can use the following parameters in the command line for running a script:
%1 — alarm name; %2— fired node name; %3 — triggering summary; %4 — time; %5 — alarm status; %6 — old alarm status.
The executable file must be located on the machine running the Veeam ONE Server component.
How to set up a script.
Select an existing alarm or create a new one using the Alarm Management tab. Once done, click Edit (if an existing alarm), and then select the Notifications tab.
From here, you can click the Add button and set the action to "Run script". Once done, go ahead and add your script path, passing the variables needed for your script.
Or if you wish it to be run as a remediation action select Actions tab:
In this example, we will be using 3 variables and a .ps1 file that is written in PowerShell. Please keep in mind that other file types can be used as long as they can be run in windows.
Now that we have the Alarm Notification set up, let's go over what is needed in the script. For the script "alarm.ps1", let’s use the following variables to pass the information needed. This is the full text indicated in the alarm settings:
powershell.exe E:\script\alarm.ps1 '%1' '%5' '%2'
This is the script content:
$AlarmName=$args[0]
$AlarmState=$args[1]
$ObjectName=$args[2]
$Text="$(Get-Date)" + "`r`n" + "$AlarmName" + " alarm goes ->" + "$AlarmState" + " on VM " + "$ObjectName" + "`r`n"
$Text | Out-File E:\script\output.log -Append
After passing the arguments the result is saved into the $Text variable and the result is typed into the output file with the current date information. "`r`n" means new line here, “Get-Date” cmdlet returns the actual date and time.
Once done, your output should look similar to this:
With this understanding, you should be able to write any script needed for your environment using our variables. If you have any further scripting questions or issues, contact Veeam Support and we will help you to our best abilities per our support policy.
Your feedback has been received and will be reviewed.
Please try again later.
Please try select less.
This form is only for KB Feedback/Suggestions, if you need help with the software open a support case
Your feedback has been received and will be reviewed.