Chinaunix首页 | 论坛 | 博客
  • 博客访问: 224284
  • 博文数量: 119
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 1261
  • 用 户 组: 普通用户
  • 注册时间: 2012-05-23 17:50
文章分类

全部博文(119)

文章存档

2016年(8)

2015年(78)

2014年(33)

我的朋友

分类: 数据库开发技术

2015-03-05 23:52:13

### to check all the existing event rules
 [nz@vmtest ~]$ nzevent show |more
 Name                        On  Event Type               Event Args Expr          Notify Type Destination              CC                       Message                  Body Text                Call Home Aggregate Count
 --------------------------- --- ------------------------ ------------------------ ----------- ------------------------ ------------------------ ------------------------ ------------------------ --------- ---------------
          CPUcoresOK_em_NzCS yes Number of Online CPU Cor $curNumCore == 8 && $ini Email       NzEv-Notice S-Blade CPU_ \n Hostname  vmtest     no     0
           Disk80PercentFull yes Hardware Disk Full       $threshold == 80 || $thr Email       NPS system $HOST - $hwTy $notifyMsg\n\nSPA ID: $s    yes    50
           Disk90PercentFull yes Hardware Disk Full       $threshold == 90 || $thr Email       NPS system $HOST - $hwTy $notifyMsg\n\nSPA ID: $s    yes    50
                    EccError yes Memory ECC Error                                  Run Command $NZ_SBIN_DIR/notifyECC                            NPS system $HOST -$hwTyp $notifyMsg\n\nSPA ID:$sp    no     0
              HardwareFailed yes Hardware Failed                                   Email       NPS system $HOST - $hwTy $notifyMsg\n\nSPA ID: $s    yes    50
      HardwareNeedsAttention yes Hardware Needs Attention                          Email       NPS system $HOST - $hwTy $notifyMsg\n\nlocation:$    yes    0
           HardwareRestarted yes Hardware Restarted                                Email       NPS system $HOST - $hwTy $notifyMsg\n\nSPA ID: $s    yes    50
    HardwareServiceRequested yes Hardware Service Request                          Email       NPS system $HOST - Servi $notifyMsg\n\nlocation:$    yes    0
       HeatThresholdExceeded yes Hardware Heat Threshold                           Email       NPS system $HOST -$hwTyp $notifyMsg\n\nSPA ID:$sp    no     0
            HistCaptureEvent yes History Capture Event                             Email       NPS History Capture Even History data capture err    yes    0
               HistLoadEvent yes History Load Event                                Email       NPS History Load Event f History data load error:    yes    0
                  HwPathDown yes Hardware Path Down                                Email       NPS system $HOST - $hwTy $notifyMsg\n\nlocation:$    yes    1000
              MemFlt_rc_NzCS yes Memory ECC Error                                  Email       NzEv-info Please_Investi                             no     300
           NPSNoLongerOnline yes Sys State Changed        $previousState == online Email       NPS system $HOST went fr $notifyMsg\n\nEvent:\n$e    yes    1
     NzDAC_QDR_fault_em_NzCS yes FPGA QDR Memory Failure                           Email       NzEv-debug NzDAC QDR_Fau \n Hostname  vmtest     no     0
                  RegenFault yes Regen Fault                                       Email       NPS system $HOST - regen $notifyMsg\n\nhwIdSrc:$h    no     0
               Regen_em_NzCS yes Regen Source Disk Error                           Email       NzEv-Notice Please_Inves \n Hostname  vmtest     no     0
                RunAwayQuery no  Runaway Query                                     Email       NPS system $HOST - long- $notifyMsg\n\nsessionId:    yes    0
            RunAwayQuery_UAL yes Runaway Query                                     Run Command /export/home/nz/monitor/                                                                               no     0
               SCSIDiskError yes SCSI Disk Error                                   Email       NPS system $HOST - disk  $notifyMsg\nspuHwId:$spu    no     1000
       SCSIPredictiveFailure yes SCSI Predictive Failure                           Email       NPS system $HOST - SCSI  $notifyMsg\n\nspuHwId:$s    no     0
                     SpuCore yes SPU Process Cored                                 Email       NPS system $HOST - Proce $notifyMsg\n\nhwId:$hwId    no     0
 SystemHeatThresholdExceeded yes System Heat Threshold Ex                          Run Command $NZ_BIN_DIR/adm/nzpwrdow                          NPS system $HOST -$hwTyp $notifyMsg\n\nError Type    no     0
                SystemOnline yes Sys State Changed        $previousState != online Email       NPS system $HOST went on $notifyMsg\n\nEvent:\n$e    yes    50
          SystemStuckInState yes System Stuck In State                             Email       NPS system $HOST - Syste The system is stuck in s    yes    0
                ThermalFault yes Hardware Thermal Fault                            Email       NPS system $HOST -$hwTyp $notifyMsg\n\nlabel:$lab    no     0
           TopologyImbalance yes Topology Imbalance                                Email       NPS system $HOST - Topol $notifyMsg\n\nWarning:\n    no     0
       TransactionLimitEvent yes Transaction Limit Event                           Email       Transaction Limit Event  NPS system $HOST - curre    yes    0
                VoltageFault yes Hardware Voltage Fault                            Email       NPS system $HOST -$hwTyp $notifyMsg\n\nlabel:$lab    no     0
               dFPGA_em_NzCS yes Disk Error               $retries == 3            Email       NzEv-WARNING Please_Inve \n Hostname  vmtest     no     0
             dFPGA_em_NzCS_r yes Disk Error               $retries != 3            Email       NzEv-Info Please_Investi \n Hostname  vmtest     no     0
    hwFlt_FanOrPwr_em_NzCS_7 yes Hardware Failed          $hwType != spu           Email       NzEv-NOTICE Please_Inves \n Hostname  genswnzdb1p    no     0
    hwRst_FanOrPwr_em_NzCS_7 yes Hardware Restarted       $hwType != spu           Email       NzEv-NOTICE Please_Inves \n Hostname  genswnzdb1p    no     0
          hwSCSI_PFA_em_NzCS yes SCSI Predictive Failure                           Email       NzEv-WARNING SCSI_Disk P \n Hostname  vmtest     no     0
         hwSCSIfault_em_NzCS yes SCSI Disk Error                                   Email       WARNING: $HOST: SCSI_Dis \n Hostname  $HOST\n NzE    no     1000
   hwServiceReqBogus_em_NzCS yes Hardware Service Request $errString ~ "*unknown*" Email       NzEv-debug Please_Invest \n Please note that UNKN    no     0
  hwServiceReqSBlade_em_NzCS yes Hardware Service Request $hwType == spu && $errSt Email       NzEv-WARNING Please_Inve \n Hostname  vmtest     no     0
      hwTooDarnedHot_em_NzCS yes System Heat Threshold Ex                          Email       NzEv-CRITICAL SYSTEM Tem \n Hostname  vmtest     no     0
     hwVoltFltSBlade_em_NzCS yes Hardware Voltage Fault   $hwType == spu           Email       NzEv-WARNING $hwType Vol \n Hostname  vmtest     no     0
           hwVoltFlt_em_NzCS yes Hardware Voltage Fault   $hwType != spu           Email       NzEv-WARNING S-Blade Vol \n Hostname  vmtest     no     0
              hwWarm_em_NzCS yes Hardware Heat Threshold                           Email       NzEv-WARNING $hwType Tem \n Hostname  vmtest     no     0
        netIfcStatus_em_NzCS yes Network Interface State                           Email       NzEv-Notice $hwType Netw \n Hostname  vmtest     no     0
          regenFault_em_NzCS yes Regen Fault                                       Email       NzEv-WARNING S-Blade Reg \n Hostname  vmtest     no     0
       ssc_notOnLine_ag_NzCS yes Sys State Changed        $currentState == online  Email       NzEv-info System State C Hostname  vmtest \n     no     0
       ssc_notOnLine_em_NzCS yes Sys State Changed        $previousState == online Email       NzEv-NOTICE System_State Hostname  vmtest \n     no     0
    systemStateStuck_em_NzCS yes System Stuck In State    $duration >= 1800        Email       NzEv-NOTICE System_State \n Hostname  vmtest     no     0
 [nz@vmtest ~]$

