|
Softpanorama |
May the source be with you, but remember the KISS principle ;-)
|
| News | See also | Recommended Links | Creation | Compiling | Loading | Testing |
| WRB command options | TEC Rules Programming | Consistency checking | Tips | Humor | Etc | |
You can perform the following rule base operations:
The wrb command enables you to manage rule bases: create, view information, manipulate, delete, compile, load, and activate rule bases. The command's first option specifies its primary function. For example, to determine the current TEC rule base one can use the command: wrb -lscurrb
wrb command has the main option (first argument, -lscurrb in the example above ) and option suboptions. The latter are valid only within the context of the first argument. Formally wrb command syntax can be defined as:
wrb [ option [ suboption ]]
wrb -imprbclass name.baroc <rulebasename>
wrb -comprules rulebasename
wrb -loadrb ruleBaseName
wstopesvr && wstartesvr
rulepacks are useless and should be avoided.
Orb Data - Enterprise Console TEC tips page contains an excellent tips.
The command wrb -lscurrb reports the name of the current working rule base name. Tivoli provides a default rule base called Default. You should not use it as your working database.
To find out where rule bases resides on the file system use:
wrb -lsrb -path rulebase
TEC rulebase can be reloaded without
restarting TEC: wrb -loadrb -use rulebase
In Unix aliases (or, better, functions ) should be defined for typical operations, for example:
alias curbase='wb -lscurrb'
alias whichbase='wrb -lsrb -path ' # list all rulebases available
alias comprules='wrb -comprules ' # compile rules
alias delrb='wrb -delrb ' # delete a ruleset
alias loadrb='wrb -loadrb -use '
alias restart='wstopesvr && wstartesvr'
|
The following is a sample session using a rulebase named test. It shows the previously documented commands showing all the commands listed above along with the standard outputs. The sample session was performed on a Windows(R)-based Enterprise Console server.
Create the new rulebase.
bash$ wrb -crtrb -path /rulebase/test test Loading Classes Parsing C:\rulebase\test\TEC_CLASSES\root.baroc Parsing C:\rulebase\test\TEC_CLASSES\tec.baroc Loading Rule Sets Loading Rule Packs Loading RB Targets Parsing C:\rulebase\test\TEC_RULES\EventServerImport in the Default rules.
bash$ wrb -cprb -o -f Default testImport the TransPerf.baroc file.
bash$ wrb -imprbclass c:/temp/TransPerf.baroc test Loading Classes Parsing C:\rulebase\test\TEC_CLASSES\root.baroc Parsing C:\rulebase\test\TEC_CLASSES\tec.baroc Parsing C:\rulebase\test\TEC_CLASSES\Tmw2k.baroc Parsing C:\rulebase\test\TEC_CLASSES\hb_events.baroc Parsing C:\rulebase\test\TEC_CLASSES\ebusiness.baroc Parsing C:\rulebase\test\TEC_CLASSES\itmwas_dm_events.baroc Parsing C:\rulebase\test\TEC_CLASSES\WebSphere_MQ_Channel.baroc Parsing C:\rulebase\test\TEC_CLASSES\WebSphere_MQ_QueueManager.baroc Parsing C:\rulebase\test\TEC_CLASSES\WebSphere_MQ_Queue.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2_Event.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2Agents.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2HostThroughput.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2CpuUtilization.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2DatabaseStatus.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2InstanceStatus.baroc Parsing C:\rulebase\test\TEC_CLASSES\netview.baroc Parsing C:\rulebase\test\TEC_CLASSES\dependency.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecadnw4.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_logfile.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_nt.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecados2.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_snmp.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_ov.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_hpov.baroc Parsing C:\rulebase\test\TEC_CLASSES\sem_events.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_nv6k.baroc Parsing C:\rulebase\test\TEC_CLASSES\as400msg.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_snaevent.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_nv390msg.baroc Parsing C:\rulebase\test\TEC_CLASSES\TransPerf.barocCompile the new rulebase.
bash$ wrb -comprules test Compiling test Loading Classes Parsing C:\rulebase\test\TEC_CLASSES\root.baroc Parsing C:\rulebase\test\TEC_CLASSES\tec.baroc Parsing C:\rulebase\test\TEC_CLASSES\Tmw2k.baroc Parsing C:\rulebase\test\TEC_CLASSES\hb_events.baroc Parsing C:\rulebase\test\TEC_CLASSES\ebusiness.baroc Parsing C:\rulebase\test\TEC_CLASSES\itmwas_dm_events.baroc Parsing C:\rulebase\test\TEC_CLASSES\WebSphere_MQ_Channel.baroc Parsing C:\rulebase\test\TEC_CLASSES\WebSphere_MQ_QueueManager.baroc Parsing C:\rulebase\test\TEC_CLASSES\WebSphere_MQ_Queue.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2_Event.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2Agents.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2HostThroughput.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2CpuUtilization.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2DatabaseStatus.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2InstanceStatus.baroc Parsing C:\rulebase\test\TEC_CLASSES\netview.baroc Parsing C:\rulebase\test\TEC_CLASSES\dependency.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecadnw4.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_logfile.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_nt.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecados2.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_snmp.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_ov.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_hpov.baroc Parsing C:\rulebase\test\TEC_CLASSES\sem_events.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_nv6k.baroc Parsing C:\rulebase\test\TEC_CLASSES\as400msg.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_snaevent.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_nv390msg.baroc Parsing C:\rulebase\test\TEC_CLASSES\TransPerf.baroc Loading Rule Sets Parsing C:\rulebase\test\TEC_RULES\maintenance_mode.rls Parsing C:\rulebase\test\TEC_RULES\netview.rls Parsing C:\rulebase\test\TEC_RULES\dependency.rls Parsing C:\rulebase\test\TEC_RULES\ebusiness.rls Parsing C:\rulebase\test\TEC_RULES\heartbeat.rls Parsing C:\rulebase\test\TEC_RULES\cleanup.rls Loading Rule Packs Loading RB Targets Parsing C:\rulebase\test\TEC_RULES\EventServer Translating Rules Translating C:\rulebase\test\TEC_RULES\maintenance_mode.rls.pro Translating C:\rulebase\test\TEC_RULES\netview.rls.pro Translating C:\rulebase\test\TEC_RULES\dependency.rls.pro Translating C:\rulebase\test\TEC_RULES\ebusiness.rls.pro Translating C:\rulebase\test\TEC_RULES\heartbeat.rls.pro Translating C:\rulebase\test\TEC_RULES\cleanup.rls.pro Compiling Rules Compiling C:\rulebase\test\TEC_RULES\maintenance_mode.rls.pro Compiling C:\rulebase\test\TEC_RULES\netview.rls.pro Compiling C:\rulebase\test\TEC_RULES\dependency.rls.pro Compiling C:\rulebase\test\TEC_RULES\ebusiness.rls.pro Compiling C:\rulebase\test\TEC_RULES\heartbeat.rls.pro Compiling C:\rulebase\test\TEC_RULES\cleanup.rls.pro Building RB target EventServer Compiling C:\rulebase\test\.rbtargets\EventServer\TEC_RULES\.load_rules.pro Compilation Complete.Load the new rulebase.
bash$ wrb -loadrb -use test Loading Classes Parsing C:\rulebase\test\TEC_CLASSES\root.baroc Parsing C:\rulebase\test\TEC_CLASSES\tec.baroc Parsing C:\rulebase\test\TEC_CLASSES\Tmw2k.baroc Parsing C:\rulebase\test\TEC_CLASSES\hb_events.baroc Parsing C:\rulebase\test\TEC_CLASSES\ebusiness.baroc Parsing C:\rulebase\test\TEC_CLASSES\itmwas_dm_events.baroc Parsing C:\rulebase\test\TEC_CLASSES\WebSphere_MQ_Channel.baroc Parsing C:\rulebase\test\TEC_CLASSES\WebSphere_MQ_QueueManager.baroc Parsing C:\rulebase\test\TEC_CLASSES\WebSphere_MQ_Queue.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2_Event.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2Agents.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2HostThroughput.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2CpuUtilization.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2DatabaseStatus.baroc Parsing C:\rulebase\test\TEC_CLASSES\DB2InstanceStatus.baroc Parsing C:\rulebase\test\TEC_CLASSES\netview.baroc Parsing C:\rulebase\test\TEC_CLASSES\dependency.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecadnw4.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_logfile.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_nt.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecados2.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_snmp.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_ov.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_hpov.baroc Parsing C:\rulebase\test\TEC_CLASSES\sem_events.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_nv6k.baroc Parsing C:\rulebase\test\TEC_CLASSES\as400msg.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_snaevent.baroc Parsing C:\rulebase\test\TEC_CLASSES\tecad_nv390msg.baroc Parsing C:\rulebase\test\TEC_CLASSES\TransPerf.baroc Loading Rule Sets Parsing C:\rulebase\test\TEC_RULES\maintenance_mode.rls Parsing C:\rulebase\test\TEC_RULES\netview.rls Parsing C:\rulebase\test\TEC_RULES\dependency.rls Parsing C:\rulebase\test\TEC_RULES\ebusiness.rls Parsing C:\rulebase\test\TEC_RULES\heartbeat.rls Parsing C:\rulebase\test\TEC_RULES\cleanup.rls Loading Rule Packs Loading RB Targets Parsing C:\rulebase\test\TEC_RULES\EventServerStop and restart the Enterprise Console server.
bash$ wstopesvr && wstartesvr The Tivoli Enterprise Console Server is initializing... The Tivoli Enterprise Console Server is running.List the current rulebase.
bash$ wrb -lscurrb The currently used rule base was loaded from the rule base named 'rbtmtp60'.List status of the Enterprise Console server.
bash$ wstatesvr The Tivoli Enterprise Console Server is runningList all rulebases and their file locations.
bash$ wrb -lsrb -path Rule Base Name Directory -------------- ------------------------------------- Default nickelback:C:/PROGRA~1/Tivoli/bin/w32-ix86/TME/TEC/default_rb rbtmtp53 nickelback:/rulebase/rbtmtp53 rbtmtp52 nickelback:/rulebase/rbtmtp52 rbtmtpfp nickelback:/rulebase/rbtmtpfp rbtmtp53new nickelback:/rulebase/rbtmtp53new barocpatch nickelback:/rulebase/barocpatch larry nickelback:/rulebase/larry rbtmtp61 nickelback:C:\temp\new\ rbtmtprca nickelback:C:/rulebase rbtmtp60 nickelback:/rulebase/rbtmtp60 test nickelback:/rulebase/test
| -comprules [-profile] [-trace] rule_base | Compile the rules in the rule base specified by the rule_base argument into Prolog object files that the rule engine can process. |
| -cprb [-classes] [-rulesets] [-targets] [-delete | overwrite] [-force] source destination | Copies an existing rule base to another existing rule base. |
| -crtrb [-path path][-force] rule_base | Creates a rule base on the event server in the current Tivoli Management Region (TMR). |
| -import rule_set... | The name of one or more optional rule sets to import into the new rule pack. |
| -crttarget target[-import { rule_set}...] rule_base | Creates a rule base target in the rule base. |
| -import {rule_set}... | The name of one or more optional rule rule sets to import |
| -delrb rule_base... | Delete one or more rule bases from the event server. |
| -delrbclass class_set [-force] rule_base | Deletes a class set from a rule base. |
| -delrbrule rule_set [-force] rule_base | Deletes a rule set from a rule base. |
| -delrbtarget target rule_base | Deletes a rule base target from a rule base. |
| -imprbclass class_file [-before class_set | -after class_set][-force] | Imports a file of event class specifications (a.baroc file) into a rule base, appending it to the end of the class specifications unless otherwise specified with arguments. |
| -imprbrule rule_file [-force] rule_base | Imports a rule set file into the rule base. |
| -loadrb [-use] rule_base | Loads a rule base onto the event server. |
| -lscurrb | Lists the name of the currently loaded rule base. |
| -lsrb [-path] [rule_base...] | Lists the rule bases that are currently defined on the event server. |
| -lsrbclass [class_name...] [-detailed] rule_base | Lists the event classes in the specified rule base. |
| -lsrbrule [rule_file...] rule_base | Lists the names of the rule set files which have been imported into the specified rule base. |
| -lsrbtarget [target...] [-detailed] rule_base | Lists the names of the rule base targets in the specified rule base. |
| -setrb [-name name][-path path [-force]] rule_base | Sets properties of an existing rule base |
www.princeton.edu
Sending a Tivoli event from a Unix script involves the following steps:
- Define an event class
- Generate events
- Choose a method for closing events
Defining an event class
Every event must have an class name that identifies it to the Tivoli Enterprise Console (TEC). By convention, we will use unix_<program name> for the events sent by programs or scripts on the Unix systems, and nt_<program name> for Window NT/2000. The ESM staff will set up the event classes as requested. Put a request in the ESM-Incoming queue in TPM or send e-mail to tivoli@Princeton.EDU.
Generating events
Issue a wpostemsg command to send an event to the Tivoli Enterprise Console (TEC), which is the event correlation engine. The format of the command is as follows:
wpostemsg [-m message] [-r severity] [hostname=<host>] [value=<value>] [probe_arg=<probe-argument>] [response_level=reset] class source
The wpostemsg command requires that the proper environment be set up. The easiest way to do this is with the “tiv” script in /var/local/Tivoli/Princeton/bin. To issue a single command, just give the tiv command followed by the command. The tiv command with no arguments will start a shell with the environment set up.
Arguments:
message is a arbitrary text message explaining the meaning of the event.
severity is one of FATAL, CRITICAL, MINOR, HARMLESS, or WARNING
class is the class defined for this event.
source is “unix” or “windows_nt”
<host> is the unqualified name of the host for which the event is to be reported.
<value> is the value (if any) associated with this event.
<probe_argument> is any qualifier associated with the event, such as the disk, network interface, etc. to which the event applies. Use this to distinguish different events of the same class coming from the same host
<response_level> is an optional argument. If it is specified as “reset”, then an open event with the same hostname, class and probe_arg values will be closed.
Examples:
/var/local/Tivoli/Princeton/bin/tiv wpostemsg –m ‘Percent disk’ –r WARNING hostname=isserver1 value=98 probe_arg=’/tmp space’ unix_dfwarn unix
/var/local/Tivoli/Princeton/bin/tiv wpostemsg –m ‘Percent inodes’ –r WARNING hostname=isserver1 value=98 probe_arg=’/tmp inodes’ unix_dfwarn unix
GulfBreeze Software Tivoli Training
Related documentation
| Topic | For More Information |
|---|---|
| Sun Management Center Installation | Sun Management Center User's Guide |
| TEC adapters | TME10 Event Integration Facility User's Guide |
| Tivoli task libraries and tasks | TME10 Framework User's Guide |
| Tivoli BAROC file and rules | TME10 Enterprise Console Rule Builder's Guide |
| Tivoli Console and tasks | TME10 Enterprise Console User's Guide |
Only one rulebase can be active. The operation of making rulebase active is called loading of the rulebase:
wrb -loadrb myrules
Certain tasks performed with the wrb command require that the rule base be in a consistent state before the command completes. If the rule base is not consistent, the command displays an error message explaining the cause of the inconsistency. For a rule base to be consistent, the syntax of class sets and rule sets is verified, as well as references to those files in various rule base definition files. For a rule base to be in a consistent state, the following conditions must be true:
Any command that checks rule base consistency will accept the -force argument to perform the task without checking rule base consistency first. When class set files (.baroc ) or rule set files (.rls ) are being imported into a rule base, the name of the file must be given. Once these objects have been imported into a rule base, you must use the logical name in any command options. When importing an object into a rule base (for example, rule sets, event classes, rule packs into rule base targets, and so forth), an object that already exists in the rule base must be deleted before you can replace it with a newer version of the object. Each command option below specifies whether you must specify the name of the file or the name of the object.
Copyright © 1996-2008 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
Standard disclaimer: The statements, views and opinions presented on this web page are those of the author and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.
Last modified: March 15, 2008