noelgolding

updated

15 years ago

0

3112

August 10th, 2011 06:00

clear momentary notification

sm_service:

linux-x86_64_64BIT/206090000

SAM_SUITE: V8.1.0.6/64(103203), 10-Dec-2010 14:50:37 Copyright 1995-2010, EMC Corporation - Build 52

Foundation V7.2.0.1/64(101210), 18-Sep-2010 14:44:40 Copyright 1995-2010, EMC Corporation - Build 143

Is it possible to clear a MOMENTARY notification via the Perl API?

I have successfully created a notification like so:

######## START SNIPPET ########

my $systemClass = 'Host';

my $systemName = 'myTestHostName';

my $strEventName = 'SchedMaint';

$notificationFactory = $session->object("ICS_NotificationFactory", "ICS-NotificationFactory");

my $notification = $notificationFactory ->findNotification($systemClass, $systemName, $strEventName);
if ($notification eq "") {
   eval {
      $schedMaintNotiObj = $notificationFactory ->makeNotification($systemClass, $systemName, $strEventName);
   } or do {
      die("MakeNotificationException:\n$@")
   };
}
my $currentTime = time;

my $auditLogEntry = 'Maint window created';

$session->object($notification)->{EventType}  = "MOMENTARY";

$session->object($notification)->{EventText}  = "Setting Host In Maintenance";

$session->object($notification)->{EventName} = $strEventName;

$session->object($notification)->{OccurredOn}  = $systemName;

$session->object($notification)->{Severity} = 5;

$session->object($notification)->{InMaintenance} = 1;

$session->object($notification)->invoke("notify", "maint", 'INCHARGE-SA', $auditLogEntry, $currentTime, 9000, " ", 1, "MOMENTARY");

$session->object($notification)->takeOwnership("maint");

$session->object($notification)->changed();

######## END SNIPPET ########

I have tried to clear this event with the following code sample to no avail.

######## START SNIPPET ########

$session->object($systemClass, $systemName)->clear($strEventName);

######## END SNIPPET ########

Any help is greatly appreciated.