#
Welcome to the Sun Management Center Developer Environment

Note:
  All of the examples shown here assume Sun Management Center is installed in the default location (/opt). If it is installed in a different location, then "/opt" should be substituted by that location.

### Table of Contents

- Developer Environment Document (HTML Format)

- Developer Environment Document (Postscript Format)

- Developer Environment Document (PDF Format)

- Client API Specification

- Client API Examples -- examples showing how to use the Client API.

- Console Integration Notes -- additional notes about integrating applications into the Console.

- Console Integration Example: Integrating with the Tools Menu and Applications Tab

- Console Integration Example: Static Menu

- Console Integration Example: Dynamic Menu & Cell Editor

- Console Integration Example: Configuring Details Window Tabs

- Module Example: Helloworld_01 is a minimal Hello World example for new module writers.

- Module Example: Helloworld_02 is an extension of the above example that uses Tcl/C packages for populating the module data.

- Module Example: Helloworld_03 is an extension of Helloworld_01 that uses external shell scripts for data acquisition.

- Module Example: Helloworld_04 is an extension of the above example that uses Table for data modeling and has alarm checks on the table fields.

- Module Example: MibDemo is an example that uses the mib2x tool for generating the data model file for the module from a SNMP MIB file.

- Service Example: Device Modeling

- Service Example: Creating a Composite Object

### Client API Examples

These examples show how to use the Client API.

Making and installing the Client API examples:

    	Build the examples by typing:

    	% mkdir ~/de_examples
    	% cp -r /opt/SUNWsymon/sdk/examples ~/de_examples

    	% cd  ~/de_examples/examples/client
    	% make

    	Run a client API example as follows:

    	% runTest <testname> <args>

To Top

### Console Integration Notes

- If an application that is integrated into the console fails to launch, an error message will be printed to the Console Messages window only. No other user feedback is visible. Hence if the user application should fail to launch, the user should check the Console Messages window for error messages. To see these messages, select "File -> Sun Management Center-Console Messages..." from the Sun Management Center main console window.

- Properties files should go into the same directory as the class files.

- Note: The user application runs in the same JVM as the Console. Therefore if the application calls System.exit(), then this will result in the the Console exiting as well. Likewise, if the user application crashes, then this will cause the Console to crash as well.

To Top

### Console Integration Example: Integrating with the Tools Menu and Applications Tab

This example demonstrates two different types of console integration. First, it demonstrates integrating applications into the "Tools" menu on the Sun Management Center main console window. Second, it demonstrates integrating applications into the "Applications" tab in the Sun Management Center Details Window. These integrated applications are installed on the Sun Management Center server and are available for all agents that are connected to that server.

#### The following subsections describe how to use this example:

- Contents
- Building this Example
- Installing this Example
- Using this example with Sun Management Center
- Unloading this Example

#### Contents

> This example consists of the following java integration files that are installed on the server:

            ExampleGUITool.java
            ExampleModuleApp.java
            ExampleSystemCommand.java
            ExampleModuleApp.properties
            ExampleSystemCommand.properties

#### Building this Example

    	% mkdir ~/de_examples
    	% cp -r /opt/SUNWsymon/sdk/examples ~/de_examples
    	% cd  ~/de_examples/examples/console/exampleApp
    	% make

#### Installing this Example

> To install this example, do the following on the Sun Management Center server machine:

    	% cd  ~/de_examples/examples/console/exampleApp/package
    	% su
    	# pkgadd -d . DEMOesce1

> Finish by executing the following commands:

    	# cd  ../../cfg
    	# cp console-tools.cfg /var/opt/SUNWsymon/cfg/console-tools.cfg
    	# /opt/SUNWsymon/sbin/es-tool /var/opt/SUNWsymon/cfg/console-tools.cfg
    	# cp console-host-apps.cfg /var/opt/SUNWsymon/cfg/console-host-apps.cfg
    	# /opt/SUNWsymon/sbin/es-apps /var/opt/SUNWsymon/cfg/console-host-apps.cfg

> Note: The above commands could be included in the package postinstall script. In this example, they are manual steps to highlight the work necessary to install this example.

#### Using this example with Sun Management Center

> Stop and restart any open Sun Management Center console windows.

> Tools Menu

> After installing this example, there are now three new menu options in the "Tools" menu on the Sun Management Center main console window. These include "Example GUI", "Rlogin", and "FTP".

> Select an agent and select "Tools -> Example GUI" menu choice and a pop-up will be displayed that will display the modules available on that agent.

> Select an agent and select "Tools -> Rlogin" menu choice and a pop-up will be displayed that will contain an rlogin session for that agent machine.

> Select an agent and select "Tools -> FTP" menu choice and a pop-up will be displayed that will allow the user to FTP into that agent machine.

