DMI 2.0 code samples

Registering and managing components

This section demonstrates how you can use the sample programs hellodmi and rma2 to:

NOTE: For a full list of rma2 command options, syntax, and arguments, enter:

cd /usr/src/dmi/samples/MA_support/rma2
./rma2  -?

To register and manage a single DMI component using the sample programs:

  1. Go to the hellodmi directory and run the sample program:

    cd /usr/src/dmi/samples/CI_support/hellodmi
    ./hellodmi &

    The process registers a DMI component, waits for SP calls, then terminates after 10 minutes.

  2. Go to the rma2 directory and list the currently registered components on your system:

    cd /usr/src/dmi/samples/MA_support/rma2
    ./rma2 -x ListComponents

    Both the DMI Service Layer (which always appears when the service provider is running) and the hellodmi components should be listed as follows:

    Content=Component List

    StartComponentInfo Name=UnixWare DMI Service Layer ComponentID=1 EndComponentInfo

    StartComponentInfo Name=Hello, DMI ComponentID=2 EndComponentInfo ...

    NOTE: On your system, certain values (such as ComponentID) may differ from those shown in this README's sample command lines and accompanying output.

  3. List the group information for hellodmi using its ComponentID value:

    ./rma2 -x ListGroups -c 2

    NOTE: On your system, if the ComponentID for ``Hello, DMI'' is not shown as ``2'', substitute your system's value in the command line option -c 2 above.

    You should see the following:

    Content = Group List
    ComponentName=Hello, DMI

    StartGroupInfo Name=ComponentID GroupID=1 Class=DMTF|ComponentID|001 EndGroupInfo

    StartGroupInfo Name=Sample group GroupID=10 Class=SCO|Hello, DMI Sample|001 EndGroupInfo

    Every component has one group containing the ComponentID, followed by all the groups used to organize the product's manageable attributes. In this example there is one other group, with a GroupID of ``10'' and the name ``Sample Group''.

  4. List the attributes (and their values) for hellodmi group ``10'':

    ./rma2 -x ListAttributes -c 2 -g 10 -v

    You should see the following:

    Content = Attribute List
    ComponentName=Hello, DMI
    GroupName=Sample group

    Name=greetings AttributeID=1 Access=Read-Write Type=DisplayString(64)

    StartValue Greetings from CI! EndValue End

    NOTE: This single attribute has read-write access and can therefore be altered by management applications such as rma2.

  5. Change the contents of the hellodmi ``greetings'' attribute:

    ./rma2 -x SetAttribute -c 2 -g 10 -a 1 -v "Hello from SCO!"

    NOTE: The sample ``greetings'' attribute, as well as having read-write access, is classified as dynamic (or instrumented). DMI dynamic attribute values are not taken from the MIF file, but are provided by the component's instrumentation code. In this example, the attribute's new value is stored in memory by the hellodmi program and is lost when this program terminates.

Next topic: Creating and managing attribute tables
Previous topic: Management application (MA) samples

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