I have been meaning to respond to this for sometime but my other duties
keep me busy and I keep forgetting.
I take it that the nvmail command works for you from the command line and
you do get mail, correct?
If not, then the problem is usually that you are not specifying a true SMTP
mail server.
If the problem is that you get no mail when this is run from a trap, but it
works from the command line, then it may be that trapd cannot find nvmail.
The daemons do not share your path, so my advice is to always include a
complete one:
You have two choices. You can use a UNIX-style path (which is what trapd
is expecting because he is ported from UNIX) or you can use an NT-style
path, but that must be "escaped" because the underlying code does not
recognize it.
In other words, you can do this
C:/usr/ov/bin/nvmail.exe <rest_of_nvmail_command>
or you can do this:
C:\\usr\\ov\bin\\nvmail.exe <rest_of_nvmail_command>
The double \\ backslashes here are necessary because the single one is
interpreted as an escape character.
When I enclose the subject or message with the $2 and $2 variables within
quotes, it all works fine for me.
As for passing variables, you must remember that this is NT, not UNIX, and
that you are dealing with bat files.
So you must respect the requirements for that. You might be happier using
a real scripting language such as TCL or PERL.
But, in your bat file you must reference the passed parameters with a
percent sign, % , and remember that they are positional.
The first passed parameter is %1, the second %2, and so on.
So your netsend.bat would have to look something like this:
-------START SCRIPT-------
net send pc_name "Warning ! Node %2 is %3"
-------END OF SCRIPT-------
and you would have something like this in the box labeled "Run this command
..."
C:/netsend.bat $2 "$3"
The quotes around the $3 are necessary because it resolves to a string
containing blanks and the netsend is blank delimited.
I have tested this all many times and it works fine for me.
You might want to call IBM/Tivoli Support if you have any further
difficulties with this as they have helped many folks sort this out.
James Shanks
Team Leader, Level 3 Support
Tivoli NetView for UNIX and NT
"Davide Depaoli" <davide.depaoli@hmsmail.labinf.it>@tkg.com on 06/28/2001
07:56:30 AM
Please respond to IBM NetView Discussion <nv-l@tkg.com>
Sent by: owner-nv-l@tkg.com
To: <nv-l@tkg.com>
cc:
Subject: [NV-L] Help on Netview 6.0.2 for WinNT
Hello,
I've one problem and one question.
The problem regarding nvmail program, and is the following:
>
I have configured some traps so as to send e-mail when event is received.
To do this have used nvmail program supplied with netview.
My problem is that nvmail doesn't work. The command sintax used is :
nvmail -server my_smtp_server -recipient my_email_address -subject "$3 on
server $2" -message "body text of email", where $3 is event description
and $2 nodename.
Have tryied both on trap properties "Run this command....." field and into
an external script, but never works and n \usr\ov\log\nv.log nothing is
written.
The question is if is possible to pass trap variables ($2, $3, $A,.....)
to an external script. For example I want to send a message with "net
send" command passing the event description and a nodename. I make a
script :
c:\netsend.bat
-------START SCRIPT-------
net send pc_name "Warning ! Node $2 is down"
-------END OF SCRIPT-------
where $2 is a netview variable.
Thanks in advance for any help
Best regards,
Davide Depaoli
HMS Santhia' - Italy
|