nv-l

Re: FW: [nv-l] Automatic actions - how to reference the source address / hostname with example

2005-05-10 09:05:09
Subject: Re: FW: [nv-l] Automatic actions - how to reference the source address / hostname with example
From: James Shanks <jshanks AT us.ibm DOT com>
To: nv-l AT lists.us.ibm DOT com
Date: Tue, 10 May 2005 09:04:38 -0400



The problem is that you are getting a format error message because you are
trying to access variables $2 and $3 and this trap does not have any.  It
only has varbind 1.  So that is messing up your script.  If you varbinds
are strings with spaces in them, then you have to enclose them in quotes
when you pass them, like this
      /home/u/automation/brprt "$1" $A $S $G


James Shanks
Level 3 Support  for Tivoli NetView for UNIX and Windows
Tivoli Software / IBM Software Group


                                                                           
             "Pretorius,                                                   
             Vynita"                                                       
             <[email protected]                                          To 
             o.za>                     <nv-l AT lists.us.ibm DOT com>           
  
             Sent by:                                                   cc 
             owner-nv-l@lists.                                             
             us.ibm.com                                            Subject 
                                       FW: [nv-l] Automatic actions - how  
                                       to reference  the source address /  
             05/10/2005 05:31          hostname with example               
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
                   nv-l                                                    
                                                                           
                                                                           




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 AT lists.us.ibm DOT com [mailto:owner-nv-l AT lists.us.ibm DOT 
com]
On Behalf Of James Shanks
Sent: Monday, May 09, 2005 7:40 PM
To: nv-l AT lists.us.ibm DOT 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"

             <[email protected]
To
             o.za>                     <nv-l AT lists.us.ibm DOT 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.

                               ________________________________




<Prev in Thread] Current Thread [Next in Thread>