FusionCode - EVNT: All about Events

Contents

Event Location (TOP)

fusioncode.FCODE-> alias mon
mon='. /home/oracle/admin/scripts/mon/MON.env; cd $SYS_TOP/bin; mon.sh'
fusioncode.FCODE-> mon
Content-type: text/plain

-----------------------------------------
 Date:      Tue Oct 28 14:41:10 PST 2003
 Hostname:  fusioncode
-----------------------------------------

Current number of active processes:  13

oracle    4880     1  0 Oct27 pts/0    00:00:10 /bin/ksh ./bgman.sh COLL colllis
oracle    4881     1  0 Oct27 pts/0    00:05:46 /bin/ksh ./bgman.sh EVNT evntlis
oracle    4882     1  0 Oct27 pts/0    00:00:04 /bin/ksh ./mailbg.sh
oracle   19531  4881  0 14:40 pts/0    00:00:00 /bin/ksh ./bgproc.sh 435 EVNT
oracle   19543 19531  0 14:40 pts/0    00:00:00 /bin/ksh ./evntproc.sh 435
oracle   19571  4881  0 14:40 pts/0    00:00:00 /bin/ksh ./bgproc.sh 250 EVNT
oracle   19587 19571  0 14:40 pts/0    00:00:00 /bin/ksh ./evntproc.sh 250
oracle   19589 19543  0 14:40 pts/0    00:00:00 /bin/ksh ./bgproc.sh 258 COLL
oracle   19608 19589  0 14:40 pts/0    00:00:00 /bin/ksh ./collproc.sh 258
oracle   19678 19587  0 14:40 pts/0    00:00:00 /bin/ksh ./bgproc.sh 159 COLL
oracle   19685 19678  0 14:40 pts/0    00:00:00 /bin/ksh ./collproc.sh 159
oracle   20101  4881  0 14:40 pts/0    00:00:00 /bin/ksh ./bgproc.sh 434 EVNT
oracle   20108 20101  0 14:40 pts/0    00:00:00 /bin/ksh ./evntproc.sh 434
Enter EVNT TNS Alias: fusioncode.FCODE->(ctl-C from here)
fusioncode.FCODE-> env | grep MON
SEEDMON=/home/oracle/admin/scripts/mon/evnt/seed/bin
MON_TOP=/home/oracle/admin/scripts/mon
APPSMON=/home/oracle/admin/scripts/mon/evnt/apps/bin
ORACLE_SID=FCODE
CUSTMON=/home/oracle/admin/scripts/mon/evnt/cust/bin
SIEBMON=/home/oracle/admin/scripts/mon/evnt/sieb/bin

above ... there are 3 types of event tops (top directories)
   - SEEDMON [seeded DB/OS level events installed/updated by FusionCode software]
   - APPSMON [seeded APPS events installed/updated by FusionCode software]
   - SIEBMON [seeded SIEBEL events installed/updated by FusionCode software]
   - CUSTMON [custom events created by end-user these events are not touched by FusionCode software upgrades]

Repository/event mapping

