Amol Chiplunkar's Weblog

All | Music | Personal | Sports | Sun | Systems Management
« Hands free sun manag... | Main | Some quality music... »
20060627 Tuesday June 27, 2006

Extending Sun Management Center Agent Update The feature Agent Update was added to sunmc 3.5 to fascilitate the mass deployment of sunmc agents, addons and patches. However it can be utilized to deploy many things such as a sunmc module, a bunch of files or even a small application not at all related to sunmc.

How could one do that ? Well, the prerequisites are:

And the steps involved are

Step1: Packaging

Say the sunmc module is composed of the following files ( scripts / binaries / confi files ) when it is installed in the target directory /opt
SUNWsymon
SUNWsymon/mdr
SUNWsymon/mdr/modules
SUNWsymon/mdr/modules/cfg
SUNWsymon/mdr/modules/cfg/mymodule-d.x
SUNWsymon/mdr/modules/cfg/mymodule-d.prc
SUNWsymon/mdr/modules/cfg/mymodule-m.x
SUNWsymon/mdr/modules/cfg/mymodule-d.def
SUNWsymon/mdr/modules/cfg/mymodule-models-d.x
SUNWsymon/modules
SUNWsymon/modules/cfg
SUNWsymon/modules/cfg/mymodule-d.x
SUNWsymon/modules/cfg/mymodule-d.prc
SUNWsymon/modules/cfg/mymodule-m.x
SUNWsymon/modules/cfg/mymodule-d.def
SUNWsymon/modules/cfg/mymodule-models-d.x
SUNWsymon/modules/sbin
SUNWsymon/modules/sbin/mymodule_actions.sh
SUNWsymon/modules/lib

Create the same directory structure somewhere, cd to the parent dir of that structure and use pkgproto *
$ pkgproto *
d none SUNWsymon 0755 amol staff
d none SUNWsymon/mdr 0755 amol staff
d none SUNWsymon/mdr/modules 0755 amol staff
d none SUNWsymon/mdr/modules/cfg 0755 amol staff
f none SUNWsymon/mdr/modules/cfg/mymodule-d.x 0444 amol staff
...
...
f none SUNWsymon/modules/sbin/mymodule_actions.sh 0444 amol staff
d none SUNWsymon/modules/lib 0755 amol staff

Send this output to a file "prototype". Add a line
"i pkginfo"
in the prototype file.
Now create the pkginfo file:
CLASSES='none'
BASEDIR='/opt'
PKG='SUNWmymod'
NAME='My module'
DESC='My module'
ARCH='sparc'
CATEGORY='system,SyMON'
VERSION='3.6.1,REV=2.10.2006.04.27'
SUNW_PRODNAME='Sun Management Center'
SUNW_PRODVERS='3.6.1'
SUNW_PKGVERS='1.0'
VENDOR='Sun Microsystems, Inc.'
HOTLINE='Please contact your local service provider'
EMAIL=''
MAXINST='1000'
PRODUCTDIR='SUNWsymon'

Place both, prototype and pkginfo files at the same level as that of "SUNWsymon" directory in your directory structure.
pkgmk -o -d . -r .
## Building pkgmap from package prototype file.
## Processing pkginfo file.
...
...
## Validating control scripts.
## Packaging complete.

The package SUNWmymod package will be created in the same directory

Step 2: Agent Update compatibility

The package needs to be modelled as a sunmc addon and the interface published by agent update's image tool has to be implemented so that the tool creates a distributable agent update image with this package.

The plan is to create a dummy sunmc add-on "My Addon".

If your module deployment on the target needs something more than just pkgadd, the logic can be written in a script and can be placed as "SUNWsymon/addons/MyAddon/sbin/es-setup.sh" as part of the package created in step 1. Agent Update will run it on the target after installing "MyAddon" packages as part of setup.

First create a script with name setup-resp.sh. This needs to go to /opt/SUNWsymon/addons/MyAddon/sbin/setup-resp.sh on the target host. If the es-setup.sh script described in step 1 above is interactive, this is the place where you can collect the user interactions and create a "setup response" file that can be consumed by the es-setup.sh script on the target.
Use pkgproto and pkgmk as described above to create a package, say "SUNWmymods" with "SUNWsymon/addons/MyAddon/sbin/setup-resp.sh". The script should have execute permissions.

Create installation configuration files:

----- installation.info

