HI Philippe
Thanks a million the quotes work
beautifully.
Thanks
Vynita
Pretorius
+27 82
856 0321
From: Philippe Menard
[mailto:PME@fr.ibm.com]
Sent: Tuesday, May 10, 2005 12:07
PM
To: Pretorius,
Vynita
Subject: Fw: [nv-l] Automatic
actions - how to reference the source address / hostname with example
Vynita,
as
you have realized you must quote each parameter otherwise the shell will split
for each space or tab character.
$A
is a device name or an IP address and could do without quotes, however I just
quote every parameter like :
EXEC
/home/u/automation/brprt "$1" "$2" "$3"
"$A" "$S" "$G"
Of
course this quoting is wrong in case some parameters do contain double quotes.
You
should not have this problem because ovactiond replaces many punctation
characters by _ .
If
that is a problem for you (e.g. interface name Serial1/2:3 becomes Serial1_2_3)
can configure ovactiond :
-
decide which characters you really want (ovactiond will add a \ before each as
\: \; etc)
-
add 2 lines to your /usr/OV/bin/netnmrc.pre file (adjust the contents of the
1st line of course)
AdditionalLegalTrapCharacters="/:;="
export
AdditionalLegalTrapCharacters
You
must restart the whole of NetView after modifying this file (ovstop, ovstop
nvsecd, /etc/netnmrc & )
A
final consequence is that your scripts must explicitely handle the \ characters
inserted by ovactiond.
Usually
"substitute every \ character by nothing". Write this is your
favorite scripting language. I use perl all the time.
Hope
this helps.
Philippe.
- - -
Philippe MÉNARD
Networking Delivery Support
Center
Mail : pme@fr.ibm.com
----- Forwarded by Philippe
Menard/France/Contr/IBM on 10/05/2005 11:43 -----
"Pretorius,
Vynita" <VPretorius@fnb.co.za>
Sent
by: owner-nv-l@lists.us.ibm.com
10/05/2005 11:31
|
To
|
<nv-l@lists.us.ibm.com>
|
cc
|
|
Subject
|
FW: [nv-l] Automatic actions - how to
reference the source address / hostname with example
|
|
James,
Thanks for your comments however I cannot get it
to pass me the source
ip /hostname with the $A or %G, $S
(below comes out of trapd.conf)
EDESC
critb {1.3.6.1.4.1.688.5.1} 6 1 u 4 4 "Status
Events"
Trap: generic $G specific $S args ($#): $*
EXEC /home/u/automation/brprt $1 $2 $3 $A $S $G
SDESC
Below is the /home/u/automation/brprt
# cd /home/u/automation
# cat brprt
st1=$1
st2=$2
st3=$3
ipadd=$4
spec=$5
gen=$6
echo $st1 " var1 " >
/home/u/automation/brout.out1
echo $st2 " var2 " >>
/home/u/automation/brout.out1
echo $st3 "var3 " >>
/home/u/automation/brout.out1
echo $ipadd " ip address" >>
/home/u/automation/brout.out1
echo $spec " specific " >>
/home/u/automation/brout.out1
echo $gen " generic" >>
/home/u/automation/brout.out1
# more /home/u/automation/brout.out1
Brprt var1
test var2
only var3
FMT ip address
ERROR: specific
accessing generic
#
(below is in trapd.log)
1115716933 3 Tue May 10 11:22:13 2005 VYNITA
u Trap: generic 6
specific 1 args (1): [1]
private.enterprises.688.5.1 (OctetString):
Brprt test only
Thanks
Vynita Pretorius
+27 82 856 0321
-----Original Message-----
From: owner-nv-l@lists.us.ibm.com
[mailto:owner-nv-l@lists.us.ibm.com]
On Behalf Of James Shanks
Sent: Monday, May 09, 2005 7:40 PM
To: nv-l@lists.us.ibm.com
Subject: Re: [nv-l] Automatic actions - how to
reference the source
address / hostname
We are talking about passed parameters here, and
it is difficult to
answer
a question like this without a specific example.
But for example, if you had a script called
"mytest" and you wanted to
pass
it varbind 1, varbind 2, the enterprise oid,
and the agent address, in
that order, you would do so like this:
<full_path>mytest $1 $2
$e $A
but inside your script these parameters would be
referenced in order as
$1, $2, $3, and $4. They are not exported as
ruleset variables are.
Whether you use the agent address ($A) or the
NetView attribute $2,
which
always contains the hostname, depends upon whether
you are dealing with
a
NetView trapd on a non-NetView trap. Only
NetView traps have the
hostname
in the second varbind.
James Shanks
Level 3 Support for Tivoli NetView for UNIX and Windows
Tivoli Software / IBM Software Group
"Pretorius,
Vynita"
<VPretorius@fnb.c
To
o.za>
<nv-l@lists.us.ibm.com>
Sent by:
cc
owner-nv-l@lists.
us.ibm.com
Subject
[nv-l] Automatic actions - how to
reference the source address /
05/09/2005 11:32 hostname
AM
Please
respond to
nv-l
Hi all
Running 7.1.4 fp3 on solaris 2.8
I can only get Automatic actions to pass me what
is in the string via $1
$2
$3, if I reference $e I get nothing?
I need the ip address or hostname of the source of
the event how do I
reference it?
Any ideas
Thanks
Vynita Pretorius
+27 82 856 0321
___________________________________________
The views expressed in this email are, unless
otherwise stated, those of
the author and not those
of the FirstRand Banking Group an Authorised
Financial Service Provider
or
its management.
The information in this e-mail is confidential and
is intended solely
for
the addressee.
Access to this e-mail by anyone else is
unauthorised.
If you are not the intended recipient, any
disclosure, copying,
distribution or any action taken or
omitted in reliance on this, is prohibited and may
be unlawful.
Whilst all reasonable steps are taken to ensure
the accuracy and
integrity
of information and data
transmitted electronically and to preserve the
confidentiality thereof,
no
liability or
responsibility whatsoever is accepted if
information or data is, for
whatever reason, corrupted
or does not reach its intended destination.
__________________________________
___________________________________________________________________________________________________
The views expressed in this email are, unless
otherwise stated, those of the author and not those
of the FirstRand Banking Group an Authorised
Financial Service Provider or its management.
The information in this e-mail is confidential and
is intended solely for the addressee.
Access to this e-mail by anyone else is
unauthorised.
If you are not the intended recipient, any
disclosure, copying, distribution or any action taken or
omitted in reliance on this, is prohibited and may
be unlawful.
Whilst all reasonable steps are taken to ensure
the accuracy and integrity of information and data
transmitted electronically and to preserve the
confidentiality thereof, no liability or
responsibility whatsoever is accepted if
information or data is, for whatever reason, corrupted
or does not reach its intended destination.
________________________________
___________________________________________
The views expressed in this email are, unless otherwise stated,
those of the author and not those of the FirstRand Banking Group an
Authorised Financial Service Provider or its management. The information in
this e-mail is confidential and is intended solely for the addressee. Access
to this e-mail by anyone else is unauthorised. If you are not the intended
recipient, any disclosure, copying, distribution or any action taken or
omitted in reliance on this, is prohibited and may be unlawful. Whilst
all reasonable steps are taken to ensure the accuracy and integrity of
information and data transmitted electronically and to preserve the
confidentiality thereof, no liability or responsibility whatsoever is
accepted if information or data is, for whatever reason, corrupted or does
not reach its intended destination.
__________________________________
|