fusioncode.FCODE-> cd $SEEDMON
fusioncode.FCODE-> pwd
/home/oracle/admin/scripts/mon/evnt/seed/bin
fusioncode.FCODE-> ls -l
total 168
-rwxr-xr-x    1 oracle   oinstall     2849 Mar 10  2003 bgsegex.sh
-rwxr-xr-x    1 oracle   oinstall     1354 Mar 26  2003 dbalogc.sh
-rwxr-xr-x    1 oracle   oinstall     3362 Mar 10  2003 dbevnth.sh
-rwxr-xr-x    1 oracle   oinstall     1893 Feb 25  2003 dbinvob.sh
-rwxr-xr-x    1 oracle   oinstall     2758 Oct  2 17:51 dblanal.sh
-rwxr-xr-x    1 oracle   oinstall     4419 Feb 25  2003 dblogsw.sh
-rwxr-xr-x    1 oracle   oinstall     2609 Sep 29 16:55 dbmproc.sh
-rwxr-xr-x    1 oracle   oinstall     3660 Feb 25  2003 dbsorts.sh
-rwxr-xr-x    1 oracle   oinstall     2764 Mar 13  2003 dbupchk.sh
-rwxr-xr-x    1 oracle   oinstall     4086 Apr  1  2003 drilapps11i.sh
-rwxr-xr-x    1 oracle   oinstall     1711 Oct 21 17:16 drilsql.sh
-rwxr-xr-x    1 oracle   oinstall     3285 Oct  2 17:59 drilwait.sh
-rwxr-xr-x    1 oracle   oinstall     4503 Mar 10  2003 filests.sh
-rwxr-xr-x    1 oracle   oinstall     3926 Feb 25  2003 nobinds.sh
-rwxr-xr-x    1 oracle   oinstall     1665 Feb 25  2003 osfsusg.sh
-rwxr-xr-x    1 oracle   oinstall     2408 Feb 25  2003 ospschk.sh
-rwxr-xr-x    1 oracle   oinstall     3297 Apr 22  2003 ossrptw.sh
-rwxr-xr-x    1 oracle   oinstall     4691 Apr  1  2003 prserat.sh
-rwxr-xr-x    1 oracle   oinstall     4248 May  5 18:01 rbspctu.sh
-rwxr-xr-x    1 oracle   oinstall     4752 Feb 25  2003 runprc2.sh
-rwxr-xr-x    1 oracle   oinstall     5946 Oct 22 18:44 runprc.sh
lrwxrwxrwx    1 oracle   oinstall       26 Mar 31  2003 setenv.sh -> ../../../sys/bin/setenv.sh
-rwxr-xr-x    1 oracle   oinstall     3579 Feb 26  2003 sgsmext.sh
-rwxr-xr-x    1 oracle   oinstall     3219 May 29 10:39 sgsnext.sh
-rwxr-xr-x    1 oracle   oinstall     4737 Feb 26  2003 sgstop50.sh
-rwxr-xr-x    1 oracle   oinstall     5273 Feb 25  2003 stshrat8i.sh
-rwxr-xr-x    1 oracle   oinstall     3184 Feb 25  2003 stsuses.sh
-rwxr-xr-x    1 oracle   oinstall     2634 Feb 25  2003 stswtm.sh
-rwxr-xr-x    1 oracle   oinstall     3750 Mar 28  2003 tabsppct.sh
-rwxr-xr-x    1 oracle   oinstall     5996 May  2 14:24 tbsfrag.sh
-rwxr-xr-x    1 oracle   oinstall     4348 Feb 25  2003 tbwaste.sh
-rwxr-xr-x    1 oracle   oinstall      654 Apr 15  2003 test.sh
-rw-r--r--    1 oracle   oinstall     2550 Mar 31  2003 TO_DO
fusioncode.FCODE->
fusioncode.FCODE-> grep "EVNT_REG" *
bgsegex.sh:# EVNT_REG:  DB_SEGEX SEEDMON 1.3 Y
dbalogc.sh:# EVNT_REG:  CHK_ALERT_LOG *SEEDMON 1.1
dbevnth.sh:# EVNT_REG:  DB_EVNT SEEDMON 1.1 Y
dbinvob.sh:# EVNT_REG:  INVALID_OBJ SEEDMON 1.1
dblanal.sh:# EVNT_REG:     DB_LANALZ SEEDMON 1.1
dblogsw.sh:# EVNT_REG:  DB_LOG_SWITCH SEEDMON 1.1
dbmproc.sh:# EVNT_REG:     DB_MAX_PROCS SEEDMON 1.1
dbsorts.sh:# EVNT_REG:  SORT_SIZE SEEDMON 1.2
dbupchk.sh:# EVNT_REG:  DB_UP_CHK SEEDMON 1.1
filests.sh:# EVNT_REG:  DB_FILE_IO SEEDMON 1.1 Y
nobinds.sh:# EVNT_REG:     NO_BINDS SEEDMON 1.1
osfsusg.sh:# EVNT_REG:  OS_FS_USAGE *SEEDMON 1.1
ospschk.sh:# EVNT_REG:  OS_PS_CHECK *SEEDMON 1.1
ossrptw.sh:# EVNT_REG:     OS_SCRIPT *SEEDMON 1.1
prserat.sh:# EVNT_REG:     PARSE_RATIO SEEDMON 1.1
rbspctu.sh:# EVNT_REG:  RBS_SIZE SEEDMON 1.2
runprc2.sh:# EVNT_REG:  RUNAWAY_PROC2 SEEDMON 1.1
runprc.sh:# EVNT_REG:   RUNAWAY_PROC SEEDMON 1.2
sgsmext.sh:# EVNT_REG:  MAXEXT_LIMIT SEEDMON 1.1
sgsnext.sh:# EVNT_REG:  NEXTEXT_SIZE SEEDMON 1.2
sgstop50.sh:# EVNT_REG: HIGH_EXTENTS SEEDMON 1.1
stshrat8i.sh:# EVNT_REG:        DB_CACHE_8I SEEDMON 1.1
stsuses.sh:# EVNT_REG:  UNAUTH_SES SEEDMON 1.1
stswtm.sh:# EVNT_REG:   WAIT_TIME SEEDMON 1.1
tabsppct.sh:# EVNT_REG: TABSP_USAGE SEEDMON 1.2
tbsfrag.sh:# EVNT_REG:     TABSP_FRAG SEEDMON 1.1
tbwaste.sh:# EVNT_REG:  TAB_WASTAGE SEEDMON 1.1
test.sh:# EVNT_REG:     TEST SEEDMON 1.1

all events have registration tag (EVNT_REG) that is used to import event 
information into EVNT repository.

Example:
   sgstop50.sh:# EVNT_REG: HIGH_EXTENTS SEEDMON 1.1        Y|null=N
                 |-tag---| |-code-----| |-top-| |-version| |-coll-flag|
   
   Mapping to EVENTS table:
      |-code-----| -> EVENTS.E_CODE
      |-top-|      -> EVENTS.E_CODE_BASE
      |-version|   ->    [not used in the database]
      |-coll-flag| -> EVENTS.E_COLL_FLAG

fusioncode.FCODE-> sqlplus evnt@fcode

SQL*Plus: Release 8.1.7.0.0 - Production on Tue Oct 28 17:17:06 2003

(c) Copyright 2000 Oracle Corporation.  All rights reserved.

Enter password:

Connected to:
Personal Oracle8i Release 8.1.7.4.1 - Production
With the Partitioning option
JServer Release 8.1.7.4.1 - Production

SQL> set lines 132
SQL> set trims on
SQL> col e_file_name format a14
SQL> col e_code format a20
SQL> col e_code_base format a10

SQL> l
  1  select e_file_name, e_code, e_code_base, e_coll_flag
  2  from events
  3  where e_code_base='SEEDMON'
  4* order by e_file_name
SQL> /

E_FILE_NAME    E_CODE               E_CODE_BAS E
-------------- -------------------- ---------- -
bgsegex.sh     DB_SEGEX             SEEDMON    Y
dbevnth.sh     DB_EVNT              SEEDMON    Y
dbinvob.sh     INVALID_OBJ          SEEDMON    N
dblanal.sh     DB_LANALZ            SEEDMON    N
dblogsw.sh     DB_LOG_SWITCH        SEEDMON    N
dbmproc.sh     DB_MAX_PROCS         SEEDMON    N
dbsorts.sh     SORT_SIZE            SEEDMON    N
dbupchk.sh     DB_UP_CHK            SEEDMON    N
filests.sh     DB_FILE_IO           SEEDMON    Y
nobinds.sh     NO_BINDS             SEEDMON    N
prserat.sh     PARSE_RATIO          SEEDMON    N

E_FILE_NAME    E_CODE               E_CODE_BAS E
-------------- -------------------- ---------- -
rbspctu.sh     RBS_SIZE             SEEDMON    N
runprc.sh      RUNAWAY_PROC         SEEDMON    N
runprc2.sh     RUNAWAY_PROC2        SEEDMON    N
sgsmext.sh     MAXEXT_LIMIT         SEEDMON    N
sgsnext.sh     NEXTEXT_SIZE         SEEDMON    N
sgstop50.sh    HIGH_EXTENTS         SEEDMON    N
stshrat8i.sh   DB_CACHE_8I          SEEDMON    N
stsuses.sh     UNAUTH_SES           SEEDMON    N
stswtm.sh      WAIT_TIME            SEEDMON    N
tabsppct.sh    TABSP_USAGE          SEEDMON    N
tbsfrag.sh     TABSP_FRAG           SEEDMON    N

E_FILE_NAME    E_CODE               E_CODE_BAS E
-------------- -------------------- ---------- -
tbwaste.sh     TAB_WASTAGE          SEEDMON    N
test.sh        TEST                 SEEDMON    N

24 rows selected.

Note that some events have "*" in front of the top code such as "*SEEDMON" it 
specifies that this event is to be processed by a remote agent

Creating a custom event

Event can be an executable file with the following requirements:
   - it accepts 3 parameters
        $1 = check file  (you write event attributes to this file see below for format)
        $2 = output file (you write event output to this file can be free format with lines <= 255 chars)
        $3 = cleared file (you write event attributes to this file see below for format)
   
   - check file and cleared file is written in the following format:
        attribute1,attribute2,attribute3,attributeX
    
     attribute(s) are parsed and stored in the repository - they are used to 
     compare event triggers when evaluating their status:
     
        OFF     when check file has 0 lines
        ON      when check file has >0 lines and previous attributes don't match current attributes
        CLEARED when check file has 0 lines and previous status was ON
     
   - cleared file is only used when event trigger is evaluated as CLEARED (see above)

Lets go through the process of creating and registering events with FusionCode. 
I will be creating the following event - sqlproc.sh:

fusioncode.FCODE-> cd $SEEDMON
fusioncode.FCODE-> touch sqlproc.sh
fusioncode.FCODE-> ls -l sqlproc.sh
-rw-r--r--    1 oracle   oinstall        0 Oct 29 14:34 sqlproc.sh
fusioncode.FCODE-> $SYS_TOP/bin/nevnt.sh

                       *** EVENT Creation Utility ***

This utility will make your custom EVENT script pluggable into the EVNT
repository.  Special tags will be inserted into the beginning of your script
using TEMPLATE.sh.  Your original script will be saved with .bak extension.

EVENT can be one of the following types:
   CUST - custom event located in (/home/oracle/admin/scripts/mon/evnt/cust/bin)
   SEED - seeded event located in (/home/oracle/admin/scripts/mon/evnt/seed/bin)
   APPS - apps event located in (/home/oracle/admin/scripts/mon/evnt/apps/bin)
   SIEB - siebel event located in (/home/oracle/admin/scripts/mon/evnt/sieb/bin)

WARNING:
   If you are a FusionCode customer and wish to create a new custom event you
   should be using CUST type.  This is the only type of EVENT that is preserved
   during FusionCode upgrades.  Events created using all other event types WILL
   be overwritten by the FusionCode upgrade process.

Enter EVENT Type: SEED I entered SEED because I am developing a new event 
                       for FusionCode if you are writing a custom event you 
                       should use CUST not SEED.

Based on the EVENT TYPE you've provided the following recent files can be added
to the FusionCode repository:

total 176
-rw-r--r--    1 oracle   oinstall        0 Oct 29 14:34 sqlproc.sh
drwxr-xr-x    2 oracle   oinstall     4096 Oct 29 14:33 .
-rwxr-xr-x    1 oracle   oinstall     5946 Oct 22 18:44 runprc.sh
-rwxr-xr-x    1 oracle   oinstall     1711 Oct 21 17:16 drilsql.sh
-rwxr-xr-x    1 oracle   oinstall     3285 Oct  2 17:59 drilwait.sh
-rwxr-xr-x    1 oracle   oinstall     2758 Oct  2 17:51 dblanal.sh
-rwxr-xr-x    1 oracle   oinstall     2609 Sep 29 16:55 dbmproc.sh
-rwxr-xr-x    1 oracle   oinstall     3219 May 29 10:39 sgsnext.sh
-rwxr-xr-x    1 oracle   oinstall     4248 May  5 18:01 rbspctu.sh
Enter your EVENT file: sqlproc.sh

EVENT can be either LOCAL or REMOTE.  LOCAL events are processed by the
management server, REMOTE events are processed directly on the remote host.

Is this a remote EVENT (Y|N)?:N
Enter EVENT short code (no spaces example: DB_EVNT): SQL_SCRIPT
Enter Author's full name (can have spaces): Vitaliy Mogilevskiy
Enter Author's short name (no spaces): VMOGILEV
Enter Author's email address: vit100gain@---NO-SPAM---earthlink.net
Done!

