Tutorial – Analysis Rule Creation

 

Some things to note about VA2 Analysis Rules:


Here’s and example of an Analysis Rule. 

 

 

 

 

 

 

To edit an Analysis Rule, right click on the rule and choose Edit.  You will receive a pop up box that contains the code for the Analysis Rule.

 

 

 

 

 

Most properties are pretty self explanatory.   “Execution Interval” can be set from 1 minute to 1 week.  This is an interval, from the time the Central Server starts.  For example, a 1 hour rule will execute 1 hour after the last execution, not every hour on the hour.

 

 

Here is a description of the code for this particular rule.

 

Line 1:

use siebsrvobj;

 

The “use” statement is standard perl.  In this case, the module name is siebsrvrobj – which is part of  VA2 and offers access to the Siebel data that VA2 collects.  See the documentation for siebsrvobj for a list of all its methods.  http://recursivetechnology.com/documentation/Appendix_D.htm .  If you know perl, you know that there are thousands of modules already written that you can “use”.  Check out CPAN for free downloads.  http://www.cpan.org

 

 

Line 2:

my $entobj = siebsrvobj->newobj($datasession,$debug,'SiebEnt');       #initialize the enterprise object

 

The “my” keyword declares a variable in Perl.  The $ prefaces scalar variable names in perl.  In this case, we’re setting the new variable, $entobj to a new instance of the siebsrvobj module.  To do that, we call the method newobj, and pass in some parameters.  The first parameter we pass in is the $datasession variable.  $datasession is the VA2 data access thread, that is already open and available for all Analysis Rules and Statistics.  $datasession can access all parts of VA2 repository, such as how many components and tasks are running in Siebel.

 

The $debug variable is by default set to 0, or no debug.  If you want to see debug messages while testing analysis rules, this variable can be set to 1.

 

The third parameter of the method newobj is a string, ‘SiebEnt’.  This is the Enterprise Name of the Siebel enterprise you are monitoring. 

 

Now the $entobj is initialized, we can access all its methods.  For example, in this rule, we want to determine if a particular component is running.  That comes in line 3.

 

Line 3:

$retval = $entobj->isentcomprunning("WorkMon"); 

 

All analysis rules have one function.  The is to set the variable $retval to a true or false value.  In Perl, true is anything besides 0 or “” or FALSE.  Any code necessary to generate a $retval is legal.

 

In this case, we are trying to determine if a particular Siebel Component is running.  We call the “isentcomprunning”, and pass in the name of the component.  The rule returns true if running, and false if not.  No further coding needed.

 

 

Here are some other examples of methods that can be called, related to Siebel Server libraries:

 

#$objenterprise->runningappservers()                                                                            #returns a @ of appserversrunning

#$objenterprise->isappsrvrunning($stringappservername)                                              # returns 1 or 0 if appserver is running

#$objenterprise->isentcomprunning($stringofmoncomp)                                                #returns 1 or 0 if enterprise component is running

#$objenterprise->isappsrvrcomprunning($stringofappname,$stingofcompname)              #returns 1 or 0 if component for appserver specified is running

#$objenterprise->isenttaskrunning($stringoftask)                                                           #returns 1 or 0 if component for enterprise is running

#$objenterprise->isappsrvrtaskrunning($stringofappname,$stringoftaskname)                #returns 1 or 0 if task for appserver specified is running

#$objenterprise->averagetasktime($taskalias,$appservername);                                    #returns average execution time for the task