> Note: The ExampleSystemCommand wrapper class is only an example and specifically written for the FTP example. This class requires "$host" to be present in at least one of the arguments to the class in the console-tools.cfg file. It also requires a node to be selected before the application is launched. SMSystemCommand is the one that users should actually use for their applications.

> Applications Tab

> After installing this example, there are now two new applications integrated into the "Applications" tab for agents connected to this server. These include "All Modules" and "Loaded Modules"

> Selecting "All Modules" shows the modules that are currently available on that agent machine.

> Selecting "Loaded Modules" shows the modules that are currently loaded on that agent machine.

#### Unloading this example

> To unload this example, do the following on the Sun Management Center server machine:

    	% cd  ~/de_examples/examples/console/exampleApp/package
    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
    	# pkgrm DEMOesce1
            # /bin/rm /var/opt/SUNWsymon/cfg/tools-extension-j.x
            # /bin/rm /var/opt/SUNWsymon/cfg/details-applications-j.x
    	# /opt/SUNWsymon/sbin/es-start -a

> Stop and restart any open Sun Management Center console windows.

To Top

### Console Integration Example: Static Menu

The Static Menu interface provides a method for customizing the popup menus for a specific module in the Browser tab in the Sun Management Center Host Details Window. Users are allowed to add menu choices for the module, any managed object or table cell within the module. These menu choices are considered static because they are hardcoded within the module files.

When the user selects a new menu choice, a Java program provided by the user is launched. The Java program is provided contextual information when it is launched so that it can determine which object the user's mouse was over when the program was launched. This is used in this example to display the cell value that the mouse was hovering over when the user selects the "Table Context Example" menu choice.

#### The following subsections describe how to use this example:

- Contents
- Building this Example
- Installing this Example
- Using this example with Sun Management Center
- Unloading this Example

#### Contents

> This example consists of the following .x files that are installed on the agent:

            staticmenu-version01-d.x
            staticmenu-version01-m.x
            staticmenu-version01-models-d.x

> The following is the shell script that is installed on the agent:

    	staticmenu-version01.sh

> The following are the java integration files that are installed on the server:

            SMContextExample.java
            SMHello.java

#### Building this Example

    	% mkdir ~/de_examples
    	% cp -r /opt/SUNWsymon/sdk/examples ~/de_examples
    	% cd  ~/de_examples/examples/console/StaticMenu/agent_package
    	% make
    	% cd  ~/de_examples/examples/console/StaticMenu/server_package
    	% make

#### Installing this Example

> To install the agent component of this example, do the following on the Sun Management Center agent machine:

    	% cd  ~/de_examples/examples/console/StaticMenu/agent_package/package
    	% su
            # pkgadd -d . DEMOessma

> To install the server component of this example, do the following on the Sun Management Center server machine:

    	% cd  ~/de_examples/examples/console/StaticMenu/server_package/package
    	% su
            # pkgadd -d . DEMOessms

#### Using this example with Sun Management Center

> If the Sun Management Center agent is already running on the machine where the DEMOessma agent package was installed, then restart the Sun Management Center agent on that machine with the following commands:

    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
    	# /opt/SUNWsymon/sbin/es-start -a
    	# exit

> Stop and restart any open Sun Management Center console windows.

> From the Sun Management Center console invoke the module load window for the agent where the DEMOessma agent package was installed.

> From the list of modules, select the Static Menu Module and load it.

> You can now observe that the Static Menu Module is loaded under Local Applications.

> Right click while the mouse is over the Static Menu module. You will notice the additional menu choices "Static Menu Example" and "Module Context Example".

> The "Static Menu Example" causes the SMHello.class to be executed displaying the "Hello World" popup. Click the "Close" button to close this popup. The "Module Context Example" causes the SMContextExample.class to be executed displaying the "Context Example" popup. Click the "Close" button to close this popup.

> Within the module, right click while the mouse is over the "Static Menu Managed Object". You will notice the additional menu choice "Managed Object Context Example". This choice causes the SMContextExample.class to be executed displaying the "Context Example" popup. Click the "Close" button to close this popup.

> Within the "Static Menu Managed Object", right click while the mouse is over any table cell in the "Static Menu Table". You will notice the additional menu choice "Table Context Example". This choice causes the SMContextExample.class to be executed displaying the "Context Example" popup. Click the "Close" button to close this popup.

> These menu choices are called "static" because the choices are defined statically in the "staticmenu-version01-d.x" module file.

#### Unloading this example

> To unload this example, go to the Sun Management Center Details window for the agent where the DEMOessma package was installed. Under the Browser tab, right click over the Static Menu module and choose "Unload".

