Real-time performance monitoring and troubleshooting
Post Reply
cochran242
Lurker
Posts: 2
Liked: never
Joined: May 07, 2009 5:39 pm
Full Name: Casey Cochran
Contact:

How To: Pass alarm details to the alarm response script

Post by cochran242 »

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.
Gostev
Chief Product Officer
Posts: 31532
Liked: 6703 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: Alarm Script

Post by Gostev »

Casey, it makes and I understand what are you trying to do. Let me check with developers on that.
Gostev
Chief Product Officer
Posts: 31532
Liked: 6703 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: Alarm Script

Post by Gostev »

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!
cochran242
Lurker
Posts: 2
Liked: never
Joined: May 07, 2009 5:39 pm
Full Name: Casey Cochran
Contact:

Re: Alarm Script

Post by cochran242 »

That is perfect. thank you very much!!!!
marcsonn
Lurker
Posts: 2
Liked: never
Joined: Jun 02, 2009 7:02 pm
Contact:

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

Post by marcsonn »

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!
Gostev
Chief Product Officer
Posts: 31532
Liked: 6703 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

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

Post by Gostev »

Can you post here the command line you use for script action, as well as the actual script?
marcsonn
Lurker
Posts: 2
Liked: never
Joined: Jun 02, 2009 7:02 pm
Contact:

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

Post by marcsonn »

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.
Gostev
Chief Product Officer
Posts: 31532
Liked: 6703 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

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

Post by Gostev »

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)" 
++++++++++++++++++++++++++++++++++++++++++
rickyelqasem
Novice
Posts: 6
Liked: never
Joined: Jan 01, 2006 1:01 am
Contact:

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

Post by rickyelqasem »

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
Vitaliy S.
VP, Product Management
Posts: 27114
Liked: 2720 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

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

Post by Vitaliy S. »

Ricky is correct. To get the latest parameters list please check out our User Guide (page 68)
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests