Advanced Search
HomeTechnical DocumentsTipsTivoliEnterprise Console › Troubleshooting BAROC Problems

Troubleshooting BAROC Problems

Recently a colleague of mine had a problem with their TEC Server while developing new rules and class definitions. This tip presents this problem and goes through each of the steps we went through to help identify and fix the problem.

The Problem

The problem was simply that a particular event was failing to be parsed by the reception engine - getting a PARSING_FAILED error when the reception log was dumped out ie

1~7~1~967469968(Aug 28 14:39:28 2000)
### EVENT ###
TEC_Start;source=TEC;msg="TEC Event Server initialized";hostname=roobarb;END

### END EVENT ###
PROCESSED

1~8~1~967469977(Aug 28 14:39:37 2000)
### EVENT ###
ESM_APPL_ERROR;
source=ESM;
severity=FATAL;
origin=132.70.4.224;
END

### END EVENT ###
PARSING_FAILED~'Line 1: Class ESM_APPL_ERROR undefined'

Identifying the Problem

Well this should be a straight forward problem to fix - simply the class has not been defined correctly. I was assured that the esm.baroc file had been imported, compiled, loaded and the TEC stopped and started.

To be sure I checked again

First I checked which rule base was currently loaded using wlscurrb:-

wlscurrb
The currently used rule base was loaded from the rule base named 'TK10'.

I then checked to see if the class had actually been loaded into the current rulebase using wlsrbclass:-

wlsrbclass TK10
Class Name
--------------
ROOT
TEC_CLASS
EVENT
TASK
TEC_Error
TEC_Notice
TEC_Start
TEC_Stop
TEC_DB
TEC_Tick
TK9_Upload_Base
TK9_Main_Upload_Start
TK9_Main_Upload_End
TK9_Sub_Upload_Complete
TK9_Sub_Upload_Start
ESM_Base
ESM_Error
ESM_APPL
ESM_APPL_LOAD
ESM_APPL_UNLOAD
ESM_APPL_STATUS
ESM_APPL_ERROR

This seems a bit strange, the error from wtdumprl suggests that the class has not been defined, however here we see that the rulebase actually believes the ESM_APPL_ERROR class is defined, and the rulebase knows about it.

However the wlsrbclass command is actually a bit of a red herring, it doesn't read from what's actually loaded, instead it reads the information straight from the baroc files themselves using the .load_classes file to determine which baroc files are to be used. This can be seen if you perform an odstatafter your wlsrbclass command ie:-

Open in New Window
   694 O+hdoq  1-680  done   959     0 14:47:42        2101917836.1.26 lookup
   695 O
+hdoq  1-680  done   169     0 14:47:42        2101917836.1.347#TMF_Man
   
agedNode::Managed_Node# stat_file
   
696 O+hdoq  1-680  done     6     0 14:47:42        2101917836.1.347#TMF_Man
   
agedNode::Managed_Node# read_from_file?>

Just a bit of the ouput has been displayed here, but you should be able to see that the command checks if a baroc file exists first and then reads them.

The next thing is to check to see if the classes have really been loaded into the currently running rulebase.

When you start the Event Server one of the first things it does is to load each of the classes and their child parent relationships (but not the slot or facet information) into the database, into a table called TEC_T_ISA (before this it truncates the same table). This is therefore the best place to check to see if the currently running database has the class you need loaded.

So to check to see if our class is loaded we can run a simple query against the database ie:

wrimsql
SQL 0 > connect tec
SQL 1 > .
SQL 0 > select * from TEC_T_ISA where PARENT = "ESM_Base"
SQL 1 > .
SQL 0 >

As we thought the class is not loaded in the current database.

Now we need to try and find out why the class is not defined. This could be for a number of reasons:-

  • Class is not defined in the relevant baroc file
  • The baroc file has not been imported into the rulebase
  • The rulebase has not been compiled correctly
  • The rulebase has been compiled but not loaded

So now lets go and check the rulebase directory to see if we can find our class. We need to find out where our rulebase is physically located using wlsrb -d:-

Open in New Window
wlsrb -d
Rule Base Name Directory
-------------- -------------------------------------
Default        
roobarb:e:/management/Tivoli/bin/w32-ix86/TME/TEC/default_rb
Test           roobarb
:E:/Management/Tivoli/custom/TEC/RuleBases/Test
TK9            roobarb
:E:/Management/Tivoli/custom/TEC/RuleBases/TK9
RB             roobarb
:E:/Management/Tivoli/custom/TEC/RuleBases/RB
TK10           roobarb
:E:/Management/Tivoli/custom/TEC/RuleBases/TK10?>

Now we know where the rulebase is located we can look at the BAROC files and find the class.

cd /Management/Tivoli/custom/TEC/RuleBases/TK10/TEC_CLASSES
grep ESM_APPL_ERROR *.baroc
esm.baroc: ESM_APPL_ERROR ISA ['ESM_Base', 'ESM_Error'];

