UNSOLVED

choefing

updated

16 years ago

C

choefing

1 Rookie

49 Posts

0

3040

May 25th, 2010 20:00

Perl - multiple observers for different sessions

Hi all,

I wrote a perl script whichs intention is to create (dummy) notifications (without relation to a physical host) depending on a certain number of host going down. It should be that flexible, that it also acknowledges / clears these (dummy) notification in case of decreasing counter below treshold of dead hosts by acknowledging them (or even unacknowledge the notifications in case of unack the dead hosts).

The first part works like a charm, e.g. >=10 hosts down --> notification pops up and vanishes as soon as counter is <10.

Problem began as is wanted to connect a 2nd observer.

From how I understand the problem, i have to connect to IPM to get the events from the cretain hosts and invoke my commands to raise a notification.

Next step now would be to "observe" the notifications, which were raised bei the dead host itself and observe "ATTR_CHANGE" of the "Acknowledged" attribute. This has to be done on the SAM server.

Please have a look on the following snipplet:

# subscribe to IPM server, start observer and subsribe to every Host-related notification

my $session_IPM = &session_Start('IPM_server');
my $observer_IPM = $session_IPM->observer();
$session_IPM->subscribe( "Host", ".*", ".*" );

#  subscribe to SAM server, start observer and subsribe to every ICS_Notification

my $session_SAM = &session_Start('SAM_server");
my $observer_SAM = $session_SAM->observer();
$session_SAM->subscribe( "ICS_Notification", ".*", ".*" );

my %HASH = ();

while ( 1 ) {

                my @event_SAM = $observer_IPM->receiveEvent(60);
                my @event_IPM = $observer_SAM->receiveEvent(60);

                if ( @event_SAM || @event_IPM ) {
                                # just print everything I receive for debugging
                                print join( "|", @event_SAM)."\n";
                                print join( "|", @event_IPM)."\n";

                };

};

Ok, maybe it's time now to point to my problem:

As soon as I insert the 2nd observer (or more precise start receiving events for the 2nd observer) the timeout of 60 seconds from the first receiveEvent delays the second one and vice versa.

I'm not quite sure what happens with events on SAM-observer whilst IPM-observer is waiting for its timeout. Are they simply not recognized or will they just be delayed as well ? May this delay my dummy notifications up to 20 minutes or even more ?

Of course I can set timeout to 250ms or even 100ms but I also don't know if this stresses the system more than it needs. At least, for every timeout a noop() is written to the appropriate logfile.

It's either a perl or perlAPI related question.. but if somebody would shed a light I'll be glad.

Is there a way to "observe" or "get events" parallel ?

Maybe it's a selfmade failure by design ? I think there is no other way. A "Host" on an IPM Server has no entry for Ack-status, its an attribute of its notification and notifications are raised on SAM server. Notify/Clear will be invoked against the Host on IPM what triggers the notification for that particular one.

Thanks in advance

Christian