<PRODUCT>
    PRODUCT_KEY=PRODUCT.MYADDON
    PACKAGES_SUBDIR=Basic
    <COMPONENT>
        COMPONENT_KEY=COMPONENT.SERVER
        COMPONENT_CD=2
        ESSENTIAL=true
        LAYER=LAYER.SERVER
        PACKAGES=SUNWmymods
    </COMPONENT>
    <COMPONENT>
        COMPONENT_KEY=COMPONENT.AGENT
        COMPONENT_CD=2
        ESSENTIAL=true
        LAYER=LAYER.AGENT
        PACKAGES=SUNWmymod
    </COMPONENT>
</PRODUCT>

----- installation.properties

PRODUCT.MYADDON=My Addon

LAYER.SERVER=Server Layer
LAYER.AGENT=Agent Layer

PACK.BASIC=My Addon

COMPONENT.SERVER=My Addon Server Component
COMPONENT.AGENT=My Addon Agent Component


Create a directory structure that is understandable to the image tool and place both the packages in it as follows.
disk1/image/SunOS/sparc/Addons/MyAddon/Solaris_10/installation.info
disk1/image/SunOS/sparc/Addons/MyAddon/Solaris_10/installation.properties
disk1/image/SunOS/sparc/Addons/MyAddon/Solaris_10/Basic/SUNWmymod/pkgmap
disk1/image/SunOS/sparc/Addons/MyAddon/Solaris_10/Basic/SUNWmymod/pkginfo
disk1/image/SunOS/sparc/Addons/MyAddon/Solaris_10/Basic/SUNWmymods/pkgmap
disk1/image/SunOS/sparc/Addons/MyAddon/Solaris_10/Basic/SUNWmymods/pkginfo

disk2/image/SunOS/sparc/Addons/MyAddon/Solaris_10/installation.info
disk2/image/SunOS/sparc/Addons/MyAddon/Solaris_10/installation.properties
disk2/image/SunOS/sparc/Addons/MyAddon/Solaris_10/Basic/SUNWmymod/pkgmap
disk2/image/SunOS/sparc/Addons/MyAddon/Solaris_10/Basic/SUNWmymod/pkginfo
disk2/image/SunOS/sparc/Addons/MyAddon/Solaris_10/Basic/SUNWmymod/reloc/SUNWsymon/mdr/modules/cfg/mymodule-d.def
...
...
disk2/image/SunOS/sparc/Addons/MyAddon/Solaris_10/Basic/SUNWmymod/reloc/SUNWsymon/modules/cfg/mymodule-models-d.x
...
...
disk2/image/SunOS/sparc/Addons/MyAddon/Solaris_10/Basic/SUNWmymods/pkgmap
disk2/image/SunOS/sparc/Addons/MyAddon/Solaris_10/Basic/SUNWmymods/pkginfo
disk2/image/SunOS/sparc/Addons/MyAddon/Solaris_10/Basic/SUNWmymods/reloc/SUNWsymon/addons/MyAddon/sbin/setup-resp.sh

Observe that disk1 only has package manifest files and disk2 has the real contents.

And you are all set
First install the addon on the sunmc server by pointing es-inst to the parent directory of disk1 and disk2 above.
$ es-inst -S /disk1/image
...
...
Found: My Addon

The following Add-On Products are applicable for installation.
    My Addon
Select the products you want to install:
    My Addon (y|n|q)


And then just point image tool to disk1/image
$ es-imagetool
...
...
This script will help you to create distributable images of Sun (TM) Management Center software
...
...
Enter image name : myaddon-image
...
...
Checking for Available products. Please wait...

Found: My Addon
...
...
Select the products you want to install:
    My Addon (y|n|q) y
...
...
Gathering Addon setup responses for Solaris-sparc ...

My Addon
---------------------------------------

...
Starting image creation...


adding Addons
archiving addons..
-----------------------------------------------
packages for product My Addon : SUNWmymod
Adding SUNWmymod
a ././Solaris_10/Basic/SUNWmymod/ 0K
...
a ././Solaris_10/Basic/SUNWmymod/reloc/SUNWsymon/mdr/modules/cfg/mymodule-d.def 1K
...
...
a ././Solaris_10/Basic/SUNWmymod/reloc/SUNWsymon/modules/sbin/mymodule_actions.sh 3K

You can use this image to create an agent update task in the Job Manager and run a job that will deploy this module onto the targets you are interested in. !!!!


Posted by chiplunkar ( Jun 27 2006, 03:00:00 PM IST ) Permalink Comments [0]

Trackback URL: http://blogs.sun.com/chiplunkar/entry/extending_sun_management_center_agent
Comments:

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed

Calendar

RSS Feeds

Search

Links

Navigation

Referers

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.