> Then, do the following on the Sun Management Center agent machine where the DEMOessma package was installed:

    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
            # pkgrm DEMOessma
    	# /opt/SUNWsymon/sbin/es-start -a

> Finally, do the following on the Sun Management Center server machine:

    	% su
            # pkgrm DEMOessms

> Stop and restart any open Sun Management Center console windows.

To Top

### Console Integration Example: Dynamic Menu & Cell Editor

The Dynamic Menu interface provides a method for customizing the popup menus for a specific module in the Browser tab in the Sun Management Center Host Details Window. Users are allowed to add menu choices for any table cell or table column header within a module. These menu choices are considered dynamic because they are built by the Java program provided by the user.

When the user selects a new menu choice, a Java program provided by the user is launched. The Java program is provided contextual information when it is launched so that it can determine which object the user's mouse was over when the program was launched. This is used in this example to display a range of information about the table cell or table column header that the mouse was hovering over when the user selects one of the choices added by this example.

This example also demonstrates the Cell Editor interface. This allows users to enter data values directly into a managed property within a module. Provided with the Sun Management Center application are a text editor, an integer editor, a floating-point editor, a boolean (checkbox) editor, and a combo box editor. The user is also allowed to extend any of these editors to define their own custom cell editor. This example demonstrates these various types of cell editors.

#### The following subsections describe how to use this example:

- Contents
- Building this Example
- Installing this Example
- Using this example with Sun Management Center
- Unloading this Example

#### Contents

> This example consists of the following .x files that are installed on the agent:

            dynamicmenu-version01-d.x
            dynamicmenu-version01-m.x
            dynamicmenu-version01-models-d.x

> The following is the shell script that are installed on the agent:

    	dynamicmenu-version01.sh

> The following are the java integration files that are installed on the server:

            SMCustomCellEdit.java
            SMDynamicMenu.java

#### Building this Example

    	% mkdir ~/de_examples
    	% cp -r /opt/SUNWsymon/sdk/examples ~/de_examples
    	% cd  ~/de_examples/examples/console/DynamicMenu/agent_package
    	% make
    	% cd  ~/de_examples/examples/console/DynamicMenu/server_package
    	% make

#### Installing this Example

> To install the agent component of this example, do the following on the Sun Management Center agent machine:

    	% cd  ~/de_examples/examples/console/DynamicMenu/agent_package/package
    	% su
            # pkgadd -d . DEMOesdma

> To install the server component of this example, do the following on the Sun Management Center server machine:

    	% cd  ~/de_examples/examples/console/DynamicMenu/server_package/package
    	% su
            # pkgadd -d . DEMOesdms

#### Using this example with Sun Management Center

> If the Sun Management Center agent is already running on the machine where the DEMOesdma agent package was installed, then restart the Sun Management Center agent on that machine with the following commands:

    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
    	# /opt/SUNWsymon/sbin/es-start -a
    	# exit

> Stop and restart any open Sun Management Center console windows.

> From the Sun Management Center console invoke the module load window for the agent where the DEMOesdma agent package was installed.

> From the list of modules, select the Dynamic Menu Module and load it.

> You can now observe that the Dynamic Menu Module is loaded under Local Applications. Within this module are two folders "Editable Cell Example" and "Dynamic Menus Example". The "Editable Cell Example" folder demonstrates the Cell Editor feature by allowing users to enter data values directly into the following managed properties:

> Table Cell Text | Allows users to enter any text string.
> Table Cell Int | Allows users to enter any integer value.
> Table Cell Float | Allows users to enter any floating point value.
> Table Cell Boolean | Allows users to enter a boolean value.
> Table Cell Combo | Allows users to enter a value from a combo box. The choices are specified in the module file "dynamicmenu-version01-d.x".
> Custom Must Begin with A | Customized cell editor implemented by the SMCustomCellEdit.class. Only allows users to enter a text string that begins with the letter "A" (case insensitive).

> When the user clicks directly on an editable cell, the cell transforms into a widget that allows the user to enter the value. The application will beep and reject any invalid value.

> The "Dynamic Menus Example" folder demonstrates the Dynamic Menus feature. While the mouse is over any table cell in the "Dynamic Menu Example", right click while the mouse is over any table cell or table column header. You will notice the following additional menu choices:

> - Choice 1
> - Choice 2
> - Choice 3
> - Choice 4

> These menu choices are called "dynamic" because the choices are built dynamically by the SMDynamicMenu.class. Selecting any of these choices causes the ActionListener defined in the SMDynamicMenu.class to be executed displaying the "Dynamic Menu Example" popup. Click the "Close" button to close this popup.

#### Unloading this example

> To unload this example, go to the Sun Management Center Details window for the agent where the DEMOesdma package was installed. Under the Browser tab, right click over the Dynamic Menu module and choose "Unload".

