Zenoss Developer's Guide
Total Page:16
File Type:pdf, Size:1020Kb
Zenoss Developer’s Guide Version 2.3.3 February 19, 2009 Zenoss Developer’s Guide Version 2.3.3 Copyright © 2009 Zenoss, Inc. All rights reserved. The Zenoss logo is a registered trademark of Zenoss, Inc. Zenoss and Open Enterprise Management are trademarks of Zenoss, Inc. in the U.S. and other countries. Zenoss can be contacted at: Zenoss, Inc. 275 West St. Suite 204 Annapolis MD 21401 U.S.A. Flash is a registered trademark of Adobe Systems Incorporated. Java is a registered trademark of Sun Microsystems, Inc. Linux is a registered trademark of Linus Torvalds. SNMP Informant is a trademark of Garth K. Williams (Informant Systems, Inc.). Tomcat is a trademark of the Apache Software Foundation. Windows is a registered trademark of Microsoft Corporation in the United States and other countries. All other companies and products mentioned are trademarks and property of their respective owners. Table of Contents 1. Introduction .............................................................................................................................. 1 1.1. Overview ...................................................................................................................... 1 1.1.1. Model ................................................................................................................ 1 1.1.2. Availability ......................................................................................................... 1 1.1.3. Events ................................................................................................................ 1 1.1.4. Performance ........................................................................................................ 1 1.2. Detailed Architecture ....................................................................................................... 2 1.2.1. User Layer .......................................................................................................... 2 1.2.2. Data Layer .......................................................................................................... 2 1.2.3. Collection and Control Service Layer ....................................................................... 2 2. Getting Started ......................................................................................................................... 4 2.1. Working with the Source Code ......................................................................................... 4 2.1.1. Getting the Source Code ........................................................................................ 4 2.1.2. Keeping up-to-date with your checked-out code ......................................................... 5 2.1.3. Getting Patches .................................................................................................... 5 2.1.4. Style Guidelines ................................................................................................... 5 2.1.5. Generating Diffs for new Fixes ............................................................................... 7 2.1.6. Submitting a Fix .................................................................................................. 7 2.2. Development Toolchain Requirements ................................................................................ 8 2.2.1. Appliance ........................................................................................................... 8 2.3. Programming Techniques ............................................................................................... 10 2.3.1. Calling Methods Using REST ............................................................................... 10 2.3.2. Miscellaneous Notes ............................................................................................ 14 2.4. zendmd: Command-line Access to the Device Management Database (DMD) ........................... 14 2.5. Programming Documentation .......................................................................................... 16 2.5.1. Python .............................................................................................................. 16 2.5.2. Zenoss API ........................................................................................................ 16 2.5.3. Other Resources ................................................................................................. 16 2.5.4. Contributing to the Documentation ......................................................................... 17 3. ZenPacks ............................................................................................................................... 18 3.1. Overview ..................................................................................................................... 18 3.2. Creating a ZenPack ....................................................................................................... 18 3.2.1. ZenPack Names .................................................................................................. 18 3.2.2. Specifying Dependencies ...................................................................................... 19 3.2.3. Locating ZenPack Source Outside of Zenoss ............................................................ 19 3.2.4. Community ZenPack Subversion Access ................................................................. 19 3.3. ZenPack Structure and Contents ....................................................................................... 19 3.4. Developing the ZenPack ................................................................................................. 22 3.4.1. Base ZenPack Class ............................................................................................ 22 3.4.2. Storing Objects in the ZODB ................................................................................ 23 3.4.3. Providing DataSource classes ................................................................................ 23 3.4.4. Performance Template Checklist ............................................................................ 24 3.4.5. Providing daemons .............................................................................................. 26 3.4.6. setuptools and the zenpacksupport ......................................................................... 26 3.5. Building and Distributing ZenPacks .................................................................................. 26 3.5.1. Migrating between versions .................................................................................. 27 3.5.2. Converting older ZenPacks to ZenPack eggs ............................................................ 27 3.6. Where to Get More Information ....................................................................................... 27 4. Zenoss Datastores .................................................................................................................... 28 4.1. Zope Object Database (ZODB) ........................................................................................ 29 4.2. MySQL Event database .................................................................................................. 30 iii Zenoss Developer’s Guide 4.2.1. Connecting to the Database .................................................................................. 30 4.2.2. MySQL in 60 Seconds ........................................................................................ 31 4.3. Python Pickle Files ........................................................................................................ 32 4.4. Round-Robin Database ................................................................................................... 32 5. Events ................................................................................................................................... 35 5.1. Understanding an Event Entry ......................................................................................... 35 5.1.1. Event Design ..................................................................................................... 35 5.2. Sending an Event .......................................................................................................... 35 5.3. Adding an Event Class ................................................................................................... 36 5.3.1. Add to ZenEventClasses ...................................................................................... 37 5.3.2. Add the class to the import XML .......................................................................... 37 5.3.3. Write a migrate script .......................................................................................... 37 6. zProperty Management ............................................................................................................. 39 6.1. Adding a zProperty ....................................................................................................... 39 6.1.1. Adding a zProperty to an Event ............................................................................. 39 6.1.2. Adding a zProperty to a Device ............................................................................. 39 6.2. Migrating the zProperty Code .......................................................................................... 39 7. Device Management ................................................................................................................