-
- 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
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.
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.
-
- Chief Product Officer
- Posts: 31789
- Liked: 7291 times
- Joined: Jan 01, 2006 1:01 am
- Location: Baar, Switzerland
- Contact:
Re: Alarm Script
Casey, it makes and I understand what are you trying to do. Let me check with developers on that.
-
- Chief Product Officer
- Posts: 31789
- Liked: 7291 times
- Joined: Jan 01, 2006 1:01 am
- Location: Baar, Switzerland
- Contact:
Re: Alarm Script
Here are the parameters that can be passed to script:
So in your case, it sounds like you need to use %3 (I have not tested this myself yet).
Hope this helps!
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
Hope this helps!
-
- Lurker
- Posts: 2
- Liked: never
- Joined: May 07, 2009 5:39 pm
- Full Name: Casey Cochran
- Contact:
Re: Alarm Script
That is perfect. thank you very much!!!!
-
- Lurker
- Posts: 2
- Liked: never
- Joined: Jun 02, 2009 7:02 pm
- Contact:
Re: How To: Pass alarm details to the alarm response script
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!
Thanks!
-
- Chief Product Officer
- Posts: 31789
- Liked: 7291 times
- Joined: Jan 01, 2006 1:01 am
- Location: Baar, Switzerland
- Contact:
Re: How To: Pass alarm details to the alarm response script
Can you post here the command line you use for script action, as well as the actual script?
-
- Lurker
- Posts: 2
- Liked: never
- Joined: Jun 02, 2009 7:02 pm
- Contact:
Re: How To: Pass alarm details to the alarm response script
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.
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.
-
- Chief Product Officer
- Posts: 31789
- Liked: 7291 times
- Joined: Jan 01, 2006 1:01 am
- Location: Baar, Switzerland
- Contact:
Re: How To: Pass alarm details to the alarm response script
You can use this script as a sample.
Just be sure to create C:\TEMP folder.
c:\alarm.bat
Run script action line is:
Sample output:
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"
Code: Select all
C:\alarm.bat %1 %2 %3 %4 %5 %6 %7
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)"
++++++++++++++++++++++++++++++++++++++++++
-
- Novice
- Posts: 6
- Liked: never
- Joined: Jan 01, 2006 1:01 am
- Contact:
Re: How To: Pass alarm details to the alarm response script
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
#%1 : Alarm name
#%2 : VI object name on which alarm has fired
#%3 : Triggering summary
#%4 : Time
#%5 : Status
#%6 : Old Status
-
- VP, Product Management
- Posts: 27368
- Liked: 2797 times
- Joined: Mar 30, 2009 9:13 am
- Full Name: Vitaliy Safarov
- Contact:
Re: How To: Pass alarm details to the alarm response script
Ricky is correct. To get the latest parameters list please check out our User Guide (page 68)
Who is online
Users browsing this forum: No registered users and 3 guests