> Then, do the following on the Sun Management Center agent machine where the DMEOesdma package was installed:

    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
            # pkgrm DEMOesdma
    	# /opt/SUNWsymon/sbin/es-start -a

> Finally, do the following on the Sun Management Center server machine:

    	% su
            # pkgrm DEMOesdms

> Stop and restart any open Sun Management Center console windows.

To Top

### Console Integration Example: Configuring Details Window Tabs

This example demonstrates how to configure the tabs within the Sun Management Center Details Window for a given Node_Object_Type. Users may specify which of the tabs provided by Sun Management Center are available for this object. Users may also add their own custom tabs. When a user selects a custom tab, a Java program provided by the user is launched.

Users may only modify the tabs for Node_Object_Types that were created with the es-device script. First installing the Service Example: Device Modeling will suffice.

#### The following subsections describe how to use this example:

- Contents
- Building this Example
- Installing this Example
- Using this example with Sun Management Center
- Unloading this Example

#### Contents

> This example consists of the following java integration file that is installed on the server:

            SMTabHello.java

#### Building this Example

    	% mkdir ~/de_examples
    	% cp -r /opt/SUNWsymon/sdk/examples ~/de_examples
    	% cd  ~/de_examples/examples/console/DetailsTab
    	% make

#### Installing this Example

> To install this example, do the following on the Sun Management Center server machine:

> Step 1

    	% cd  ~/de_examples/examples/console/DetailsTab/package
    	% su
            # pkgadd -d . DEMOesdt1

> Step 2

> Run the es-details program on the Sun Management Center server machine. In the following command replace the Node_Object_Type value with the value for the modeled agent to be modified. If the Node_Object_Type to be affected was created by installing the "Device Modeling" example, then this value would be "MyServer".

    	# cd  ~/de_examples/examples/console/DetailsTab
            # /opt/SUNWsymon/sbin/es-details -n Node_Object_Type -f inputfile -o

> The inputfile specifies that the device should contain the following tabs provided by Sun Managment Center: Browser, Alarms, Modules, Applications, Hardware, and Viewlog. The inputfile also appends the custom tab "TabHello" for the device. When this custom tab is selected, the SMTabHello.class is executed. The inputfile specifies that the "Hello World" tab is the default tab. This means that this will be the tab that is open when the Details Window is first opened.

> Note: The above es-details command could be included in the package postinstall script. In this example, they are manual steps to highlight the work necessary to install this example.

#### Using this example with Sun Management Center

> Stop and restart any open Sun Management Center console windows.

> From the Sun Management Center console invoke the Host Details Window for a host with the same Node_Object_Type that was specified when the es-details program was executed. Only those tabs specified in the inputfile (including the "Hello World" tab) should be visible in the Details Window.

#### Unloading this example

> To unload this example, do the following on the Sun Management Center server machine. In the following command replace the Node_Object_Type value with the value for the modeled agent to be modified. If the Node_Object_Type to be affected was created by installing the "Device Modeling" example, then this value would be "MyServer".

    	% cd  ~/de_examples/examples/console/DetailsTab
    	% su
            # pkgrm DEMOesdt1
            # /opt/SUNWsymon/sbin/es-details -n Node_Object_Type -u

> Stop and restart any open Sun Management Center console windows.

To Top

### Module: Hello World 01

This module is minimal example for module writing. To make things simpler, this module does not have any internationalization code.

#### The following subsections describe how to use this example:

- Contents
- Building & Installing Helloworld_01
- Using the Helloworld_01 module with Sun Management Center
- Unloading this Example

#### Contents

> This example consists of the following .x files that are installed on the agent:

    	helloworld-version01-d.x
    	helloworld-version01-m.x
    	helloworld-version01-models-d.x

#### Building & Installing Helloworld_01

    	% mkdir ~/de_examples
    	% cp -r /opt/SUNWsymon/sdk/examples ~/de_examples
    	% cd  ~/de_examples/examples/modules/helloworld_01
    	% make
            % cd package
    	% su
    	# pkgadd -d . DEMOeshw1

#### Using the Helloworld_01 module with Sun Management Center

> If the Sun Management Center agent is already running on the machine where the DEMOeshw1 agent package was installed, then restart the Sun Management Center agent on that machine with the following commands:

    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
    	# /opt/SUNWsymon/sbin/es-start -a
    	# exit

> From the Sun Management Center console invoke the module load window for the agent where the DEMOeshw1 agent package was installed.

> From the list of modules, select the Helloworld_01 module and load it.

> You can now observe that the Helloworld_01 module is loaded under Local Applications.

#### Unloading this example

> To unload this example, go to the Sun Management Center Details window for the agent where the DEMOeshw1 package was installed. Under the Browser tab, right click over the Helloworld_01 module and choose "Unload".