### to show all the details about one event rule
 [nz@vmtest ~]$ nzevent show -name Disk80PercentFull -syntax
  -name 'Disk80PercentFull' -on yes -eventType hwDiskFull -eventArgsExpr '$threshold == 80 || $threshold == 85' -notifyType email -dst -ccDst -msg 'NPS system $HOST - $hwType $hwId partition id $partition is $value % full at $eventTimestamp.' -bodyText '$notifyMsg\n\nSPA ID: $spaId\nSPA Slot: $spaSlot\nLun Id: $lunId\nThreshold: $threshold\nValue: $value\n' -callHome yes -eventAggrCount 50
 [nz@vmtest ~]$


 #### list more instances here for reference :

[nz@vmtest ~]$ nzevent show -name VoltageFault -syntax
  -name 'VoltageFault' -on yes -eventType hwVoltageFault -eventArgsExpr '' -notifyType email -dst -ccDst -msg 'NPS system $HOST -$hwType $hwId Hardware Voltage Fault at $eventTimestamp' -bodyText '$notifyMsg\n\nlabel:$label\nlocation:$location\ndevSerial:$devSerial\nvoltage:$curVolt\nerror string:$errString\nevent source:$eventSource\n' -callHome no -eventAggrCount 0
 [nz@vmtest ~]$

