DMI 2.0 code samples

Generating and consuming indications

This section demonstrates how the sample program event2 generates an event and sends an indication (or notification message) to the DMI SP that an event occurred. The SP passes the indication to a management application registered to receive indications, which then processes it.

As rma2 is not registered to receive any indications, this section also introduces the management application, indcons, which is registered to receive indications as defined in the accompanying indcons.inp data file.

NOTE: To help distinguish between the output of event2 and indcons, we recommend that you run each program in a separate window.

  1. Make certain that you are running as root and that the phonebook MIF is installed; this will have been done if the phonebook sample has previously been run on the machine.

  2. To generate an event in isolation and send an indication to the SP, go to the first window and enter:

    cd /usr/src/dmi/samples/CI_support/event2

    The following message should appear:

    DmiOriginateEvent() returned status 0x0

    NOTE: If the DmiOriginateEvent function returns a value other than 0x0, refer to the DMI 2.0 error codes listed in /usr/include/dmi/dmi2err.h for more information.

  3. To move to the indcons directory where a data file needs to be set up, go to the second window and enter:

    cd /usr/src/dmi/samples/MA_support/indcons

    Among the files in this directory is defAddr.txt, which holds details of the machine (or indication originator) indcons is to manage, using the following format:




    NOTE: defAddr.txt must be in the same directory as the indcons program binary.

  4. To change the IP_address in defAddr.txt, edit the last line of the file to the IP address of the managed machine on which you are running event2.

    The file should now look something like:


  5. To run indcons, a process that listens for SP indications, enter:

    ./indcons indcons.inp &

  6. To generate an event that produces an indication for indcons to process, return to the first window and enter:

    cd /usr/src/dmi/samples/CI_support/event2

    In the first window you should see the following output:

    DmiOriginateEvent() returned status 0x0

    (This is the same message you saw before, generated by event2.)

    In the second window you should see a large amount of data, generated by the indcons process, illustrating the kind of data that can be transferred by an indication. An extract is shown below:

    Language     : 'en|US|iso8859-1' (len=16)
    Component Id : 2
    Time         : 1998:08:11:16:15:19:.:25    :+:000:***:
    Row Data     : (size=1)

    COMPID : 2 GROUPID : 2001 CLASS NAME : 'EventGeneration|Phone Book|001' (len=31) Key List : (size=1) Id : 5 Value : STRING : 'EventGeneration|Phone Book|001' (len=31)


    Values List: (size=6) Id : 1 Value : MIF_INTEGER : 0 ...

  7. To kill the indcons process, enter:

    kill -2 process_ID.

  8. To display a usage summary of event2 command line options, return to the first window and enter:

    ./event2 -?

    You can use these options to generate events of varying severity and type, and for different components.

    NOTE: For further information on developing components and management applications that use events and indications, examine the indcons and event2 source code.

Next topic: Registering and filtering indications
Previous topic: Creating and managing attribute tables

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004