> Then, do the following on the Sun Management Center agent machine where the DEMOeshw1 package was installed:

    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
            # pkgrm DEMOeshw1
    	# /opt/SUNWsymon/sbin/es-start -a

> Stop and restart any open Sun Management Center console windows.

To Top

### Module: Hello World 02

This module uses a Tcl/C package for registering a Tcl Command with the Sun Management Center agent. When the Tcl Command is called, it uses a C library routine to get the data for the Hello World string.

#### The following subsections describe how to use this example:

- Contents
- Building & Installing Helloworld_02
- Using the Helloworld_02 module with Sun Management Center
- Unloading this Example

#### Contents

> As in the earlier example, the following are the .x files that are used in this example and are installed on the agent:

    	helloworld-version01-d.x
    	helloworld-version01-m.x
    	helloworld-version01-models-d.x

> The following are the files that make the Tcl/C package that are installed on the agent:

    	pkgdemohw2.c
    	pkgdemohw2.h

> The following files make the C library that is called by the Tcl/C package for the Hello World string and are installed on the agent:

    	demohw2.c
    	demohw2.h

#### Building & Installing Helloworld_02

> The Helloworld_02 example contains source code that is compiled with a C compiler. It is recommended that a variant be compiled for each Solaris release for which the module will be deployed.

> The makefile supplied with this example will automatically determine which Solaris release is running at the time the make utility is executed. A subdirectory is automatically created (i.e. 2.5, 2.6, 2.7) that will be the location for the derived object files and libraries

    	% mkdir ~/de_examples
    	% cp -r /opt/SUNWsymon/sdk/examples ~/de_examples
    	% cp -r /opt/SUNWsymon/sdk/include ~/de_examples
    	% cd  ~/de_examples/examples/modules/helloworld_02
    	% make
    	% cd package/[ 2.5 | 2.6 | 2.7 ]
    	% su
    	# pkgadd -d . DEMOeshw2

#### Using the Helloworld_02 module with Sun Management Center

> If the Sun Management Center agent is already running on the machine where the DEMOeshw2 agent package was installed, then restart the Sun Management Center agent on that machine with the following commands:

    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
    	# /opt/SUNWsymon/sbin/es-start -a
    	# exit

> From the Sun Management Center console invoke the module load window for the agent where the DEMOeshw2 agent package was installed.

> From the list of modules, select the Helloworld_02 module and load it.

> You can now observe that the Helloworld_02 module is loaded under Local Applications.

#### Unloading this example

> To unload this example, go to the Sun Management Center Details window for the agent where the DEMOeshw2 package was installed. Under the Browser tab, right click over the Helloworld_02 module and choose "Unload".

> Then, do the following on the Sun Management Center agent machine where the DEMOeshw2 package was installed:

    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
            # pkgrm DEMOeshw2
    	# /opt/SUNWsymon/sbin/es-start -a

> Stop and restart any open Sun Management Center console windows.

To Top

### Module: Hello World 03

This module uses an external shell script for data acquisition. The script is part of the source.

#### The following subsections describe how to use this example:

- Contents
- Building & Installing Helloworld_03
- Using the Helloworld_03 module with Sun Management Center
- Unloading this Example

#### Contents

> This example consists of the following .x files that are installed on the agent:

    	helloworld-version03-d.x
    	helloworld-version03-m.x
    	helloworld-version03-models-d.x

> The following is the shell script which is installed on the agent:

    	helloworld-version03.sh

#### Building & Installing Helloworld_03

    	% mkdir ~/de_examples
    	% cp -r /opt/SUNWsymon/sdk/examples ~/de_examples
    	% cd  ~/de_examples/examples/modules/helloworld_03
    	% make
            % cd package
    	% su
    	# pkgadd -d . DEMOeshw3

#### Using the Helloworld_03 module with Sun Management Center

> If the Sun Management Center agent is already running on the machine where the DEMOeshw3 agent package was installed, then restart the Sun Management Center agent on that machine with the following commands:

    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
    	# /opt/SUNWsymon/sbin/es-start -a
    	# exit

> From the Sun Management Center console invoke the module load window for the agent where the DEMOeshw3 agent package was installed.

> From the list of modules, select the Helloworld_03 module and load it.

> You can now observe that the Helloworld_03 module is loaded under Local Applications.

#### Unloading this example

> To unload this example, go to the Sun Management Center Details window for the agent where the DEMOeshw3 package was installed. Under the Browser tab, right click over the Helloworld_03 module and choose "Unload".

> Then, do the following on the Sun Management Center agent machine where the DEMOeshw3 package was installed:

    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
            # pkgrm DEMOeshw3
    	# /opt/SUNWsymon/sbin/es-start -a

