UNSOLVED

sudoer1

updated

17 years ago

S

sudoer1

3 Posts

0

1575

June 14th, 2009 18:00

syntax and description of notify() in asl

I see a function is asl ref guide called notify(). There is not much description about what parameters are to be passed or what this function does. I assume its going to create a notification - thats what I'm trying to do in an asl script. I passed
notify("ClassName", "InstanceName", "Down") - complains incorrect number of arguments. Any clues? Thanks


I'm using sm_ems to create a notification such as,
./sm_ems -s server notify Class instance Stopped xxx momentary source severity=1

I would rather do the same thing with an asl and trying to use notify() function.
  • Berkay1

    36 Posts

    706

    0

    Posted June 15th, 2009 01:00

    notify command in asl and the sm_ems notify are NOT related. Not sure what the notify() is used for in ASL but it is not for creating notifications.

    To create a notification, you need to use ICS_NotificationFactory class makeNotification operation.

    Hope this helps,

    Regards,
    Berkay Mollamustafaoglu
    RapidInsight: EMC Smarts 2008 Offering of the Year Award Winner
    http://www.ifountain.com
  • TCorcoran

    53 Posts

    706

    0

    Posted June 25th, 2009 10:00

    Same syntax in ASL by the way...

    RouterRef=object("Router", "RouterName")
    RouterRef->notify("Down")


    - TC
  • TCorcoran

    53 Posts

    706

    0

    Posted June 25th, 2009 10:00

    Berkay,

    That is not correct. The notify primitive will create a notification as well based upon the MODEL description of the object.

    For instance, "Router" has a "Down" notification available, so

    $RouterRef->notify("Down");

    would create a down notification for the referenced router.

    - TC
  • 706

    0

    Posted June 25th, 2009 12:00

    Hi TC,

    Berkay is actually right. Notify an event (in a domain manager) and notify a notification (in SAM/OI) are two different things. Yes, you can use notify in a Domain Manager to raise an event (even if this is not really recommended as the event is in general based on instrumented attributes; in production it's better to change the corresponding attribute). But if you want to mimic sm_ems (which is working at SAM/OI layer) to create notifications with the Java or PERL API, you have to use the NotificationFactory to do so.

    My 2 cents,

    --Fred

    == Monitor your Smarts environment using APG ReportPack for Smarts health ==
    Frederic Meunier
    Solutions Watch4Net Inc
    APG & Smarts InCharge integration
    http://www.watch4net.com
  • Hemulll

    2 Intern

    •

    138 Posts

    706

    0

    Posted June 25th, 2009 17:00

    Hi all,

    example for notify via perl with sub.

    sub Notify{
    my ($class, $name, $eventName, $elementClassName, $elementName,
    $instanceName, $eventText, $eventSeverity, $category,
    $Domain)=@_;
    my $notifObj="Test";
    $factory=$session->object("ICS_NotificationFactory", "ICS-NotificationFa
    ctory");
    $notification = $factory->findNotification($class,$name,$eventName);
    $notifObj=$session->object($notification);

    #if (!$notification)
    #{
    $notification=$factory->makeNotification($class, $name, $eventNa
    me, "ICS_Notification");
    $notifObj=$session->object($notification);

    $notifObj->{InstanceDisplayName} = $instanceName;
    $notifObj->{InstanceName} = $instanceName;
    $notifObj->{Certainty} = 100;
    $notifObj->{EventText} = $eventText;
    $notifObj->{Severity} = $eventSeverity;
    $notifObj->{Category} = $category;
    $notifObj->{OccurredOn} = "$class::$name";
    $notifObj->{EventType} = "DURABLE";
    $notifObj->insertElement("NotifiedBy", "InChargeDomain::
    InChargeDomain_$Domain" );

    $notifObj->invoke("notify","DXA","omsk-sam","Notify from Perl-AP
    I",0);
    $notifObj->changed();
    #}

    }