#!/bin/sh

# file: tec37up_cliconfig
# - Property of Hewlett-Packard Development Company, L.P. All rights reserved
# 

#
# This file provides info to manually configure the HP_Insight_Manager Classes and Rules in the TEC 3.7 and TEC 3.8 environment.
# 

# The following variables should be changed to suite individual customer requirement 
#
# Variables:
# Rulebase: Name of rulebase
# RBPath:  Rulebase path
# RBFilesPath:  Location of HP Classes and Rules files
# RBClone:   Name of the rulebase to be clone (if any)
#
# Note:
# Import tecad_snmp.baroc into the rulebase if it does not already exist. 

RuleBase=ins2rb
RBPath=/home/hpqtec/tec_rules/ins2rb
RBFilesPath=/home/hpqtec/hpq/TEC
RBClone=Default

# create rulebase

wrb -crtrb -path $RBPath $Rulebase
chmod -R 777 $RBPath

wrb -cprb $RBClone $Rulebase

wrb -comprules $Rulebase

cp $RBFilesPath/ins_correl $RBPath/TEC_TEMPLATES

cp $RBFilesPath/user_predicates $RBPath/TEC_TEMPLATES

# checking for existing of tecad_snmp.baroc
# wrb -lsrbclass $Rulebase | grep "SNMP_Trap"
# if tecad_snmp.baroc does not exist, run the following:
# "wrb -imprbclass $RBFilesPath/tecad_snmp.baroc -after  "tec.baroc" $Rulebase"
#

if wrb -lsrbclass $Rulebase | grep "SNMP_Trap" >/dev/null 2>&1; then
   echo "tecad_snmp.baroc exists"
else
   wrb -imprbclass $RBFilesPath/tecad_snmp.baroc -after  "tec.baroc" $Rulebase"
fi

# Importing HP TEC Class definitions and Rules
	
wrb -imprbclass $RBFilesPath/ins_evt.baroc $Rulebase

wrb -imprbrule $RBFilesPath/ins_start.rls $Rulebase

wrb -imprbrule $RBFilesPath/ins_evt.rls $Rulebase

wrb -imptgtrule ins_evt EventServer $Rulebase

wrb -comprules $Rulebase
wrb -loadrb -use $Rulebase

wstopesvr
wstartesvr