> Stop and restart any open Sun Management Center console windows.

To Top

### Module: Hello World 04

This module introduces tables and alarm checks.

#### The following subsections describe how to use this example:

- Contents
- Building & Installing Helloworld_04
- Using the Helloworld_04 module with Sun Management Center
- Unloading this Example

#### Contents

> This example consists of the following .x files that are installed on the agent:

    	helloworld-version04-d.x
    	helloworld-version04-m.x
    	helloworld-version04-models-d.x

> The following is the shell script which is installed on the agent:

    	helloworld-version04.sh

#### Building & Installing Helloworld_04

    	% mkdir ~/de_examples
    	% cp -r /opt/SUNWsymon/sdk/examples ~/de_examples
    	% cd  ~/de_examples/examples/modules/helloworld_04
    	% make
            % cd package
    	% su
    	# pkgadd -d . DEMOeshw4

#### Using the Helloworld_04 module with Sun Management Center

> If the Sun Management Center agent is already running on the machine where the DEMOeshw4 agent package was installed, then restart the Sun Management Center agent on that machine with the following commands:

    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
    	# /opt/SUNWsymon/sbin/es-start -a
    	# exit

> From the Sun Management Center console invoke the module load window for the agent where the DEMOeshw4 agent package was installed.

> From the list of modules, select the Helloworld_04 module and load it.

> You can now observe that the Helloworld_04 module is loaded under Local Applications. To set the alarm limits for table fields, from the Sun Management Center Host Details Window select a field in any of the following columns:

>     	KBytes
>     	Used
>     	Available

> and bring up the Attribute editor. Select the alarm tab and set the alarm limits.

#### Unloading this example

> To unload this example, go to the Sun Management Center Details window for the agent where the DEMOeshw4 package was installed. Under the Browser tab, right click over the Helloworld_04 module and choose "Unload".

> Then, do the following on the Sun Management Center agent machine where the DEMOeshw4 package was installed:

    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
            # pkgrm DEMOeshw4
    	# /opt/SUNWsymon/sbin/es-start -a

> Stop and restart any open Sun Management Center console windows.

To Top

### Module: MIBdemo 01

This module exemplifies the way to generate a data model file (*-models-d.x) from an SNMP MIB. This data model file works in association with the following module parameters file and the data acquisition file, to complete the module.

#### The following subsections describe how to use this example:

- Contents
- Building & Installing Mibdemo_01
- Using the Mibdemo_01 module with Sun Management Center
- Unloading this Example

#### Contents

> This example consists of the following .x files that are installed on the agent:

    	essdk-mibdemo01-d.x
    	essdk-mibdemo01-m.x

> This example has the following MIB file, which will be given as an input to the mib2x utility for generating the models file:

    	essdk-mibdemo01.txt

> The following command in the file Makefile uses the mib2x utility to generate the models file from the mib file:

    	/opt/SUNWsymon/sbin/es-run mib2x
    		-f $(PWD)/essdk-mibdemo01.txt
    		-m module -r essdkDemoGroup
    		>essdk-mibdemo01-models-d.x

#### Building & Installing Mibdemo_01

    	% mkdir ~/de_examples
    	% cp -r /opt/SUNWsymon/sdk/examples ~/de_examples
    	% cd  ~/de_examples/examples/modules/essdk-mibdemo01
    	% make
    	% cd package
    	% su
    	# pkgadd -d . DEMOesmd1

#### Using the Mibdemo_01 module with Sun Management Center

> If the Sun Management Center agent is already running on the machine where the DEMOesmd1 agent package was installed, then restart the Sun Management Center agent on that machine with the following commands:

    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
    	# /opt/SUNWsymon/sbin/es-start -a
    	# exit

> From the Sun Management Center console invoke the module load window for the agent where the DEMOesmd1 agent package was installed.

> From the list of modules, select the Mibdemo_01 module and load it.

> You can now observe that the Mibdemo_01 module is loaded under Local Applications

#### Unloading this example

> To unload this example, go to the Sun Management Center Details window for the agent where the DEMOesmd1 package was installed. Under the Browser tab, right click over the Mibdemo_01 module and choose "Unload".

> Then, do the following on the Sun Management Center agent machine where the DEMOesmd1 package was installed:

    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
            # pkgrm DEMOesmd1
    	# /opt/SUNWsymon/sbin/es-start -a

> Stop and restart any open Sun Management Center console windows.

To Top

### Service Example: Device Modeling

This example demonstrates how to model a device. This example will model any existing Ultra workstation Sun Management Center agent. This redefines topological aspects of the object, including the icon definitions).

#### The following subsections describe how to use this example:

- Installing this Example
- Using this example with Sun Management Center
- Unloading this Example

#### Installing this Example

> Step 1

