Powershell script to forward alarms

Monitoring and reporting for Veeam Backup & Replication, VMware vSphere and Microsoft Hyper-V

Powershell script to forward alarms

Veeam Logoby sandsturm » Thu Apr 20, 2017 6:12 pm

Hi all

I'm searching for an example powershell script to forward alarms from Veeam One into the script. My idea is to trigger a powershell script from the alert management/run script option. I can't find examples how to pass the variables (alarm name, alarm status etc.) into a powershell script. Does anyone know how to do that?

many thanks
sandsturm
sandsturm
Enthusiast
 
Posts: 40
Liked: 1 time
Joined: Mon Mar 23, 2015 8:30 am

Re: Powershell script to forward alarms

Veeam Logoby Shestakov » Fri Apr 21, 2017 8:57 am

Hi sandsturm,
Could you describe your use case?
In the alarm`s "Actions" you may choose an option to run script.
Thanks!
Shestakov
Veeam Software
 
Posts: 4937
Liked: 407 times
Joined: Wed May 21, 2014 11:03 am
Location: Saint Petersburg
Full Name: Nikita Shestakov

Re: Powershell script to forward alarms

Veeam Logoby Vitaliy S. » Fri Apr 21, 2017 12:02 pm

You can review script variables in this KB article, scroll down below to the More Information section.
Vitaliy S.
Veeam Software
 
Posts: 19695
Liked: 1117 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: Powershell script to forward alarms

Veeam Logoby sandsturm » Tue May 02, 2017 12:05 pm

Hi
I want to do the following:
Each time an alert is triggered in veeam ONE, a powershell script must be triggered. All alert parameters from veeam one (name, severity etc.) should be passed to this script. That means, in the alarm settings/actions/run script option of Veeam one, i want to put in something like

powershell.exe -command <path to alertscript.ps1> in field value.

The powershell script will look something like:

...
$alarm_name = $args[0]
$alarm_severity = $args[1]
....
<scriptcode to do something with the alarms>
....

# send alarm to our ITSM (eventmgmt system)
send-alarm -alarm_name $alarm_name -alarm_severity $alarm_severity ... -alarmsystem <URL_of_our_alarmsystem>


I hope this will clarify, what i want to do?
regards
sandsturm
sandsturm
Enthusiast
 
Posts: 40
Liked: 1 time
Joined: Mon Mar 23, 2015 8:30 am

Re: Powershell script to forward alarms

Veeam Logoby Vitaliy S. » Wed May 03, 2017 11:55 am

Yes, it does. Have you tried to review how parameters are passed in the batch scripts from the KB article?
Vitaliy S.
Veeam Software
 
Posts: 19695
Liked: 1117 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: Powershell script to forward alarms

Veeam Logoby sandsturm » Wed May 03, 2017 12:23 pm

Yes, I did, but that does not work for me. I don't want to start a batch script and start the powershell script from within this batch script. Isn't it possible to run the powershell script directly?
sandsturm
Enthusiast
 
Posts: 40
Liked: 1 time
Joined: Mon Mar 23, 2015 8:30 am

Re: Powershell script to forward alarms

Veeam Logoby Shestakov » Wed May 03, 2017 2:53 pm

As far as I know "direct" scripts are not supported. So it`s better to use .bat file
You can use these arguments in the batch file:
    %1 - Alarm
    %2 - Fired node name
    %3 - triggering summary
    %4 - Time
    %5 - status
    %6 - old status
Thanks!
Shestakov
Veeam Software
 
Posts: 4937
Liked: 407 times
Joined: Wed May 21, 2014 11:03 am
Location: Saint Petersburg
Full Name: Nikita Shestakov

Re: Powershell script to forward alarms

Veeam Logoby sandsturm » Thu May 11, 2017 11:01 am

Okay, thank you. I was able to run a powershell script to, but I can't pass the variables (%1,%2...) correctly to the powershell script. So I start a .cmd and within this bat file I start my powershell script. This works fine.
Another question:
Is there an ID to find somewhere for each created alarm? I want to send all alerts to our global event collector, but if I do this, I need a unique identifier for each event, because if, for example, the OK message is fired from Veeam One for a former Error or Warning, i have to map this OK message to the according alarm. Is there a way to grab a unique alarm idenifier?

thx and regards
sandsturm
sandsturm
Enthusiast
 
Posts: 40
Liked: 1 time
Joined: Mon Mar 23, 2015 8:30 am

Re: Powershell script to forward alarms

Veeam Logoby Shestakov » Fri May 12, 2017 12:48 pm

There is no list of ID numbers because they vary from installation to installation, but you can find your particular alarm IDs in the table monitor.Alarm.
Thanks!
Shestakov
Veeam Software
 
