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 » 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.

Gostev
SVP, Product Management
Posts: 24788
Liked: 3521 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: Alarm Script

Post by Gostev » 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
SVP, Product Management
Posts: 24788
Liked: 3521 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: Alarm Script

Post by Gostev » 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!

cochran242
Lurker
Posts: 2
Liked: never
Joined: May 07, 2009 5:39 pm
Full Name: Casey Cochran
Contact:

Re: Alarm Script

Post by cochran242 » May 13, 2009 8:05 pm

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 » 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!

Gostev
SVP, Product Management
Posts: 24788
Liked: 3521 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 » Jun 03, 2009 1:17 pm

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 » 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.

Gostev
SVP, Product Management
Posts: 24788
Liked: 3521 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 » 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)" 
++++++++++++++++++++++++++++++++++++++++++

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 » 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

Vitaliy S.
Product Manager
Posts: 22976
Liked: 1555 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. » Apr 11, 2011 10:22 am

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 2 guests