> Do the following step on the Sun Management Center agent machine that is to be modeled.

> Make a backup copy of the /var/opt/SUNWsymon/cfg/deviceinfo.conf file.

    	% su
    	# cp /var/opt/SUNWsymon/cfg/deviceinfo.conf /var/opt/SUNWsymon/cfg/deviceinfo.conf.bak

> The /var/opt/SUNWsymon/cfg/deviceinfo.conf file looks as follows for an Ultra-60 machine.

            DID             Sun-Ultra-60
            OID             1.3.6.1.4.1.42.2.12.3.1.6
            FAMILYTYPE      sun4u-Sun-Ultra-60

> Edit the /var/opt/SUNWsymon/cfg/deviceinfo.conf file an modify the values for "DID" and "FAMILYTYPE" to "MyServer" as follows:

            DID             MyServer
            [ ... ]
            FAMILYTYPE      MyServer

> Step 2

> Do the following step on the Sun Management Center server machine. The es-device program is used to model a machine. This program takes an input file which contains the model details. The input file for this example is the following file:

    	/opt/SUNWsymon/sdk/examples/services/device_modeling/MyServer.conf

> Note: The input file to es-device, MyServer.conf, contains a line that looks as follows:

            Hardware_Module Config-Reader4udt

> In order for the Physical View feature in the Hardware Tab of the Details window to work properly, the "Hardware_Module" value must be set properly. The value "Config-Reader4udt" works for any Ultra desktop workstation. For different types of machines, it will be necessary to modify this value appropriately for the platform. Otherwise the Physical View feature will not work properly.

> Note: The input file to es-device, MyServer.conf, assumes that the installation directory for Sun Management Center is "/opt/SUNWsymon". If it is installed in a different location, it will be necessary to edit the MyServer.conf file to specify the correct location of the GIF image files and the MyServerUser.properties file.

> Run the following commands:

    	% cd /opt/SUNWsymon/sdk/examples/services/device_modeling
    	% su
    	# /opt/SUNWsymon/sbin/es-device -a MyServer.conf

#### Using this example with Sun Management Center

> After completing both steps, restart the Sun Management Center agent machine that was modified in Step 1 above.

    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
    	# /opt/SUNWsymon/sbin/es-start -a
    	# exit

> Stop and restart any open Sun Management Center console windows.

> At this point, the agent has been modeled. If the topology already contains any instances of this object, it will be necessary to delete them from topology and re-add them to see the changes. After adding this agent to topology, it should now be considered a MyServer object and be visible with the new icon.

#### Unloading this Example

> To return the Sun Management Center agent to its original model, run the following commands on the Sun Management Center server machine:

    	% cd /opt/SUNWsymon/sdk/examples/services/device_modeling
    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
    	# /opt/SUNWsymon/sbin/es-device -d MyServer.conf
    	# cp /var/opt/SUNWsymon/cfg/deviceinfo.conf.bak /var/opt/SUNWsymon/cfg/deviceinfo.conf
    	# /opt/SUNWsymon/sbin/es-start -a

> Stop and restart any open Sun Management Center console windows.

> Again, if the topology contains any instances of this object, it will be necessary to delete them and re-add them to see the changes.

To Top

### Service Example: Creating a Composite Object

This example demonstrates how to create a composite object. The user can define a hierarchy of groups, modeled agents, agents, and/or modules. Once a composite object is properly defined, it can be added to the topology through using either a "Discovery Request" or by using "Edit -> Create an Object ..." from the Sun Management Center main console window.

#### The following subsections describe how to use this example:

- Contents
- Building this Example
- Installing this Example
- Using this example with Sun Management Center
- Unloading this Example

#### Contents

> This example consists of the following .x files that are installed on the agent:

            dot-d.prc
            dot-d.x
            dot-m.x
            dot-models-d.x
            dot.properties

> This example consists of the following properties files that are installed on the server:

            dot.properties

#### Building this Example

    	% mkdir ~/de_examples
    	% cp -r /opt/SUNWsymon/sdk/examples ~/de_examples
    	% cd  ~/de_examples/examples/services/discovery/agent_package
    	% make
    	% cd  ~/de_examples/examples/services/discovery/server_package
    	% make

#### Installing this Example

> Step 1

> It is necessary to model the composite object by using the es-device program. This program takes an input file which contains the model details. The input file for this example is the following file:

    	/opt/SUNWsymon/sdk/examples/services/discovery/example-composite.conf

> Note: The input file to es-device, example-composite.conf, assumes that the installation directory for Sun Management Center is "/opt/SUNWsymon". If it is installed in a different location, it will be necessary to edit the example-composite.conf file to specify the correct location of the GIF image files and the example_user.properties file. To model the composite object, run the following commands on the Sun Management Center server machine:

    	% cd  ~/de_examples/examples/services/discovery/server_package
    	% su
            # /opt/SUNWsymon/sbin/es-device -a example-composite.conf

