Using Netezza’s event manager to generate SNMP traps

If you have Tivoli ITM or Openview — or anything similar —  you can configure the Netezza event manager to generate SNMP traps instead of email alerts that can then be routed to your logging agent.  To do it, you first need to create a script that will execute the snmptrap command with the appropriate values.  Please keep in mind, Netezza doesn’t currently have a MIB file that we can import.  Instead we’ll use their enterprise OID and a specific trap value for each event type.

Here is the script; save it the nz user’s home directory — that way it is present regardless of which host is the active node in the Netezza cluster.

#####################################################################
 #!/bin/sh
#############################################
 # NETEZZA_EVENT_TYPE
 #
 # This is the event type as recognized by the
 # Netezza Event Manager.  It will be one of the following:
 #
 # diskError
 # eccError
 # fpgaQdrFailure
 # fwMismatch
 # histCaptureEvent
 # histLoadEvent
 # hwDiskFull
 # hwFailed
 # hwHeatThreshold
 # hwNeedsAttention
 # hwRestarted
 # hwServiceRequested
 # hwThermalFault
 # hwVoltageFault
 # numCpuCoreChanged
 # nwIfChanged
 # regenError
 # regenFault
 # runawayQuery
 # scsiDiskError
 # scsiPredictiveFailure
 # smartThreshold
 # spuCore
 # sysHeatThreshold
 # sysStateChanged
 # systemStuckInState
 # transactionLimitEvent
 #
 #############################################
 NETEZZA_EVENT_TYPE=$1
#############################################
 # NETEZZA_EVENT_MESSAGE
 #
 # This is the eventType specific message
 # generated by the Netezza event.
 #
 #############################################
 NETEZZA_EVENT_MESSAGE=$3
#############################################
 # EXTERNAL_AGENT_IP
 #
 # This is the server that will receive
 # the SNMP trap
 #
 #############################################
 EXTERNAL_AGENT_IP=192.168.1.100
#############################################
 # MY_HOSTNAME
 #
 # The hostname of the client generate the
 # SNMP Trap
 #
 #############################################
 MY_HOSTNAME=`hostname`
#############################################
 # Netezza Enterprise OID information
 #
 # Netezza does not currently have an
 # enterprise oid; this is one that it is not
 # currently in use
 #
 #############################################
 OID=".1.3.6.1.4.1.30976.10.1"
case ${NETEZZA_EVENT_TYPE} in
 "diskError"                  ) TRAP=1;;
 "eccError"                   ) TRAP=2;;
 "fpgaQdrFailure"             ) TRAP=3;;
 "fwMismatch"                 ) TRAP=4;;
 "histCaptureEvent"           ) TRAP=5;;
 "histLoadEvent"              ) TRAP=6;;
 "hwDiskFull"                 ) TRAP=7;;
 "hwFailed"                   ) TRAP=8;;
 "hwHeatThreshold"            ) TRAP=9;;
 "hwNeedsAttention"           ) TRAP=10;;
 "hwRestarted"                ) TRAP=11;;
 "hwServiceRequested"         ) TRAP=12;;
 "hwThermalFault"             ) TRAP=13;;
 "hwVoltageFault"             ) TRAP=14;;
 "numCpuCoreChanged"          ) TRAP=15;;
 "nwIfChanged"                ) TRAP=16;;
 "regenError"                 ) TRAP=17;;
 "regenFault"                 ) TRAP=18;;
 "runawayQuery"               ) TRAP=19;;
 "scsiDiskError"              ) TRAP=20;;
 "scsiPredictiveFailure"      ) TRAP=21;;
 "smartThreshold"             ) TRAP=22;;
 "spuCore"                    ) TRAP=23;;
 "sysHeatThreshold"           ) TRAP=24;;
 "sysStateChanged"            ) TRAP=25;;
 "systemStuckInState"         ) TRAP=26;;
 "transactionLimitEvent"      ) TRAP=27;;
 *                           ) TRAP=28;;
 esac
snmptrap -v 1 -c public ${EXTERNAL_AGENT_IP} ${OID} ${MY_HOSTNAME} 6 ${TRAP} '' ${OID}.100.0 s "${NETEZZA_EVENT_MESSAGE}"
 #####################################################################

Once you have the script in place, create an event that runs this script instead of generating an email.  For example:

nzevent add  \
-name 'SNMP_diskFull_95_em_NzCS' -on yes -eventType hwDiskFull -eventArgsExpr '$threshold == 95' \
-notifyType runCmd -dst '/export/home/nz/scripts/generate_snmp_trap.sh $eventType'  \
-msg 'WARNING Disk Full $value% on partition $partition at $eventTimestamp' -bodyText '' \
-callHome no -eventAggrCount 0

Note that the notifyType value became runCmd (instead of email) and the -dst became an executable (instead of an email address).  This instructs the event manager to run this command instead — which has our call to snmptrap with all of the appropriate values.

Advertisements
This entry was posted in administration, General, Uncategorized and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s