Siebel Components Offline

In other tutorials, such as this one that checks a particular Siebel component for online/availability.
Under that scenario, you would also want to create an Error Definition for that Analysis rule, and repeat this for each Siebel Component you would like to monitor.  But if you want to monitor every component on every Siebel appserver, that is not the most efficient way to go.

The following code checks every component on the Siebel appserver, and alerts administrators if any component is offline.  You can also set parameters to exclude components that you don’t want monitored.  It uses the new appservercompsnotrunning method. 

Here is the code.  Also can download it here as XML and import it.  Make sure to customize the name of your Siebel $enterprise and $appserver parameters.

use siebsrvobj;

my $enterprise = 'siebel';                      #make sure to set Siebel $enterprise correclty
my $appserver = 'IBMT42';

#set these if you want to skip some components
my $exludeshutdown = 0;
my @excludecomps = "SRProc";

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

$error_string = $entobj->appservercompsnotrunning($appserver,$exludeshutdown, @excludecomps);
print $error_string;

if ($error_string)  {
    $retval = 0;   # must set $retval to 0 if there are any appservercompsnotrunning (returns a string of errors)
} else {
    $retval = 1;