This doesn't have to be complicated. You can do it in one line just as the
example shows you.
For NetView traps, which always have the hostname in var 2 and the trap
description in var 3, something like this should work fine. I have used my own
email address -- please use yours.
echo "$NVATTR_2 sent this alert $NVATTR_3" | mailx -s "Alert from $NVATTR_2"
james.shanks@tivoli.com
For other traps, you have to decide what you want to say in the body of the note
and what variables you want to send. See the note on environment variables in
The NetView Administrator's Guide to see how you reference the enterprise id
($NVE),
the specific alert number ($NVS) and so on. Whatever you put in the first set
of double quotes is in the body of the note and whatever is in the second set
after the -s is the subject line. Try it with a test message to your id
from the command line (obviously you cannot reference the $NVATTR vars there
unless you set them first) and make sure it works before putting it in your
ruleset. Just put that whole command in the box for an Action node.
To send the same message from a trap as an automatic action, use xnmtrap to
modify the trap definition, and put this version of the command in that box:
echo "$2 sent this alert $3" | mailx -s "Alert from $2"
james.shanks@tivoli.com
Hope this helps.
James Shanks
Tivoli (NetView for UNIX) L3 Support
"Clay David (rti1dwc)" <rti1dwc@ISMD.UPS.COM> on 12/16/99 05:25:11 PM
Please respond to Discussion of IBM NetView and POLYCENTER Manager on NetView
<NV-L@UCSBVM.UCSB.EDU>
To: NV-L@UCSBVM.UCSB.EDU
cc: (bcc: James Shanks/Tivoli Systems)
Subject: Re: Trap Processing
Would anyone out there like to share their script file for sending emails
when traps occur? I am not a unix script developer or programmer.
-----Original Message-----
From: James Shanks [mailto:James_Shanks@TIVOLI.COM]
Sent: Thursday, December 16, 1999 12:46 PM
To: NV-L@UCSBVM.UCSB.EDU
Subject: Re: Trap Processing
In a ruleset. when a pre-defined node isn't available to do what you want,
then
you can write your own script or program and use an Action node to have it
execute. Here's an example from another user:
Subject: Re: Sending emails from the ruleset editor
I would suggest using a script file to send your e-mail message.
This is the line I usually use:
echo "message" | mailx -s "subject" user@id
Cheers,
Alvin Kienming Liau
IBM Worldwide Government Industry
You can use the $NVxxxx environment variables to say whatever you want in
the
message.
OR you could do the same thing from an automatic action for a trap and not
use a
ruleset at all,
but there you would reference the variables as $x. See the man page on
trapd.conf for details on that.
James Shanks
Tivoli (NetView for UNIX) L3 Support
"Clay David (rti1dwc)" <rti1dwc@ISMD.UPS.COM> on 12/16/99 12:11:14 PM
Please respond to Discussion of IBM NetView and POLYCENTER Manager on
NetView
<NV-L@UCSBVM.UCSB.EDU>
To: NV-L@UCSBVM.UCSB.EDU
cc: (bcc: James Shanks/Tivoli Systems)
Subject: Trap Processing
If I want to mail me an email message with all the trap information when a
specific trap occurs what would be the best way to do this? When defining
rulesets I don't see any template that will allow you to forward the trap
info to an email address.
Thanks,
Dave
|