Open in New Window
TEC_CLASS :
        
ESM_Base ISA EVENT
        DEFINES 
{
                
severity: default = WARNING;
                
source: default = "ESM";
                
sub_source: default = "Security Management";
        };
END

TEC_CLASS 
:
        
ESM_Error ISA EVENT
        DEFINES 
{
                
severity: default = CRITICAL;
                
errorINTEGER, default = 0;
                
error_msgSTRING;
        };
END

TEC_CLASS 
:
        
ESM_APPL ISA ESM_Base
        DEFINES 
{
                
instanceSTRING;
        };
END

TEC_CLASS 
:
        
ESM_APPL_LOAD ISA ESM_Base;
END

TEC_CLASS 
:
        
ESM_APPL_UNLOAD ISA ESM_Base;
END

TEC_CLASS 
:
        
ESM_APPL_STATUS ISA ESM_Base;
END

TEC_CLASS 
:
        
ESM_APPL_ERROR ISA ['ESM_Base''ESM_Error'];
END?>

It seems to be here, in the baroc file esm.baroc. Lets make sure that it's defined ok, we'll need to open it in a text editor to do this. The baroc file is as follows:

The definition of the classes seems ok. One thing you should pay particular attention to is to makesure there is a blank line between each of the definitions, and that there is one at the end of the file, if not the classes wont be loaded. Again this file seems ok.

We know it's defined in the .load_classes file because our wlsrbclass command previously displayed all of the ESM classes.

The next thing to do is to compile the rulebase again to makesure there were no soft errors that were missed.

wcomprules TK10
Loading CLASSES...
Parsing BAROC file e:/Management/Tivoli/Custom/TEC/RuleBases/TK10/TEC_CLASSES/root.baroc
Parsing BAROC file e:/Management/Tivoli/Custom/TEC/RuleBases/TK10/TEC_CLASSES/tec.baroc
Parsing BAROC file e:/Management/Tivoli/Custom/TEC/RuleBases/TK10/TEC_CLASSES/tk9.baroc
Parsing BAROC file e:/Management/Tivoli/Custom/TEC/RuleBases/TK10/TEC_CLASSES/esm.baroc
Compiling Rules...
Compiling rule set e:/Management/Tivoli/Custom/TEC/RuleBases/TK10/TEC_RULES/tk9_upload.rls ...
Final Compilation Stage...

That all went ok, so we'll reload the rulebase. Remember because we are loading (possibly) new classes we also need to stop and start the Event Server

wloadrb TK10
wstopesvr
wstartesvr
The TME 10 Enterprise Console Server is initializing...
The TME 10 Enterprise Console Server is running.

Some background here on what the wloadrbcommand is doing. First it checks to see if there is a directory$DBDIR/tec/rb_dir directory, if there is it copies this directory and all of it's contents (TEC_CLASSES, TEC_RULES and TEC_TEMPLATES) to the directory$DBDIR/tec/rb_dir.bak. It then copies all of the files and subdirectories out the the current rulebase directory - in this case e:/Management/Tivoli/Custom/TEC/RuleBases/TK10 to the $DBDIR/tec/rb_dir. Now when you stop and start the Event Server, the Event Server gets it's Class Definitions and Rules form this $DBDIR/tec/rb_dir directory.

OK, so now its compiled and loaded, the Event Server has been stopped and started, so now it should work, we'll try it again

wpostemsg -r FATAL ESM_APPL_ERROR ESM
### END EVENT ###
PARSING_FAILED~'Line 1: Class ESM_APPL_ERROR undefined'

1~9~1~967474574(Aug 28 15:56:14 2000)
### EVENT ###
ESM_APPL_ERROR;
source=ESM;
severity=FATAL;
origin=132.70.4.224;
END

### END EVENT ###
PARSING_FAILED~'Line 1: Class ESM_APPL_ERROR undefined'

Its the same error again!

Ok so we're going to have to look at this in a bit more detail. Let's check the database again to see if the class has been loaded this time.

wrimsql
SQL 0 > connect tec
SQL 1 > .
SQL 0 > select * from TEC_T_ISA
SQL 1 > .
Row 1
parent : -null-
child : EVENT
Row 2
parent : EVENT
child : TEC_Error
Row 3
parent : EVENT
child : TEC_Notice
Row 4
parent : EVENT
child : TEC_Start
Row 5
parent : EVENT
child : TEC_Stop
Row 6
parent : EVENT
child : TEC_DB
Row 7
parent : EVENT
child : TEC_Tick
Row 8
parent : EVENT
child : TK9_Upload_Base
Row 9
parent : TK9_Upload_Base
child : TK9_Main_Upload_Start
Row 10
parent : TK9_Upload_Base
child : TK9_Main_Upload_End
Row 11
parent : TK9_Upload_Base
child : TK9_Sub_Upload_Complete
Row 12
parent : TK9_Upload_Base
child : TK9_Sub_Upload_Start
SQL 0 >
SQL 1 > quit
SQL 2 > .

