That fixed it. I changed the ACCOUNTNAME=$1 to ACCOUNTNAME="$NVATTR_1" and did
the same for the rest of the variables. Many thanks James
I am still receiving the backslashes (\) before - and . Is my netview.pre set
correctly? I did make sure to restart netview with netnmrc.
-----Original Message-----
From: owner-nv-l@lists.us.ibm.com [mailto:owner-nv-l@lists.us.ibm.com] On
Behalf Of James Shanks
Sent: Wednesday, December 28, 2005 2:46 PM
To: nv-l@lists.us.ibm.com
Subject: Re: [nv-l] Ruleset that sends new trap with custom info.
Change your script, and don't pass it anything. That's your biggest issue with
this You don't have to pass NVATTR variables. Those are environment variables
which are set when the script runs.
In other words this should suffice to set the variables, assuming that the trap
which drives this actually has 8 varbinds which are sent along.
ACCOUNTNAME="$NVATTR_1"
SERVICENAME="$NVATTR_2"
ELEMENTNAME="$NVATTR_3"
APPNAME="$NVATTR_4"
APPINSTNAME="$NVATTR_5"
PARAMNAME="$NVATTR_6"
PARAMVALUE="$NVATTR_7"
PARAMSTATE="$NVATTR_8"
You can trace what is being passed to actionsvr in the nvcorrd.alog/blog by
issuing "nvcdebug -d all" before you test. You can turn tracing off again with
"nvcdebug -r". That will show you what is actually being passed to actionsvr.
It should be the name of your script followed by all the varbinds. You don't
have to pass them; nvcorrd does that for you.
If that's not enough to get you out of the woods, you can put "set -x" as the
first executable line of your script and it will trace it's execution to the
nvaction.alog/blog.
The illegal varbind message just means there are non-alphanumeric characters in
one or more varbinds. It won't stop your script from
running. It does mean that the output may not be what you expect. There
may be underscores in place of other characters which are not in the
AdditionalLegalTrapCharacters list.
HTH
James Shanks
Level 3 Support for Tivoli NetView for UNIX and Windows Tivoli Software / IBM
Software Group
"Clinkscales,
Charles"
<cclinkscales@fir To
stam.com> nv-l@lists.us.ibm.com
Sent by: cc
owner-nv-l@lists.
us.ibm.com Subject
[nv-l] Ruleset that sends new trap
with custom info.
12/28/2005 02:48
PM
Please respond to
nv-l
Hello All - I am running Netview version 7.1.4 fixpack 2 on Unix AIX 5.1.
I am trying to configure a ruleset and script to add custom text information to
the trap by sending a new trap. The trap is from BMC's Patrol Express
1.3.6.1.4.1.1031 generic 6 specific 1. All traps from Patrol Express use
specific 1. The trap has 8 variables $1 thru $8.
Variable $3 has the hostname, variable $4 has the Application Name, and
variable $8 has the severity level (0=Cleared 3=Alarm). Based on Variable
$3 or $4 I would like to generate a new trap that has contact information with
it.
For example, if a trap comes in with a particular hostname, I would like to
have a new trap displayed which has contact information added to it. Such as,
Contact SQL DBA.
I read through a lot of the postings about this, but still cannot get this to
work correctly.
I have done the following.
Created new trap definition for new trap under BMC's Patrol Express enterprise
1.3.6.1.4.1.1031 generic 6 specific 99.
Created a ruleset that looks for event attribute 4 = SQL Server Buffer
Counters, then it runs an action, /usr/OV/bin/PECustomNotifySQL.ksh
I have tried /usr/OV/bin/PECustomNotifySQL.ksh "NVATTR_3"
"NVATTR_4" "NVATTR_8"
I have tried /usr/OV/bin/PECustomNotifySQL.ksh NVATTR_3 NVATTR_4
NVATTR_8
I have tried /usr/OV/bin/PECustomNotifySQL.ksh "NVATTR_3 NVATTR_4
NVATTR_8"
The traps just show up as CONTACT MSSQL DATABASE ON-CALL PERSON NVATTR_3
NVATTR_4 NVATTR_8 with no values.
Here is the script...
#!/bin/ksh
# Used to test Patrol Express custom alerts.
NVHOST=FADA1SNM14
ABOUTHOST=REISDAL01SOPM08
MYTRAPID=99
ENTERPRISE='.1.3.6.1.4.1.1031'
ACCOUNTNAME="$1"
SERVICENAME="$2"
ELEMENTNAME="$3"
APPNAME="$4"
APPINSTNAME="$5"
PARAMNAME="$6"
PARAMVALUE="$7"
PARAMSTATE="$8"
/usr/OV/bin/snmptrap $NVHOST $ENTERPRISE $ABOUTHOST 6 $MYTRAPID 1 \
.1.3.6.1.4.1.1031.5.1.1.0 OctetString "$ACCOUNTNAME" \
.1.3.6.1.4.1.1031.5.1.2.0 OctetString "$SERVICENAME" \
.1.3.6.1.4.1.1031.5.1.3.0 OctetString "$ELEMENTNAME" \
.1.3.6.1.4.1.1031.5.1.4.0 OctetString "$APPNAME" \
.1.3.6.1.4.1.1031.5.1.5.0 OctetString "$APPINSTNAME" \
.1.3.6.1.4.1.1031.5.1.6.0 OctetString "$PARAMNAME" \
.1.3.6.1.4.1.1031.5.1.7.0 OctetString "$PARAMVALUE" \
.1.3.6.1.4.1.1031.5.1.8.0 Integer "$PARAMSTATE" \
.1.3.6.1.4.1.1031.5.1.9.0 OctetString "CONTACT MSSQL DATABASE ON-CALL
PERSON"
I am also receiving errors regarding "Varbind contained an illegal character"
in my nvaction.alog. Are these errors preventing this from working? This is
probably due to the security patches that try to filter special characters, so
I created a /usr/OV/bin/netnmrc.pre file and added the following to it to
accept these special characters...
AdditionalLegalTrapCharacters="_/-.~"
export AdditionalLegalTrapCharacters However, I am still receiving
these errors in nvaction.alog. I did stop (ovstop nvsecd) and restart netview
(netnmrc).
There is mention in some postings of using the sed command to strip out the
backslashes, but this has not worked for me either. I tried adding this to my
script...
NODE=`echo "$2" | sed "s:\\\\\\::g"`
Thanks in advance for any help you can provide,
Picture (Metafile) Charlie Clinkscales
Sr. Network Management Specialist
First American Real Estate Information Services
8435 North Stemmons Freeway
Dallas, Texas 75247-3907 Email: cclinkscales@firstam.com
Phone: (214) 678-7250
Fax: (214) 589-9413
www.firstam.com
|