Posts: 4937
Liked: 407 times
Joined: Wed May 21, 2014 11:03 am
Location: Saint Petersburg
Full Name: Nikita Shestakov

Re: Powershell script to forward alarms

Veeam Logoby sandsturm » Fri May 12, 2017 1:22 pm

Thank you for your answer, I saw the ID in monitor.Alarm table, but this is a general ID for each specific type of alarm. I need an ID for each thrown alert/alarm which means, if Guest disk space is full on Server A1 for example, i want to see an ID 027 for this alert, and if server B5 has the same problem, another alarm ID must be generated (for the same type of alert, but for another server).
But as I understand you correct, this isn't the case, though Veeam ONE is no option to use in our company. We actually use Veeam MP for SCOM (where an alert ID is generated for each alarm), but I was searching for an alternative, because I don't have the "VM Change rate" report in Veeam MP for example.

thank you for your help
sandsturm
sandsturm
Enthusiast
 
Posts: 40
Liked: 1 time
Joined: Mon Mar 23, 2015 8:30 am

Re: Powershell script to forward alarms

Veeam Logoby Shestakov » Sat May 13, 2017 11:00 pm

I`ve got your point.
But what is the use case for different alarm IDs for each object? Do VMs you have different admins and you need to notify a corresponding admin?
Thanks!
Shestakov
Veeam Software
 
Posts: 4937
Liked: 407 times
Joined: Wed May 21, 2014 11:03 am
Location: Saint Petersburg
Full Name: Nikita Shestakov

Re: Powershell script to forward alarms

Veeam Logoby sandsturm » Mon May 15, 2017 5:53 am

We have different monitoring containers in our company (SCOM with Veeam Management Pack, Nagios, etc.). All these systems forward their alarms over an event dispatcher platform into our ITSM. In this ITSM, events/alarms are redirected to the appropriate operations team where tickets appear depending on alarms severity. Let me explain one of many examples why this ID is important for us.
If an urgent alarm is generated within Veeam, a priority 1 alarm is generated in ITSM based on this, which means an SMS will be sent to the person in charge (Prio 1 leads to an SMS, while Prio 2 and less will create a ticket). If for any reason, this alarm is gone in Veeam (automatically) some minutes later, an event with Status=Reset/resolved is generated. We forward this (Reset)-alarm to our ITSM as well and the original alarm will be closed and a further SMS will be sent tot he person in charge, that he knows that nothing is to do. This matching of Alarm with Prioritiy 1 and Resolve-Alarm can be done only if I have a unique identifier, otherwise I can't do this match.
This is an elementary feature for us. Actually we use Veeam Management Pack with SCOM and there it is possible, because I have an ID within SCOM. But I want to switch from MP to Veeam ONE because of the better reporting, but I'm able to switch only in the case the alerting works as explained above.

I'm not a native english speaker, but I hope you understand what I mean?

Thx,
sandsturm
sandsturm
Enthusiast
 
Posts: 40
Liked: 1 time
Joined: Mon Mar 23, 2015 8:30 am

Re: Powershell script to forward alarms

Veeam Logoby Shestakov » Fri May 26, 2017 3:03 pm

Hello sandsturm,
I do understand your point and it makes sense for me. Thanks for the explanation.

To clear up the request, SCOM has unique ID per-alert / per-object, but ID is same for all triggers of such alarms.
I.e. say VM1 has alert on CPU Usage and its id is 00001, if VM2 has CPU Usage above the alert`s threshold, it will have id = 00002. If CPU Usage triggers again for VM1 the id alert is 00001 again.
Unlike SCOM, Veeam ONE has unique ids only for the alerts(alarms) themselves.

If we add unique IDs for each alarm / object, will it be sufficient for your case?

Thanks!
Shestakov
Veeam Software
 
Posts: 4937
Liked: 407 times
Joined: Wed May 21, 2014 11:03 am
Location: Saint Petersburg
Full Name: Nikita Shestakov

Re: Powershell script to forward alarms

Veeam Logoby sandsturm » Mon May 29, 2017 5:11 am

Hi Shestakov

Yes, your explanation is exactly what we need. Do you think it's possible to implement such an ID?

thx a lot
sandsturm
sandsturm
Enthusiast
 
Posts: 40
Liked: 1 time
Joined: Mon Mar 23, 2015 8:30 am

Re: Powershell script to forward alarms

Veeam Logoby Shestakov » Mon May 29, 2017 10:30 am

Nothing is impossible for our R&D :)
The question is when we have got time for it.
Thank you for that request, it really makes sense, I`ll add it to our road map.
Shestakov
Veeam Software
 
Posts: 4937
Liked: 407 times
Joined: Wed May 21, 2014 11:03 am
Location: Saint Petersburg
Full Name: Nikita Shestakov

Next

Return to Veeam ONE



Who is online

Users browsing this forum: No registered users and 6 guests