Hmm, strange, none of the ESM classes have been loaded into the rulebase, but we've compiled it with no errors loaded it and definately stopped and started it.

I'll check the esm.baroc file again but this seems ok.

I also check the TEC logfiles in the /tmpdirectory, but there was nothing in these files, it appears that the TEC server is running correctly without error.

I'm going to have to have a look at what's happening when the event server starts in detail. To do this I need to turn Event Server tracing on (not rule tracing). This is done by editing the.tec_diag_config file found in the$BINDIR/TME/TEC directory. This file defines what level of messages are written to the /tmp/tec_*log files.

I think it's got to be something to do with the fact that the classes aren't being loaded at startup, it maybe there's a database error or something. Anyway it is the tec_dispatchprocess that loads the classes into the database, so in the .tec_diag_config file we can switch on maximum tracing for this module by changing the following entries fromerror to trace1 and leaving all the other sections to error ie.

Open in New Window
# tec_dispatch
###############

tec_dispatch Highest_level  trace1
tec_dispatch Tec_Dispatch    trace1     
/tmp/tec_dispatch
tec_dispatch Disp_Baroc        trace1     
/tmp/tec_dispatch
tec_dispatch Disp_Db        trace1     
/tmp/tec_dispatch
tec_dispatch Disp_Msg        error     
/tmp/tec_dispatch
tec_dispatch Disp_Process    error     
/tmp/tec_dispatch
tec_dispatch Disp_Synchro    error     
/tmp/tec_dispatch

# low level modules
tec_dispatch Exit_Msg        error     /tmp/tec_dispatch
tec_dispatch Tec_Baroc        trace1     
/tmp/tec_dispatch
tec_dispatch Timer        error     
/tmp/tec_dispatch
tec_dispatch Lock_Clt        error     
/tmp/tec_dispatch
tec_dispatch Log_Clt        error     
/tmp/tec_dispatch?>

Once this is done and saved we need to stop and start the Event Server.

The tec_dispatch logfile in /tmp looked like the following:-

Aug 28 16:49:32.642000 tec_dispatch[307] TR0 tec_dispatch.c:342: Dispatch connected to Master on host roobarb
Aug 28 16:49:33.523000 tec_dispatch[307] TR0 tec_baroc.c:130: Load BAROC classes ...
Aug 28 16:49:33.523000 tec_dispatch[307] TR1 tec_baroc.c:169: File tec/rb_dir/TEC_CLASSES/root.baroc parsed
Aug 28 16:49:33.523000 tec_dispatch[307] TR1 tec_baroc.c:169: File tec/rb_dir/TEC_CLASSES/tec.baroc parsed
Aug 28 16:49:33.523000 tec_dispatch[307] TR1 tec_baroc.c:169: File tec/rb_dir/TEC_CLASSES/tk9.baroc parsed
Aug 28 16:49:33.523000 tec_dispatch[307] WNG tec_baroc.c:160: Error: File tec/rb_dir/TEC_CLASSES/esm.baro does not exist; info not loaded
Aug 28 16:49:33.523000 tec_dispatch[307] TR0 tec_baroc.c:181: Load BAROC classes succeeded
Aug 28 16:49:37.028000 tec_dispatch[307] TR0 tec_dispatch.c:406: Rule Engine & TEC Client IPC Server initialization succeeded
Aug 28 16:49:38.240000 tec_dispatch[307] TR0 tec_dispatch.c:502: Dispatch accepted Rule on host roobarb
Aug 28 16:49:38.240000 tec_dispatch[307] TR0 tec_dispatch.c:141: get_ready_for_clients
Aug 28 16:49:38.250000 tec_dispatch[307] TR1 tec_dispatch.c:203: get_ready_for_clients returning
Aug 28 16:49:45.350000 tec_dispatch[307] TR1 tec_disp_db.c:242: Add event to the database

Line 6 looks interesting, it shows there's an error trying to load a file called esm.baro. Strange we don't have a file esm.baroc (it's called esm.baroc).

Now this really is strange. The tec_dispatch process determines which classes to load and in what order by reading the.load_classes file from the directory $DBDIR/tec/rb_dir/TEC_CLASSES.

If we have a look at this file it looks correct, loading esm.baroc ie

root.baroc tec.baroc tk9.baroc esm.baroc

However on closer investigation under a hex editor I see that each line ends in a OD OA, ie\CR\LF, except the last line, here there is no new line after it, and by the looks of it the tec_dispatch process is doing a chop by default to remove carridge returns. Thus its trying to read the non-existent file esm.baro.

Fixing the Problem

After about 30 minutes or so of investigation we've found the problem, simply by adding a new line to the end of the .load_classes file, compiling loading and stopping and starting the Event Server we fix the problem.

Why did the Problem Occur?

Normally this problem would not occur, if you follow the guidelines of using the wimprbclass command, however in this case the baroc file was manually copied into the rulebase directory and the .load_classes file edited manually (without a newline being added!).