Just learning - zendmd and cProperties

zenoss-dev
2010-11-28
2013-05-25
  • Nobody/Anonymous

    Hi there! I am rather new to Zenoss, so bear with me if my question sounds dense.  I am using ZenOSS 3.0, fresh, clean copy with no ZenPacks installed. I am trying to use the "Custom Schema" properties in the device management via the 'zendmd' command line.  In our environment, all of our servers are attached to a customer, so I would like in the device tab to have that populated with critical information for this, such as customer code, customer name, contract end date, etc. I approached this from a number of angles, but I definitely want it automated, so I planned to write a script that would be run via zendmd to auto-populate this (stored in a text file on the server).  I have the basics down, and in fact have more or less come up with all of the steps to fully model one of our servers (including zProperties and such).  Everything works fine, except cProperties.  They simply don't seem to get inherited to the actual device from the /Devices property tree, since they aren't zProperties (they are cProperties). The behavior is kind of strange though, I feel like I'm missing some very simple command that would 'fix' the issue.  Here's the behavior I see: Case #1: Model server normally through zenoss modeling using the web GUI1. Everything works fine, data is fully populated in all normal fields, cProperties fields are empty2. I populate cProperties fields with data in the web interface, click Save, and all is well.  cProperties now show up just fine. Case #2: Model server using zendmd directly1. Model server normally as above through the web interface2. Run zendmd commands to populate cProperties, eg:        >>> dmd.Devices.Server.Linux.devices.SERVER0501.cCustomerCode = "JHH191XXA"        >>> commit()        >>> dmd.Devices.Server.Linux.devices.SERVER0501.cCustomerCode        JHH191XXA3. Go into Web GUI, navigate to device, and click on Custom Schema.  No data is populated in the fields, and, if I try to click Save after putting data in, I get the error in the screen shot below:4. I can no longer use the cProperty fields until I delete the device, and re-model it from scratch.   What I think is going on here, is that the 'structure' in the device's properties (where zProperties are) are not getting created in the zope database.  When I browse in my browser to http://myURL/manage, and browse to /zport/dmd/Devices/Server/Linux/devices/SERVER0501, and click on properties, the cProperties are not there. HOWEVER, if I do all of this with a server, model it normally, and enter cProperty fields through the web GUI, and then navigate in /manage to that server's properties, the cProperty fields DO show up in the zope database, so the web interface save function does something that I can't figure out how to use. I have determined that the web interface when saving Custom Schema fields uses dmd.Devices.Server.Linux.devices.<SERVERNAME>.saveCustProperties(), but I must admit I am still rather green and haven't quite learned how to properly use this field (everything I've tried has failed, such as using ….saveCustProperties('cCustomerCode'), etc). So, has anyone tried to use cProperties via zendmd, and if so, how did you do it?  Any sample code?  I've tried searching and haven't come up with much.. Thanks so much!!! -Chris

            -community@zenoss.org

            Original link: http://community.zenoss.org/message/55004?tstart=0#55004
           

     
  • lakedx

    lakedx - 2013-05-25

    JIAYU G2S MTK6577T Android 4.1 Dual Core 1.2GHz 4.0 Inch QHD IPS Screen 1G RAM 8.0MP Camera 2200mAh Battery Mobile Phone Black

    JIAYU G4 android 4.2

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks