Quantcast
Channel: Veeam Support Knowledge Base
Viewing all articles
Browse latest Browse all 4362

How to Run Scripts With Veeam One Client

$
0
0

How to Run Scripts With Veeam One Client

KB ID: 1552
Product: Veeam ONE | 12 | 12.1
Published: 2012-03-11
Last Modified: 2024-08-14

Purpose

This article provides additional information about running scripts with Veeam ONE Client.

Solution

Script Configuration

Scripts can be configured for the following action types:

  • As an alarm notification action — select this option if you want to run a custom script when the alarm is triggered or when the alarm status changes. By running a script, you can automate routine tasks that you normally perform when specific alarms fire. For example, if a critical system is affected, you may need to immediately open a ticket with in-house support or perform corrective actions that will eliminate the problem.
Notification action script
  • As an alarm remediation action — using this option, you can specify what actions must be performed after the alarm is triggered or after the alarm status changes.
alarm action script

Script Arguments

You can use the following parameters in the command line for running the script: 

  • %1 — alarm name
  • %2 — affected node name
  • %3 — alarm summary
  • %4 — date and time of alarm trigger
  • %5 — alarm status
  • %6 — previous alarm status
  • %7 — ID assigned to a combination of an affected node and an alarm
  • %8 — type of a child alarm object.

Note: The executable script file must be located on the machine running the Veeam ONE Server component.

Script Examples

Below are examples of how a script can be used with the arguments passed from Veeam ONE Client.

Example 1: Logging Alarm Notifications to a File

In this example, 3 variables will be passed from Veeam ONE Client to a PowerShell script, and that script will use those variables as arguments to generate a log file listing the alarm's state changes.

Notification Action Configuration
Edit the Alarm, and add a 'Run script' action, and for the value specify the script and include the variables that will be passed to that script. For this example, the action value is:

powershell.exe C:\scripts\alarm.ps1 '%1' '%5' '%2'
example
Script Contents
The alarm.ps1 script file contains:
# Assign input arguments to variables
$alarmName=$args[0]
$alarmState=$args[1]
$objectName=$args[2]

# Format Text using Variables
$Text="$(Get-Date)" + "`r`n" + "$alarmName" + " alarm goes ->" + "$alarmState" + " on VM " + "$objectName" + "`r`n"

# Append text to log file.
$Text | Out-File E:\script\output.log -Append

Output Example
After alarms have triggered, the output.log should look similar to this: 


 

 

Example 2: Veeam ONE notifications via MS Teams and Slack

More Information

With this understanding, you should be able to write any script needed for your environment using variables from Veeam ONE alarms.

If you have any further scripting questions or issues, contact Veeam Support, and we will help you to the best of our ability per our support policy.

To submit feedback regarding this article, please click this link: Send Article Feedback
To report a typo on this page, highlight the typo with your mouse and press CTRL + Enter.

Viewing all articles
Browse latest Browse all 4362

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>