Server Management (Insight Manager 7)
1753347 Members
4985 Online
108792 Solutions
New Discussion юеВ

How to pass variables to a batch file from CIM 7.x

 
David Roth
Occasional Contributor

How to pass variables to a batch file from CIM 7.x

Hello, I am running CIM 7.2 and was trying to pass meaningful values to a batch file for problem ticket automation through an application launch. I was able to get the DEVICENAME and NOTICESEVERITYSTR and NOTICELABEL passed however I need to capture the actual alert or trap. Whenever I try and use SPECIFICTRAPID or GENERICTRAPID it never sends a value just the literal that was typed in with the leading and trailing %'s. Has anyone been able to successfully generate messages using variable names and gotten information of value?

Thanks,
Dave
6 REPLIES 6
Scott Shaffer
Esteemed Contributor

Re: How to pass variables to a batch file from CIM 7.x

I assume you know that those variablse you mention are passed automatically to the batch file when the Application Launch task runs - and you don't want or need to define them in the user-defiend parameters list (this often causes trouble.)

Assuming that is the case, then for every SNMP Trap that comes in you should get the TRAPID fields filled in. However, those will just be trap numbers and probably aren't what you want.

Are you saying you'd like to have the raw binary trap data? If so, then this isn't possible via application launch.

If you are saying you'd just like all the information IM7 has on the trap, try using NOTICERAWDATA. NOTICEPLAINTEXT might also be helpful to you.

Again - all the named Environment Variables listed in the help are automatically passed to all application launch executions (although App Launch configured against a device query won't have the notice ones filled in of course.)
Dude, we've been totally misled by our album covers!
David Roth
Occasional Contributor

Re: How to pass variables to a batch file from CIM 7.x

Yes Thank you Scott I will give that a try. I am using the app launch off a query that I defined to grab servers that are having problems so we can get a ticket to track our different server issues. I will let you know how it worked with the NOTICEPLAINTEXT or NOTICERAWDATA. I definatly do not want to pass the actual SNMP trap ID.
Garth Williams
Advisor

Re: How to pass variables to a batch file from CIM 7.x

Good Morninig, David.

Could you enlighten me on this somewhat? I have a notification task (batch file) that is to be kicked off on critical events received that should display (echo) all those variables, but it does not seem to be happening. My goal is to create an SNMP trap (from a command line) to another (NNM) system.

Would you help?

Thanks!

Garth
David Roth
Occasional Contributor

Re: How to pass variables to a batch file from CIM 7.x

Scott. I still am unable to pass any "valuble" alerts to my batch file. About the only variable that is of any worth is the DEVICENAME. How can I get information such as "BLAHBLAHBLAHServer has a major alert with it's integrated log" or "BLAHBLAHBLAHServer's hard drive is status Failed."?

Thanks,
Dave
Scott Shaffer
Esteemed Contributor

Re: How to pass variables to a batch file from CIM 7.x

Dave - do you have the app launch setup to run against an Event Query? If you have it setup to run against a Device Query then you won't get any of the good variables.

But, assuming you have it setup against an Event Query - how are you testing it? If you send the Test Trap (from the agent Control Panel app) you should be able to see all the EVs passed on an app launch. Just launch a script that does a 'set > \evs.txt' and take a look at what is filled into \evs.txt.
Dude, we've been totally misled by our album covers!
Garth Williams
Advisor

Re: How to pass variables to a batch file from CIM 7.x

For anyone who wants it, here is a batch file that you can call from the Launch Application Task that will display this information. Hope it helps!
Just chaneg the set outfile to a name and directory that works for you.

g

:start
@echo off
set outfile=c:\temp\eventdata.txt

echo ---------------------------------------------------------------------------- >%outfile%
echo INSIGHT MANAGER EVENT DATA TO ENVIRONMENT VARIABLE TEST >>%outfile%
echo ---------------------------------------------------------------------------- >>%outfile%
echo Type of Notice: %NOTICELABEL% >>%outfile%

echo State (cleared or not): %NOTICESTATE% >>%outfile%
rem (used internally by Insight Manager)

echo Description: %NOTICEPLAINTEXT% >>%outfile%
rem (plain text description of the notice)

echo Severity (Verbose): %NOTICESEVERITYSTR%, Severity Code: %NOTICESEVERITY% >>%outfile%
rem (100=Informational, 5=critical, 4=Major, 3=Minor, 2=Warning, 1=Normal)

echo Originating Device: %DEVICENAME%, IP Address: %DEVICEIPADDRESS0% >>%outfile%
rem (device and its' IP address, associated with this event)

echo ---------------------------------------------------------------------------- >>%outfile%
echo Generic Trap ID: %GENERICTRAPID% >>%outfile%
echo Specific Trap ID: %SPECIFICTRAPID% >>%outfile%
echo ---------------------------------------------------------------------------- >>%outfile%
echo Raw Data: %NOTICERAWDATA% >>%outfile%
rem (additional information that MIGHT be useful)
echo ---------------------------------------------------------------------------- >>%outfile%
:end