Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command For Automatic Action (audible and email) 1

Status
Not open for further replies.

Ru55ell

IS-IT--Management
Mar 13, 2003
137
US
I have an event that when received I want it to execute an audible and an email. Both work independently. I want to put both commands in the “Command for Automatic Action” field to execute both an audible and send an e-mail. Does anyone know what character I can use to separate the two commands?
 
Thanks, The pipe doesn’t work. I have had to run the other command from Perl in the first script. I tried everything I could think of but never got it to work. If anyone does I would like to know.
 
I have a windows platform and have many events that perform various functions regularly. I have up to 3 commands on the command line for auto actions separated by the | and it works fine. The commands execute a batch file, java script, and an ovevent command.

What command are you using?
 
Wow, My next post I will put in some of the commands I used. Did you use a space,pipe,space? Pipe in quotes, or \\?
 
goldiec74

c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Down" $5 | mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\NodeupPC.WAV

I looked back at my notes, I tried it with and without spaces, I think. Now I'm not so sure. Anyway the line above did not work. Can you suggest anything?
 
I have tried the following combinations in ovactions node down and node up looking for one that would work. To refresh, I am trying to launch two automatic actions from the automatic action field in the event configuration dialog box. Both commands work independently of each other.

**Test "|" pipe separator...

c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Down" $5 | mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\Nodedowntest.WAV
c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Up" $5|mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\Nodeuptest.WAV

neither above worked

mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\Nodedowntest.WAV
mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\Nodeuptest.WAV

above worked without em script.

c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Down" $5
c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Up" $5

above worked without audible


mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\Nodedowntest.WAV | c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Down" $5
mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\Nodeuptest.WAV|c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Up" $5

above resulted in a Mediplayer error "cannot determine the device type from the given filename extension.

"mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\Nodedowntest.WAV" | c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Down" $5
"mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\Nodeuptest.WAV"|c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Up" $5

above resulted, no audible. no em and got the below ovaction error in LOG.
Tue Feb 15 09:54:54 Command ""mplay32 -play -close C:\Program Files\HP OpenView\NNM\audiofiles\Nodedowntest.WAV" | c:\ovscripts\perl "C:\ovscripts\scripts\email_alert_nw.pl" 10.196.4.93 "Node Down" 1108479293" exited with value 1.
Tue Feb 15 09:55:17 Command ""mplay32 -play -close C:\Program Files\HP OpenView\NNM\audiofiles\Nodeuptest.WAV"|c:\ovscripts\perl "C:\ovscripts\scripts\email_alert_nw.pl" 10.196.4.93 "Node Up" 1108479310" exited with value 1.

'mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\Nodedowntest.WAV' | c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Down" $5
'mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\Nodeuptest.WAV'|c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Up" $5

above resulted, no audible. no em and got the below ovaction error in LOG.
Tue Feb 15 10:00:37 Command "'mplay32 -play -close C:\Program Files\HP OpenView\NNM\audiofiles\Nodedowntest.WAV' | c:\ovscripts\perl "C:\ovscripts\scripts\email_alert_nw.pl" 10.196.4.93 "Node Down" 1108479636" exited with value 1.
Tue Feb 15 10:00:53 Command "'mplay32 -play -close C:\Program Files\HP OpenView\NNM\audiofiles\Nodeuptest.WAV'|c:\ovscripts\perl "C:\ovscripts\scripts\email_alert_nw.pl" 10.196.4.93 "Node Up" 1108479647" exited with value 1.

mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\"Nodedowntest.WAV" | c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Down" $5
mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\"Nodeuptest.WAV"|c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Up" $5

"Nodedowntest.WAV" |
"Nodeuptest.WAV"|







**Test ";" semicolon separator...

c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Down" $5 ; mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\Nodedowntest.WAV
c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Up" $5;mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\Nodeuptest.WAV

above resulted, no audible, no em, no ovaction event in the LOG.

mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\Nodedowntest.WAV ; c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Down" $5
mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\Nodeuptest.WAV;c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Up" $5

above resulted in a Mediplayer error "cannot determine the device type from the given filename extension.

mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\"Nodedowntest.WAV" ; c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Down" $5
mplay32 -play -close C:\\Program Files\\HP OpenView\\NNM\\audiofiles\\"Nodeuptest.WAV";c:\\ovscripts\\perl "C:\\ovscripts\\scripts\\email_alert_nw.pl" $2 "Node Up" $5

above resulted in a Mediplayer error "cannot determine the device type from the given filename extension.
 
Here's an example of one of my automatic actions:

OVHIDESHELL LM_playSounds.bat | LM_PollOnEvent.bat $r | ovevent -s Critical -c "Error Alarms" "" .1.3.6.1.4.1.11.2.17.1.0.58916871 .1.3.6.1.4.1.11.2.17.2.1.0 Integer 14 .1.3.6.1.4.1.11.2.17.2.2.0 OctetString "$8_Resources" .1.3.6.1.4.1.11.2.17.2.4.0 OctetString "Status is" .1.3.6.1.4.1.11.2.17.2.4.0 OctetString "Critical"

The command is one continuous string. I'm sure you know about OVHIDESHELL. You'll probably want to take that off while you are testing. the LM_playSounds.bat file contains the following (I've included only the command for playing sounds locally, if you need to play a sound on a remote windows box from a windows server let me know):

@echo off
"c:\program files\windows media player\mplayer2.exe" /play /close c:\winnt\media\utopia windows exit.wav


The next command, LM_PollOnEvent.bat $r, executes a batch file to poll the reporting node to determine if certain processes are running.

The last command (the really long one) sets a custom icon to critical based on this event.

Make sure any batch files you create are placed in the hpov\bin directory.

Best of luck and let me know if you need further clarification and whether or not this helps!

 
Hi Ru55ell, I see that you are using a perl script that sends emails on the automated feature of NNM called email_alert_nw.pl, can I please have it? I also want to receive emails on automated actions....
 
Read up on Nigel's Perl Script. You can find it and info in this forum. Here is a link to a thread that mentions the script.


To update this thread I have discovered two ways to execute two actions when an event occurs. One way is to put a batch file in the OV actions that runs the audible and invokes the e-mail script. The other is to put the script in the OV actions and call both actions to be executed from the script. I don’t have a preference as they both perform flawlessly.
 
Geesh,

I've done this heaps before. Doesn't the pipe command

" | "

work? I'll research but I'm pretty sure that worked for me.

Cheers,

Larry
 
Hey great Larry, Thanks in advance for any time you spend on this. I’d really like to be able to put two actions in the “OV Actions” field. This would help because I have different variations of automatic actions depending on the event. This way I could manage it easier. I have tried all the combinations previously posted without success.
 
Try putting your commands in separate .bat file (make sure that you call ov.envvars.bat from the .bat file) and separate them with a " | ". This works perfectly everytime.
 
goldiec74
Thanks for your input thus far. What is “ov.envvars.bat” . Should I create a batch file for each action I want performed and then enter the batch files on the ovactions line separated by a <space><pipe><space>? I could see the value in this because I can use different combinations of batch files to get the results wanted depending on the event.
 
ov.envvars.bat sets the HPOV environment variables. You'll need this instead of hard coding the path in your script (e.g., %OV_CONF% instead of c:\program files\hp openview\nnm\conf). Just enter a line that says:

call ov.envvars.bat

I have a bat file that executes sound and another one that calls a java program to change the icon from one type to another. The event conditions are the same sometimes and different others so I may have an action that looks like this for one:

playsound | changeicon

or it might be just playsound.

Remember to put the bat files in the HPOV bin (%OV_BIN%) directory so that you can call directly from the automatic action. We have the bat file in bin and a custom directory in bin containing the java program that is called from the bat file.
 
Recent Status.

I got a script to works and pretty well at that. The only issue I have with it is it is slow. I’ll explain.

I have several classifications of nodes. Each classification when a down event arrives sets off a unique audible and e-mails a group of technicians. I have one script that contains all the coditions and e-mail list. (One script makes for easy maintenance.) The script is slow in that it processes one event at a time and when hammered with multiple events takes a while to process all of them. This results in delayed audibles. Ideally it would process the audio separate from the e-mails and result in the audibles being heard in a chain (or closer cadence) when multiple devices go down.

I will keep this page updated as progress is made.

P.S. Moonsdarkside, post you scripts if possible.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top