-rwxr-xr-x    1 oracle   oinstall     1746 Oct 29 14:35 /home/oracle/admin/scripts/mon/evnt/seed/bin/sqlproc.sh
-rw-r--r--    1 oracle   oinstall        0 Oct 29 14:35 /home/oracle/admin/scripts/mon/evnt/seed/bin/sqlproc.sh.bak
fusioncode.FCODE->

lets take a look at what happened to sqlproc.sh

fusioncode.FCODE-> cat sqlproc.sh
#!/bin/ksh
#
# File:
#       sqlproc.sh
# EVNT_REG:     SQL_SCRIPT SEEDMON 1.1
# < EVNT_NAME>Event Description</EVNT_NAME>
#
# Author:
#       Vitaliy Mogilevskiy (vit100gain@---NO-SPAM---earthlink.net)
#
# Usage:
# < EVNT_DESC>
# This event checks for ...
#
# REPORT ATTRIBUTES:
# -----------------------------
#
#
# PARAMETER       DESCRIPTION                             EXAMPLE
# --------------  --------------------------------------  --------
# </EVNT_DESC>
#
#
# History:
#       VMOGILEV        10-29-2003      Created
#

chkfile=$1
outfile=$2
clrfile=$3

## get trigger attributes
##
sqlplus -s $MON__CONNECT_STRING <$chkfile.err
WHENEVER SQLERROR EXIT FAILURE
set lines 2000
set verify off
set pages 0
set trims on
set head off
set feed off
set echo off
spool $chkfile
SELECT
       col1
||','||col2
||','||col3
||','||col4
FROM table
/
spool off
exit
CHK

## check for errors
##
if [ $? -gt 0 ]; then
        cat $chkfile.err
        rm $chkfile.err
        exit 1;
fi


## if I got here remove error chk file
##
rm $chkfile.err


## check if attribute file has any output
## if not exit if yes continue with
## getting trigger output
##
if [ `cat $chkfile | wc -l` -eq 0 ]; then
        exit 0 ;
fi


## get trigger output
##
sqlplus -s $MON__CONNECT_STRING <$outfile.err
WHENEVER SQLERROR EXIT FAILURE
ALTER SESSION SET NLS_DATE_FORMAT='RRRR-MON-DD HH24:MI:SS';
spool $outfile
set lines 250
set pages 60
set trims on
SELECT
   col1
,  col2
,  col3
,  col4
FROM table;
spool off
exit
CHK

## check for errors
##
if [ $? -gt 0 ]; then
        cat $outfile.err
        rm $outfile.err
        exit 1;
fi

## if I got here remove error chk file
##
rm $outfile.err

#######################
### END TEMPLATE.sh ###
#######################


As you can see nevnt.sh "EVENT Creation Utility" created new event based on a 
template. There are few tags that are worth mentioning here:

   - < EVNT_NAME>Event Short Name goes here (cannot contain line breaks)</EVNT_NAME>
   - < EVNT_DESC>Event Long Description goes here 
        (can contain line breaks)</EVNT_DESC>

Next step (not shown) I modify the event file to do what I want it to do, then I 
register it with the repository:


fusioncode.FCODE->chmod +x sqlproc.sh
fusioncode.FCODE-> $SYS_TOP/bin/evntmaint.sh
evntmaint.sh  E_FILE_NAME E_CODE E_CODE_BASE username/password@REPDB 
fusioncode.FCODE-> grep EVNT_REG sqlproc.sh
# EVNT_REG:     SQL_SCRIPT SEEDMON 1.1
fusioncode.FCODE-> $SYS_TOP/bin/evntmaint.sh sqlproc.sh SQL_SCRIPT SEEDMON evnt/*********@fcode
PROCESSING EVENT FILE: sqlproc.sh ...
checking if this event is already registered ...
new event insert ...
Done!

INSERT INTO events(
   e_id
,  date_created
.
.
.
--
--
')),chr(10))) );

1 row created.


Commit complete.

fusioncode.FCODE->

Screen snapshot of the new event loaded in the repository

Installed Events Screen

Event Threshold Screen

END.

$LAST_MODIFIED: 29-OCT-2003 $MODIFIED_BY: VMOGILEV $FILE_NAME: event_types.htm $REVISION: 1.8