[nz@vmtest ~]$ nzevent show -name HeatThresholdExceeded -syntax
  -name 'HeatThresholdExceeded' -on yes -eventType hwHeatThreshold -eventArgsExpr '' -notifyType email -dst -ccDst -msg 'NPS system $HOST -$hwType $hwId Hardware Heat Threshold Exceeded at $eventTimestamp' -bodyText '$notifyMsg\n\nSPA ID:$spaId\nSPA Slot:$spaSlot\nSerial Number:$devSerial\nError Type:$errType\nError Code:$errCode\nError String:$errString\n' -callHome no -eventAggrCount 0
 [nz@vmtest ~]$


 [nz@vmtest ~]$ nzevent show -name TransactionLimitEvent -syntax
  -name 'TransactionLimitEvent' -on yes -eventType transactionLimitEvent -eventArgsExpr '' -notifyType email -dst -ccDst -msg 'Transaction Limit Event from $HOST' -bodyText 'NPS system $HOST - current number ($CurNumTX) of transactions exceeded $TxLimitEventPercent % of total limit $MaxTransactions at $eventTimestamp.\n\nOldest Active Transaction:\n\ntxid: $OldestActiveTxId\nSession id: $SessionId\nPID: $PID\nDatabase: $Database\nUser: $User\nClient IP: $ClientIP\nClient PID: $ClientPID\nTransaction start date: $TransactionStartDateTime\n\nTo reduce the outstanding transaction count you may want to consider completing/aborting the above transaction.' -callHome yes -eventAggrCount 0
 [nz@vmtest ~]$

[nz@vmtest ~]$ nzevent show -name HistLoadEvent -syntax
  -name 'HistLoadEvent' -on yes -eventType histLoadEvent -eventArgsExpr '' -notifyType email -dst -ccDst -msg 'NPS History Load Event from $HOST' -bodyText 'History data load error:\nConfiguration Name =$configName\nStorage Limit =$storageLimit\nLoad Min Threshold =$loadMinThreshold\nLoad Max Threshold =$loadMaxThreshold\nDisk Full Threshold =$diskFullThreshold\nLoad Interval =$loadInterval\nTarget NPS =$nps\nTarget Database =$database\nLoaded Batch Size(MB) =$batchSize\nStaged Batches Size(MB) =$stagedSize\nBatch Directory =$dirName\nError Code =$errCode\nError Message = $errString\n' -callHome yes -eventAggrCount 0
 [nz@vmtest ~]$

 


 ### to add an event rule
 nzevent add -name Newrule -u admin -pw password -host nzhost -on
 yes -eventType sysStateChanged -eventArgsExpr ‘$previousState ==
 online && $currentState != online’ -notifyType email -dst
