How To: Pass alarm details to the alarm response script

Real-time performance monitoring and troubleshooting

How To: Pass alarm details to the alarm response script

Veeam Logoby cochran242 » Thu May 07, 2009 5:48 pm

I would like to pass a variable to the Script ACTION. IE: i would like to run a script with an argument including the ESXi Host name. Is this possible? Right not I am creating a script action and including a hard coded argument:
c:\script\script.vbs VMServer

Instead I would like to do something like this with a variable:
c:\script\script.vbs %VMServerinquestion%

Is the above possible? Let me know if something does not make sense.
cochran242
Lurker
 
Posts: 2
Liked: never
Joined: Thu May 07, 2009 5:39 pm
Full Name: Casey Cochran

Re: Alarm Script

Veeam Logoby Gostev » Thu May 07, 2009 8:08 pm

Casey, it makes and I understand what are you trying to do. Let me check with developers on that.
Gostev
Veeam Software
 
Posts: 21390
Liked: 2349 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: Alarm Script

Veeam Logoby Gostev » Fri May 08, 2009 12:42 pm

Here are the parameters that can be passed to script:

Code: Select all
%1 : Alarm name
%2 : Alarm description
%3 : VI object name on which alarm has fired
%4 : Triggering summary
%5 : Time
%6 : Status
%7 : Previous status

So in your case, it sounds like you need to use %3 (I have not tested this myself yet).

Hope this helps!
Gostev
Veeam Software
 
Posts: 21390
Liked: 2349 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: Alarm Script

Veeam Logoby cochran242 » Wed May 13, 2009 8:05 pm

That is perfect. thank you very much!!!!
cochran242
Lurker
 
Posts: 2
Liked: never
Joined: Thu May 07, 2009 5:39 pm
Full Name: Casey Cochran

Re: How To: Pass alarm details to the alarm response script

Veeam Logoby marcsonn » Tue Jun 02, 2009 7:04 pm

Hello - wondering if you were able to successfully get variables into your script. I just started dabbling in this and it would appear that the variables that were listed here are not being set. Just curious how you're coming along.

Thanks!
marcsonn
Lurker
 
Posts: 2
Liked: never
Joined: Tue Jun 02, 2009 7:02 pm

Re: How To: Pass alarm details to the alarm response script

Veeam Logoby Gostev » Wed Jun 03, 2009 1:17 pm

Can you post here the command line you use for script action, as well as the actual script?
Gostev
Veeam Software
 
Posts: 21390
Liked: 2349 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: How To: Pass alarm details to the alarm response script

Veeam Logoby marcsonn » Wed Jun 03, 2009 1:24 pm

I was just trying to have it run a simple batch file, echoing the variables out to a text file, like:

echo %1 > vars.txt
echo %2 >> vars.txt
echo %3 >> vars.txt
.
.
.

Just to see what comes back in each variable. Unfortunately, the resulting text file is blank. I want to make sure what I understand is really what's supposed to be happening.
marcsonn
Lurker
 
Posts: 2
Liked: never
Joined: Tue Jun 02, 2009 7:02 pm

Re: How To: Pass alarm details to the alarm response script

Veeam Logoby Gostev » Wed Jun 03, 2009 2:15 pm

You can use this script as a sample.
Just be sure to create C:\TEMP folder.

c:\alarm.bat
Code: Select all
echo alarm is working >>C:\temp\alarm.txt
c:
cd c:\temp
date /t >> alarm.txt
time /t >> alarm.txt
echo %1 >> alarm.txt
echo %2 >> alarm.txt
echo %3 >> alarm.txt
echo %4 >> alarm.txt
echo %5 >> alarm.txt
echo %6 >> alarm.txt
echo %7 >> alarm.txt
echo ++++++++++++++++++++++++++++++++++++++++++ >> "c:\temp\alarm.txt"

Run script action line is:
Code: Select all
C:\alarm.bat %1 %2 %3 %4 %5 %6 %7

Sample output:
Code: Select all
alarm is working
Wed 06/03/2009
06:06 PM
"Test Alarm"
"Test Alarm"
"Marik_XP"
"Level of CPU is above 0 "
"6/3/2009 6:06:46 PM"
"Error (Red)"
"Ok (Green)"
++++++++++++++++++++++++++++++++++++++++++
alarm is working
Wed 06/03/2009
06:06 PM
"Test Alarm"
"Test Alarm"
"Igor NFS Test"
"Level of CPU is above 0 "
"6/3/2009 6:06:46 PM"
"Error (Red)"
"Ok (Green)"
++++++++++++++++++++++++++++++++++++++++++
alarm is working
Wed 06/03/2009
06:06 PM
"Test Alarm"
"Test Alarm"
"t_1"
"Level of CPU is above 0 "
"6/3/2009 6:06:47 PM"
"Error (Red)"
"Ok (Green)"
++++++++++++++++++++++++++++++++++++++++++
Gostev
Veeam Software
 
Posts: 21390
Liked: 2349 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: How To: Pass alarm details to the alarm response script

Veeam Logoby rickyelqasem » Sun Apr 10, 2011 12:21 pm

Variables have changed slightly to:

#%1 : Alarm name
#%2 : VI object name on which alarm has fired
#%3 : Triggering summary
#%4 : Time
#%5 : Status
#%6 : Old Status
rickyelqasem
Novice
 
Posts: 6
Liked: never
Joined: Sun Jan 01, 2006 1:01 am

Re: How To: Pass alarm details to the alarm response script

Veeam Logoby Vitaliy S. » Mon Apr 11, 2011 10:22 am

Ricky is correct. To get the latest parameters list please check out our User Guide (page 68)
Vitaliy S.
Veeam Software
 
Posts: 19558
Liked: 1102 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov


Return to Monitoring



Who is online

Users browsing this forum: No registered users and 4 guests