Archived community.zenoss.org | full text search
Skip navigation
Currently Being Moderated

Updating Zenoss with CIM Functionality

VERSION 1 
Created on: Sep 14, 2009 11:21 AM by Noel Brockett - Last Modified:  Sep 14, 2009 11:21 AM by Noel Brockett

Notes

  • This should be able to be created using the instructions in the Zope Book for creating a product, but this functionality appears to be broken. Hence this workaround.
  • All of the comments are with regards to the VMWare? image.
  • The brief synopsis: create a tarball, untar it, restart Zope/ Zenoss
  • There's a good article at Linux Journal which describes some of the details of Zope's product process.  In addition, the Resources section of the article has an excellent discussion of the basics of ins and outs of Zope products.
  • NB: The tarball is for the 2.1 beta!

Creating the New Zope Product

Create a Products Directory

mkdir -p Products/ZenModel/skins/zenmodel
mkdir Products/ZenModel/help
mkdir Products/ZenModel/dtml

Copy in Zenoss Standard Files

cp trunk/Products/ZenModel/skins/zenmodel/leftPane.pt Products/ZenModel/skins/zenmodel
cp trunk/Products/ZenModel/__init__.py Products/ZenModel
cp trunk/Products/ZenModel/DmdBuilder.py Products/ZenModel

The leftPane.pt file contains the Navigation bar, and the other two files control what python files are executed at Zope startup to add base classes.

Copy and Modify Mib* Files

The type of object conceptually closest to CIM is the Mib object. So rather than figuring out absolutely everything that we need to do on our own, we'll just use the Mib files as our guide to what we need to do.

 

cp trunk/Products/ZenModel/help/Device.stx Products/ZenModel/help/CIM.stx
cp trunk/Products/ZenModel/dtml/addMibOrganizer.dtml Products/ZenModel/dtml/addCIMOrganizer.dtml
cp trunk/Products/ZenModel/skins/zenmodel/*Mib* Products/ZenModel/skins/zenmodel
for i in Products/ZenModel/skins/zenmodel/* ; do mv $i `echo $i | sed -e 's/Mib/CIM/'`; done
cp trunk/Products/ZenModel/*Mib* Products/ZenModel
for i in Products/ZenModel/*Mib* ; do mv $i `echo $i | sed -e 's/Mib/CIM/'`; done

Now edit the files as appropriate.  Yes, this is definitely the hard part.

Create the Menu Definitions

These new menu definitions will NOT be loaded by default.  We'll need some other trickery in order to get it loaded.  Copy the

 

Products/ZenModel/migrate/menus.py

file to our

 

Products

directory, remove everything except a simple dictionary that contains our menu items.

 

Here's an example:

 

cim_menus= {
'CIM_list': [  {  'action': 'dialog_addToZenPack',
                 'description': 'Add to ZenPack...',
                 'id': 'addToZenPack',
                 'isdialog': True,
                 'ordering': 0.0,
                 'permissions': ('View',)},
              {  'action': 'dialog_addCIMModule',
                 'description': 'Add CIM Client...',
                 'id': 'addCIMModule',
                 'isdialog': True,
                 'ordering': 90.0,
                 'permissions': ('Manage DMD',)},
              {  'action': 'dialog_removeCIMModules',
                 'description': 'Delete CIMs...',
                 'id': 'removeCIMModules',
                 'isdialog': True,
                 'ordering': 80.0,
                 'permissions': ('Manage DMD',)},
              {  'action': 'dialog_moveCIMModules',
                 'description': 'Move CIMs...',
                 'id': 'moveCIMModules',
                 'isdialog': True,
                 'ordering': 70.0,
                 'permissions': ('Manage DMD',)}],
}

Create the tarball

Tar up the project directory

 

tar cf cim_mgmt.tar Products

You will now be able to move around the cim_mgmt.tar file for installation to VMWare? systems.

Installation

Install the pre-requisite Python package pywbem

Download and install pywbem

Step-by-step Instructions

  1. Log onto the VMWare? image as 'root' with no password.
  2. Use 'wget' to obtain the pywbem package
    cd /tmp
    wget http://downloads.sourceforge.net/pywbem/pywbem-0.5.tar.gz
  3. Untar the file:

    tar xzf pywbem-0.5.tar.gz
  4. Install the package

    cd pywbem-0.5
    python setup.py build
    python setup.py install

Install on the VMWare? Image

Untar the tar file on the VMWare? image in the zenoss user's home directory and restart.

 

Step-by-step Instructions

  1. Log onto the VMWare? image as 'root' with no password.
  2. Become the zenoss user:

    su - zenoss
  3. Copy over the tar file from your system:

    scp username@sourcesystem:path/to/file .

    For instance:

    scp kells@neurotoxin:~/cim_mgmt.tar .

    NB: The host 'neurotoxin' was added to the /etc/hosts file

  4. Make backup copies of system files:

    mkdir pre_cim_mgr_backup
    cp Products/ZenModel/skins/zenmodel/leftPane.pt pre_cim_mgr_backup
    cp Products/ZenModel/__init__.py pre_cim_mgr_backup
    cp Products/ZenModel/DmdBuilder.py pre_cim_mgr_backup
  5. Untar the file:

    tar xf cim_mgmt.tar
  6. Restart the Zope server from the Zope Management Interface (ZMI):

    1. Log into the ZMI

      In the URL area of your browser, log into your Zenoss instance with '/manage' at the end.

      http://your_zenoss_server:8080/manage

      For instance:

      http://monitor1:8080/manage
    2. Navigate into the Control Panel

      Click on the

      Control_Panel (Control Panel)
      link
    3. Restart Zope

      Click on the

      Restart
      button and wait for the screen to come back

Debugging Tip

Look for problems by logging into the VMWare? console and examining the /home/zenoss/log/event.log file. If there are any syntax issues or other problems that prevent Zope from loading the new code, there should be information about what the error is and where to find the error.

 

For instance, here's an example error from the event.log file:

 

------
2007-09-30T20:13:20 ERROR Zope Couldn't install ZenModel
Traceback (most recent call last):
  File "/home/marc/conary/zenoss-project/builds/zope2/_ROOT_/usr/lib/zope/lib/python/OFS/Application.py", line 773, in install_product
  File "/home/zenoss/Products/ZenModel/__init__.py", line 143, in initialize
    if not confmonModules: loadConfmonModules()
  File "/home/zenoss/Products/ZenModel/__init__.py", line 132, in loadConfmonModules
    mod = __import__(product, globals(), locals(), [])
  File "/home/zenoss/Products/ZenModel/CIMModule.py", line 22, in ?
    class CIMModule(CIMBase):
  File "/home/zenoss/Products/ZenModel/CIMModule.py", line 26, in CIMModule
    _relations = ZenPackable._relations + (
NameError: name 'ZenPackable' is not defined
------
2007-09-30T20:13:20 INFO Zope Ready to handle requests
------
2007-09-30T20:13:45 WARNING ZODB Could not import class 'CIMOrganizer' from module 'Products.ZenModel.CIMOrganizer'
------

 

In the above example, we notice (from the last error to the first error) that the class 'CIMOrganizer?' was unable to be loaded.  We can take a reasonable guess that the reason that 'CIMOrganizer?' was unable to be loaded might be related to the earlier error.

 

When we open the 'CIMOrganizer?.py' file, we find that it indeed imports the CIMModule?.py module.  So, the reason that CIMOrganizer? module couldn't be loaded is due to an issue with CIMModule?.py. The error in CIMMOdule?.py tells us that the 'import' statement which defines the 'ZenPackable?' module is missing.

Create the 'CIM' Organizer

We've moved all of the logic and presentation information into the VMWare? image, so it's almost ready to use. If you log into Zenoss, you'll notice that a new button is on the bottom of the Navigation pane, right underneath 'Mibs'. If you click on it, you'll receive an error message because one final step needs to be completed.

 

Log into the Zope Management Interface (ZMI) and create the 'CIM' organizer.

Step-by-step Instructions

  1. Log into the ZMI

    In the URL area of your browser, log into your Zenoss instance with '/manage' at the end.

    http://your_zenoss_server:8080/zport/dmd/manage

    For instance:

    http://monitor1:8080/zport/dmd/manage
  2. At the top right-hand side (right beside the 'Add' button), there is a pull-down list.  Select 'CIMOrganizer?' from the pull-down list and then click the 'Add' button.

You should now see a new entry in the ZMI with the name 'CIM'.  At this point the navigation bar entry for 'CIM' should work.

Add Menus to the 'CIM' Organizer

Now we can add our menu items to the CIM organizer. I've edited the menus.xml file (which doesn't seem to get referenced except in menus.py -- which doesn't use it) and the menus.py file, but even a restart of the VMWare? image won't load these menu hierarchies.  We'll need to do something a little more intense.

 

In the tarball there's a file ('cim_menus.py') in the Products directory which contains the basic menus that we need to get started. Once this step is done, then we can modify everything else from within Zope (through the ZMI) and through Zenoss (through 'Settings' -> 'Menus'). What we need to do is load the new file and get the running Zenoss instance to use that new file's data.

Step-by-step Instructions

  1. Log onto the VMWare? image as 'root' with no password.
  2. Become the zenoss user:

    su - zenoss
  3. Run the zendmd command, which allows you to attach to the running Zenoss server:

    zendmd
  4. Access the new menu definitions and load them into memory

    import Products.cim_menus
  5. Add the new menu items to the running Zenoss server

    dmd.buildMenus( Products.cim_menus.cim_menus )
    commit()
  6. Exit from zendmd by typing ctl + d (the Unix end-of-file character)

    Comments (0)