-msg ‘NPS system $HOST went from $previousState to
 $currentState at $eventTimestamp.’ -bodyText
‘$notifyMsg\n\nEvent:\n$eventDetail\nEvent
 Rule:\n$eventRuleDetail’

 
 
nzevent add -name Disk82PercentFull  -u admin -pw password -host netezza -on yes -eventType hwDiskFull -eventArgsExpr '$threshold == 80 || $threshold == 85'  -notifyType email -dst -ccDst   -msg 'NPS system $HOST - $hwType $hwId partition id $partition is $value % full at $eventTimestamp.'  -bodyText '$notifyMsg\n\nSPA ID: $spaId\nSPA Slot: $spaSlot\nLun Id: $lunId\nThreshold: $threshold\nValue: $value\n' -callHome yes -eventAggrCount 50
nzevent delete -name  'Disk82PercentFull'  -u admin -pw password

nzevent generate -u admin -pw password -host netezza -eventType 'Disk82PercentFull' -eventArgs '$threshold = 90'

### 切记 -eventType 不是 rule name
[nz@netezza eventmgr]$ nzevent generate -u admin -pw password -host netezza -eventType 'Disk82PercentFull' -eventArgs '$threshold = 90'
Error: event type 'Disk82PercentFull' is unknown or invalid.
Usage: nzevent [-h|-rev] [-hc] []
Try using 'nzevent -h' and 'nzevent -hc generate' for more information.
[nz@netezza eventmgr]$


 
nnzevent generate -u admin -pw password -host netezza  -eventType 'SystemPaused' -eventArgs '$previousState = online , $currentState = paused'
 

 nzevent add -u admin -pw password -name SystemPaused -on yes -eventType sysStateChanged -eventArgsExpr '$previousState == online && $currentState == paused' -notifyType email  -dst -ccDst -msg 'NPS system $HOST was paused at $eventTimestamp $eventSource.' -bodyText '$notifyMsgnnEvent:n$eventDetailn' -callHome no -eventAggrCount 50
 
 nzevent add -u admin -pw password -host netezza -name SystemPaused -on yes -eventType sysStateChanged -eventArgsExpr '$previousState == online && $currentState == paused' -notifyType email  -dst -ccDst -msg 'NPS system $HOST was paused at $eventTimestamp $eventSource.' -bodyText '$notifyMsgnnEvent:n$eventDetailn' -callHome no -eventAggrCount 50
 
 nzevent modify -name SystemPaused -eventArgsExpr '$previousState != paused && $currentState == paused'
 nzevent modify -name SystemPaused -eventArgsExpr '$previousState != paused && $currentState == paused'
 
 
  nzevent delete -name  'SystemPaused'  -u admin -pw password
 
### sometimes we need to copy a rule and mofdify  ( to check grammar : nzevent -hc copy  )

 