> Step 2

> To install the agent component of this example, do the following on the Sun Management Center agent machine:

    	% cd  ~/de_examples/examples/services/discovery/agent_package/package
    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
            # pkgadd -d . DEMOesdsa
    	# /opt/SUNWsymon/sbin/es-start -a

> Note: This agent package installs the file:

            /opt/SUNWsymon/modules/cfg/dot-d.prc

> which contains the following line:

            set port        161

> If the Sun Management Center agent process is running on a different port than the default value of 161, then this file will need to be updated accordingly.

> Step 3

> Run the es-dt program with the -a argument on a Sun Management Center agent machine. This can be the same machine that has the DOT module installed, but can also be another agent machine.

> Note: The Sun Management Center agent process can not be running when the es-dt program is executed. It must be stopped by executing the following command as user root:

    	# /opt/SUNWsymon/sbin/es-stop -a

> Now the es-dt program can be executed:

            # /opt/SUNWsymon/sbin/es-dt -a -h hostname -p port -o OID -n not -l label

            where:

            hostname - The hostname where the DOT module was loaded.
            port     - The port the agent is running on the hostname specified.
            OID      - 1.3.6.1.4.1.42.2.12.2.2.120.50
            not      - Example_Composite_Object_Type
            label    - Example_Composite_Object

> To see what Composite Objects are loaded on the machine, run the following command:

            # /opt/SUNWsymon/sbin/es-dt -v

> Now the Sun Management Center agent process can be restarted by executing the following command as user root:

    	# /opt/SUNWsymon/sbin/es-start -a

> Note: The above commands could be included in the package postinstall script. In this example, they are manual steps to highlight the work necessary to install this example.

> Step 4

> To install the server component of this example, do the following on the Sun Management Center server machine:

    	% cd  ~/de_examples/examples/services/discovery/server_package/package
    	% su
            # pkgadd -d . DEMOesdss

#### Using this example with Sun Management Center

> From the Sun Management Center console invoke the module load window for the agent where the DEMOesdsa agent package was installed.

> From the list of modules, select the DOT module and load it.

> You can now observe that the DOT module is loaded under Local Applications.

> Now the composite object can be created by entering a "Discovery Request" or by using the "Edit -> Create an Object..." menu choice on the Sun Management Center console main window.

> To run a "Discovery Request", click on the "Tools -> Discover..." menu choice on the Sun Management Center main console window. This causes the "Discovery Requests" popup window to appear. Create a request by clicking on the "Add" button. Give the request a reasonable name in the "Request Name" field.

> Enter the IP address of the agent machine where the es-dt program was executed in both the "Start IP Address" and the "End IP Address" fields. If the agent is not running on the default port of 161, then enter the port number in the "Also Check Port" field. Click on the "OK" button, and select "Yes" when the popup asks "Do you want to start the request upon creation?". This will cause the request to be executed, and will cause the composite object to be discovered. The composite object should now be visible in the Sun Management Center main console window.

> You can delete a composite object by selecting the composite object and then clicking on the "Edit->Delete Object/Connection..." menu choice on the Sun Management Center main console window. Feel free to delete and discover the composite object as many times as desired. You may re-run any "Discovery Request" by selecting the request in the "Discovery Requests" window and clicking on the "Start" button.

> The "Log" button in the "Discovery Requests" window is also useful for viewing the progress of the request. The "Log" button brings up a separate "Request Log File" popup. Click on the "Refresh" button to refresh the view of the log.

#### Unloading this example

> Step 1

> To unload this example, go to the Sun Management Center Details window for the agent where the DEMOesdsa package was installed. Under the Browser tab, right click over the DOT module and choose "Unload".

> Step 2

> Do the following on the Sun Management Center agent machine where the agent_package was installed:

    	% su
    	# /opt/SUNWsymon/sbin/es-stop -a
            # pkgrm DEMOesdsa
    	# /opt/SUNWsymon/sbin/es-start -a

> Step 3

> Do the following on the Sun Management Center agent machine where the es-dt script was executed with the -a argument:

            % su
            # /opt/SUNWsymon/sbin/es-stop -a
            # /opt/SUNWsymon/sbin/es-dt -d -l Example_Composite_Object
            # /opt/SUNWsymon/sbin/es-start -a

> Step 4

> Do the following on the Sun Management Center server machine:

            % cd  ~/de_examples/examples/services/discovery/server_package
            % su
            # pkgrm DEMOesdss
            # /opt/SUNWsymon/sbin/es-device -d example-composite.conf

> Stop and restart any open Sun Management Center console windows.

To Top