Using CIMPLE with OpenPegasus CIM Server

This post just walk through the usage of CIMPLE and OpenPegasus in CentOS 5.x. For background knowledge, please refer to wikipedia.

In CentOS 5.x, just install OpenPegasus(2.9.1) from yum:

We install the devel package since CIMPLE needs to build against it. I used CIMPLE 1.2.4. Before build it, we should fix broken symbolic links of OpenPegasus package, otherwise link error occurs:

There’s also a trivial bug which prevent CIMPLE from generating CMPI version of makefiles. Edit ${CIMPLE}/src/tools/genmak/main.cpp, find line “case ‘c'”, and change to “case ‘C'”. Now configure and make:

Aha!! Another annoying bug: wrong permissions in *.tar.gz source package. Fix with:

Demo code refers to CIMPLE official tutorial. It can be found in source package. A repository.mof file is created first:

Run genproj to generate class files, provider files, and module files:

Generate makefiles using genmak. First line is for OpenPegasus adapter, while second line for CMPI adapter:

We implemented President::get_instance() and President::enum_instance() in our code:

If get_instance() returns GET_INSTANCE_UNSUPPORTED, the adapter satisfies the request by calling enum_instances() and searching for a matching instances. It is recommend to leave get_instance() unsupported when the total number of instances is small.

After making your module, a registration is required for OpenPegasus CIM server. Start your server and register. The shared library should also be copied to OpenPegasus’s providers folder manually:

To unregister this provider, run:

You may want to dump MOF registration instance for your provide:

Install command line utilities and test OpenPegasus server:

Test our President provider:

All code can be found in my skydrive here:

Leave a Reply

Your email address will not be published. Required fields are marked *