### we can use nzevent generate to trigger the event we defined
 nzevent generate command to trigger an event for the event manager.

 


 ### check rule template
 [nz@vmtest ~]$ nzevent show -template
 Name                        On Event Type               Event Args Expr          Notify Type Destination              CC Message                  Body Text                Call Home Aggregate Count
 --------------------------- -- ------------------------ ------------------------ ----------- ------------------------ -- ------------------------ ------------------------ --------- ---------------
           Disk80PercentFull no Hardware Disk Full       $threshold == 80 || $thr Email                  NPS system $HOST - $hwTy $notifyMsg\n\nSPA ID: $s    yes    50
           Disk90PercentFull no Hardware Disk Full       $threshold == 90 || $thr Email                  NPS system $HOST - $hwTy $notifyMsg\n\nSPA ID: $s    yes    50
                    EccError no Memory ECC Error                                  Run Command $NZ_SBIN_DIR/notifyECC      NPS system $HOST -$hwTyp $notifyMsg\n\nSPA ID:$sp    no     0
              HardwareFailed no Hardware Failed                                   Email                  NPS system $HOST - $hwTy $notifyMsg\n\nSPA ID: $s    yes    50
      HardwareNeedsAttention no Hardware Needs Attention                          Email                  NPS system $HOST - $hwTy $notifyMsg\n\nlocation:$    yes    0
           HardwareRestarted no Hardware Restarted                                Email                  NPS system $HOST - $hwTy $notifyMsg\n\nSPA ID: $s    yes    50
    HardwareServiceRequested no Hardware Service Request                          Email                  NPS system $HOST - Servi $notifyMsg\n\nlocation:$    yes    0
       HeatThresholdExceeded no Hardware Heat Threshold                           Email                  NPS system $HOST -$hwTyp $notifyMsg\n\nSPA ID:$sp    no     0
            HistCaptureEvent no History Capture Event                             Email                  NPS History Capture Even History data capture err    yes    0
               HistLoadEvent no History Load Event                                Email                  NPS History Load Event f History data load error:    yes    0
                  HwPathDown no Hardware Path Down                                Email                  NPS system $HOST - $hwTy $notifyMsg\n\nlocation:$    yes    1000
           NPSNoLongerOnline no Sys State Changed        $previousState == online Email                  NPS system $HOST went fr $notifyMsg\n\nEvent:\n$e    yes    1
                  RegenFault no Regen Fault                                       Email                  NPS system $HOST - regen $notifyMsg\n\nhwIdSrc:$h    no     0
     ReplCommitDeltaExceeded no Replication Commit Delta $currentReplDeltaCommit  Email                  Apply Commit Delta ($cur $notifyMsg\n\nEvent:\n$e    yes    50
          ReplConfigConflict no Replication Configuratio                          Email                  A Conflict in Replicatio $notifyMsg\n\nEvent:\n$e    yes    0
      ReplConflictingUpdates no Replication Conflicting                           Email                  A Fork has been detected $notifyMsg\n\nEvent:\n$e    yes    50
           ReplMaxApplyTries no Replication Maximum Appl $currentReplTryAttempts  Email                  Apply Agent has reached  $notifyMsg\n\nEvent:\n$e    yes    50
 ReplMissedMetadataHeartbeat no Replication Missed Metad                          Email                  Replication Metadata Hea $notifyMsg\n\nEvent:\n$e    yes    0
          ReplMultipleMaster no Replication Multiple Mas $numReplMasters > 1      Email                  Multiple Replication Mas $notifyMsg\n\nEvent:\n$e    yes    50
    ReplNodesTimeoffsetError no Replication Nodes System                          Email                  Time offset between this $notifyMsg\n\nEvent:\n$e    yes    0
                ReplPtsError no Replication Pts Error    $replPtsErrorCode != 0   Email                  PTS Error $replPtsErrorC $notifyMsg\n\nEvent:\n$e    yes    50
         ReplPtsUtilExceeded no Replication Pts Utilizat                          Email                  PTS Utilization ($curren $notifyMsg\n\nEvent:\n$e    yes    50
              ReplRoleMaster no Replication Role Change  $previousReplRole !=  Ma Email                  Replication Role changed $notifyMsg\n\nEvent:\n$e    yes    50
      ReplRoleNoLongerMaster no Replication Role Change  $previousReplRole ==  Ma Email                  Replication Role changed $notifyMsg\n\nEvent:\n$e    yes    50
 ReplRoleNoLongerSubordinate no Replication Role Change  $previousReplRole ==  Su Email                  Replication Role changed $notifyMsg\n\nEvent:\n$e    yes    50
         ReplRoleSubordinate no Replication Role Change  $previousReplRole !=  Su Email                  Replication Role changed $notifyMsg\n\nEvent:\n$e    yes    50
             ReplStateActive no Replication State Change $previousReplState !=  A Email                  Replication State change $notifyMsg\n\nEvent:\n$e    yes    0
          ReplStateSuspended no Replication State Change $previousReplState !=  S Email                  Replication State change $notifyMsg\n\nEvent:\n$e    yes    0
                RunAwayQuery no Runaway Query                                     Email                  NPS system $HOST - long- $notifyMsg\n\nsessionId:    yes    0
               SCSIDiskError no SCSI Disk Error                                   Email                  NPS system $HOST - disk  $notifyMsg\nspuHwId:$spu    no     1000
       SCSIPredictiveFailure no SCSI Predictive Failure                           Email                  NPS system $HOST - SCSI  $notifyMsg\n\nspuHwId:$s    no     0
                     SpuCore no SPU Process Cored                                 Email                  NPS system $HOST - Proce $notifyMsg\n\nhwId:$hwId    no     0
 SystemHeatThresholdExceeded no System Heat Threshold Ex                          Run Command $NZ_BIN_DIR/adm/nzpwrdow    NPS system $HOST -$hwTyp $notifyMsg\n\nError Type    no     0
                SystemOnline no Sys State Changed        $previousState != online Email                  NPS system $HOST went on $notifyMsg\n\nEvent:\n$e    yes    50
          SystemStuckInState no System Stuck In State                             Email                  NPS system $HOST - Syste The system is stuck in s    yes    0
                ThermalFault no Hardware Thermal Fault                            Email                  NPS system $HOST -$hwTyp $notifyMsg\n\nlabel:$lab    no     0
           TopologyImbalance no Topology Imbalance                                Email                  NPS system $HOST - Topol $notifyMsg\n\nWarning:\n    no     0
       TransactionLimitEvent no Transaction Limit Event                           Email                  Transaction Limit Event  NPS system $HOST - curre    yes    0
                VoltageFault no Hardware Voltage Fault                            Email                  NPS system $HOST -$hwTyp $notifyMsg\n\nlabel:$lab    no     0
      
 [nz@vmtest ~]$ nzevent show -name Disk80PercentFull                ### this is not a template , a real rule. to check a template , -template option must be given.
 Field Name      Value
 --------------- ------------------------
 Name            Disk80PercentFull
 On              yes
 Event Type      Hardware Disk Full
 Event Args Expr $threshold == 80 || $thr
 Notify Type     Email
 Destination    
 CC             
 Message         NPS system $HOST - $hwTy
 Body Text       $notifyMsg\n\nSPA ID: $s
 Call Home       yes
 Aggregate Count 50
 [nz@vmtest ~]$  nzevent show -template -name Disk80PercentFull
 Field Name      Value
 --------------- ------------------------
 Name            Disk80PercentFull
 On              no
 Event Type      Hardware Disk Full
 Event Args Expr $threshold == 80 || $thr
 Notify Type     Email
 Destination    
 CC             
 Message         NPS system $HOST - $hwTy
 Body Text       $notifyMsg\n\nSPA ID: $s
 Call Home       yes
 Aggregate Count 50
 [nz@vmtest ~]$  nzevent show -template -name Disk80PercentFull -syntax
  -name 'Disk80PercentFull' -on no -eventType hwDiskFull -eventArgsExpr '$threshold == 80 || $threshold == 85' -notifyType email -dst '' -ccDst '' -msg 'NPS system $HOST - $hwType $hwId partition id $partition is $value % full at $eventTimestamp.' -bodyText '$notifyMsg\n\nSPA ID: $spaId\nSPA Slot: $spaSlot\nLun Id: $lunId\nThreshold: $threshold\nValue: $value\n' -callHome yes -eventAggrCount 50
 [nz@vmtest ~]$

 


 [nz@vmtest ~]$ cd /nz/data/config
 [nz@vmtest config]$ ls
 backupHostname.txt  callHome.txt  sendMail.cfg  system.cfg
 [nz@vmtest config]$ cat callHome.txt
 # callHome.txt
 #
 # Call home attachment file containing installation-specific attributes.

customer.company    = test Technology vm (HK) Ltd
 customer.address1   = shanghai,
 customer.address2   = zhangnjiang,
 customer.address3   = yijiang road

contact1.name       = Benedict Silveries
 contact1.phone      = 21-65952332
 contact1.email      =
 contact1.cell       =

contact2.name       =
 contact2.phone      =
 contact2.email      =
 contact2.cell       =

system.description  = Prod PureData Server
 system location     = AST3_DC6_I017
 system.model        = N2002-005
 system.serial       = 3565DH6NZ30314
 system.modemNumber  =
 # 2014-01-28 04:01:06 -0500 (EST): Successful transition from to 7.0.4.P1
 # 2014-05-04 05:54:07 +0800 (SGT): Patrick(IBM) Successful transition from 7.0.4.P-1 to 7.0.4.4-P1
 # 2014-05-07 09:29:53 +0800 (SGT): Patrick(IBM) Successful transition from 7.0.4.4-P1 to 7.0.2.12-P1
 [nz@vmtest config]$ cat sendMail.cfg
 # sendMail.cfg
 #
 # Configuration parameters for sendMail program.

# Mail server name and port

mailServer.name = netezza
mailServer.port = 25

# Note: Uncomment and set the entries below to enable authentication based on username, password and authentication method.
 # Login information

#login.username  =
 #login.password  =

# Login method of mail server
 # Enter value as
 # 1 for CRAM MD5
 # 2 for AUTH LOGIN
 # 3 for LOGIN PLAIN
 # Note: User authentication will not be done, if none of the above value is provided

#login.method   =

# Sender information

sender.name     = "Citi Hongkong NPS Event Manager"
 sender.address  =

# Other
 # Note: Valid separators between multiple mail addresses are ',' or ';'

#cc             =
 [nz@vmtest config]$


 
 
 
 =====================================================================================================
 ===================上面仅仅是自己学习的一个过程,下面附上一个实际操作案例============================
 
 
### 实际案例
1. 添加一个rule
nzevent add -name Disk80PercentFull  -u admin -pw password -host netezza -on yes -eventType hwDiskFull -eventArgsExpr '$threshold == 80 || $threshold == 85'  -notifyType email -dst -ccDst   -msg 'NPS system $HOST - $hwType $hwId partition id $partition is $value % full at $eventTimestamp.'  -bodyText '$notifyMsg\n\nSPA ID: $spaId\nSPA Slot: $spaSlot\nLun Id: $lunId\nThreshold: $threshold\nValue: $value\n' -callHome yes -eventAggrCount 50
nzevent delete -name  'Disk82PercentFull'  -u admin -pw password

2. 配置 sendMail.cfg

[nz@netezza eventmgr]$ cd /nz/data/config/
[nz@netezza config]$ vi sendMail.cfg

mailServer.name = netezza         ### 可以解析到的邮件服务器/netezza server ,配置这两个参数即可实现邮件发送
mailServer.port = 25

3. 利用nzevent generate 来生成一个 ‘User initiated event’ 来触发上面定义的rule,以达到验证作用
nzevent generate -u admin -pw password -host netezza -eventType hwDiskFull -eventArgs 'threshold = 80'


### 以下是查看相关的日志   事件管理器的日志 && 发送邮件的日志

先来看事件管理器的日志 ,记录所有触发的事件以及发送邮件状态 ,这里我先故意配置错误的 mailServer.name = netezza.test.com,
看以看到,虽然触发的事件,但是无法成功发送邮件 , 而后面修改成功的 mailServer.name 后即可成功发送。

[nz@netezza eventmgr]$ pwd
/nz/kit/log/eventmgr
[nz@netezza eventmgr]$ ls
eventmgr.2015-02-07.log  eventmgr.log
[nz@netezza eventmgr]$
2015-03-06 08:35:50.641820 EST Info: invoking mail notifier for aggregated events, cmd = '/nz/kit.7.1.0.0/sbin/sendMail -dst "" -ccDst "" -msg "NPS netezza : 3 occurrences of Hardware Disk Full from 06-Mar-15 08:33:50 EST over 2 minutes." -bodyTextFile "/nzscratch/tmp/mailxPzBXp" -callHome /nz/data.1.0/config/callHome.txt -removeFile'
2015-03-06 08:35:53.046669 EST Error: NZ-00502/00503: send mail notifier failed with status = '201' - for more information, see log: '/nz/kit.7.1.0.0/log/sendMail/sendMail.6038.2015-03-06.log'.
2015-03-06 08:41:25.375041 EST Info: received & processing event type = hwDiskFull, event args = 'threshold = 80' event source = 'User initiated event'
2015-03-06 08:41:25.934054 EST Info: received & processing event type = hwDiskFull, event args = 'threshold = 80' event source = 'User initiated event'
2015-03-06 08:41:26.364287 EST Info: received & processing event type = hwDiskFull, event args = 'threshold = 80' event source = 'User initiated event'
2015-03-06 08:41:26.812694 EST Info: received & processing event type = hwDiskFull, event args = 'threshold = 80' event source = 'User initiated event'
2015-03-06 08:41:27.314410 EST Info: received & processing event type = hwDiskFull, event args = 'threshold = 80' event source = 'User initiated event'
2015-03-06 08:41:50.835718 EST Info: invoking mail notifier for aggregated events, events = 5, rule name = Disk80PercentFull, reason = 2
2015-03-06 08:41:50.835742 EST Info: invoking mail notifier for aggregated events, cmd = '/nz/kit.7.1.0.0/sbin/sendMail -dst "" -ccDst "" -msg "NPS netezza : 5 occurrences of Hardware Disk Full from 06-Mar-15 08:39:50 EST over 2 minutes." -bodyTextFile "/nzscratch/tmp/mailhGYkLW" -callHome /nz/data.1.0/config/callHome.txt -removeFile'
[nz@netezza eventmgr]$

###发送邮件的任务是由 netezza 自带的 sendMail 命令完成的 ,而日志仅仅表示事件触发了 sendMail 命令去发送邮件,但并不能表示成功发送。
例如 ,日志 sendMail.6038.2015-03-06.log ,就是如上发送邮件失败的日志。
[nz@netezza config]$ which sendMail
/nz/kit/sbin/sendMail
[nz@netezza config]$


[nz@netezza sendMail]$ pwd
/nz/kit/log/sendMail
[nz@netezza sendMail]$ ll
total 20
-rw------- 1 nz nz 224 Mar  6 08:15 sendMail.5671.2015-03-06.log
-rw------- 1 nz nz 224 Mar  6 08:16 sendMail.5686.2015-03-06.log
-rw------- 1 nz nz 224 Mar  6 08:27 sendMail.5932.2015-03-06.log
-rw------- 1 nz nz 436 Mar  6 08:35 sendMail.6038.2015-03-06.log
-rw------- 1 nz nz 224 Mar  6 08:41 sendMail.6168.2015-03-06.log
[nz@netezza sendMail]$


####收到的邮件内容如下
NPS netezza : 5 occurrences of Hardware Disk Full from 06-Mar-15 08:39:50 EST over 2 minutes.
发件人:NPS Event Manager<> 收件人:我<> 抄送人:355692269<>

Message Header
Host               : netezza.
Event              : Hardware Disk Full.
Event Rule Detail  : $threshold == 80 || $threshold == 85.
Start              : 03-06-15 08:39:50 EST.
Reporting Interval : 2 minutes.
Activity Duration  : 00:00:02.
Number of events   : 5.

Message Details
1 threshold = 80, eventSource=User initiated, Hardware Disk Full on 03-06-15 08:41:25 EST.
2 threshold = 80, eventSource=User initiated, Hardware Disk Full on 03-06-15 08:41:25 EST.
3 threshold = 80, eventSource=User initiated, Hardware Disk Full on 03-06-15 08:41:26 EST.
4 threshold = 80, eventSource=User initiated, Hardware Disk Full on 03-06-15 08:41:26 EST.
5 threshold = 80, eventSource=User initiated, Hardware Disk Full on 03-06-15 08:41:27 EST.

 

 

 

阅读(5066) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~