Skip navigation
Currently Being Moderated

Zenoss Developer's Guide

VERSION 2  Click to view document history
Created on: Oct 26, 2009 4:02 PM by Zenoss API - Last Modified:  Oct 26, 2009 4:53 PM by Noel Brockett

#Zenoss Developer's Guide


This work is licensed under a Creative Commons Attribution Share Alike 3.0 License. To view a copy of this license, visit; or send a letter to Creative Commons, 171 2nd Street, Suite 300, San Francisco, California, 94105, USA.




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.

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.

Oracle and the Oracle logo are registered trademarks of the Oracle Corporation.

SNMP Informant is a trademark of Garth K. Williams (Informant Systems, Inc.).

Sybase is a registered trademark of Sybase, 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.


Part Number: 08-102009-2.5-v01

Table of Contents

1. Introduction
1.1. Overview
1.1.1. Model
1.1.2. Availability
1.1.3. Events
1.1.4. Performance
1.2. Detailed Architecture
1.2.1. User Layer
1.2.2. Data Layer
1.2.3. Collection and Control Service Layer
2. Getting Started
2.1. Working with the Source Code
2.1.1. Getting the Source Code Getting Subversion for the Appliance
2.1.2. Keeping up-to-date with your checked-out code
2.1.3. Getting Patches
2.1.4. Style Guidelines Docstrings
2.1.5. Generating Diffs for new Fixes
2.1.6. Submitting a Fix
2.2. Development Toolchain Requirements
2.2.1. Appliance
2.3. Programming Techniques
2.3.1. Calling Methods Using REST How to Call Methods Using REST Sending an Event
2.3.2. Miscellaneous Notes pkg_resources urllib2 Workarounds
2.4. zendmd: Command-line Access to the Device Management Database (DMD)
2.5. Programming Documentation
2.5.1. Python
2.5.2. Zenoss API
2.5.3. Other Resources
2.5.4. Contributing to the Documentation
3. ZenPacks
3.1. Overview
3.2. Creating a ZenPack
3.2.1. ZenPack Names
3.2.2. Specifying Dependencies
3.2.3. Locating ZenPack Source Outside of Zenoss
3.2.4. Community ZenPack Subversion Access
3.3. ZenPack Structure and Contents
3.4. Developing the ZenPack
3.4.1. Base ZenPack Class
3.4.2. Storing Objects in the ZODB
3.4.3. Providing DataSource classes
3.4.4. Performance Template Checklist Data Sources Data Points Thresholds Graph Definitions Graph Points
3.4.5. Providing Performance Collector Plugins
3.4.6. Referencing Collector Plugins in ZenPacks
3.4.7. Providing Daemons
3.4.8. setuptools and the zenpacksupport
3.5. Building and Distributing ZenPacks
3.5.1. Migrating between versions
3.5.2. Converting older ZenPacks to ZenPack eggs
3.6. Development Mode
3.6.1. Source ZenPacks
3.6.2. Converting .egg Files to Development Mode
3.7. Where to Get More Information
4. Zenoss Data Stores
4.1. Zope Object Database (ZODB)
4.2. MySQL Event database
4.2.1. Connecting to the Database
4.2.2. MySQL in 60 Seconds
4.3. Python Pickle Files
4.4. Round-Robin Database
5. Events
5.1. Understanding an Event Entry
5.1.1. Event Design
5.2. Sending an Event
5.3. Adding an Event Class
5.3.1. Add to ZenEventClasses
5.3.2. Add the class to the import XML
5.3.3. Write a migrate script
6. zProperty Management
6.1. Adding a zProperty
6.1.1. Adding a zProperty to an Event
6.1.2. Adding a zProperty to a Device
6.2. Migrating the zProperty Code
7. Creating New Jobs
7.1. Job Requirements
7.2. Running a Job
7.3. Life Cycle of a Job
7.4. Shell Command Jobs
7.5. Logging
8. Device Management
8.1. Adding Devices Programatically
8.1.1. Using a REST call
8.1.2. Using an XML-RPC Call from Python
8.1.3. XML-RPC Attributes
8.2. Editing Device Information
8.2.1. Using a REST call
8.2.2. Using an XML-RPC Call from Python
8.3. Deleting A Device
8.3.1. Using a REST call
8.3.2. Using an XML-RPC Call from Python
8.4. Checking If A Device Exists
8.4.1. Using a REST call
8.4.2. Using an XML-RPC Call from Python
8.5. Exporting a Device List
9. Extending the Model
9.1. Add a ZenModel Relationship
9.1.1. One-to-One (1:1) Relationships
9.2. One-to-Many (1:N) Relationships
9.3. Many-to-Many (M:N) Relationships
9.3.1. One-to-Many (1:N) Container Relationships
9.4. Zenoss XML Schema
9.4.1. object Example Attributes Children
9.4.2. objects Example Children
9.4.3. property Example Attributes
9.4.4. tomany Example Attributes Children
9.4.5. tomanycont Example Attributes Children
9.4.6. toone Example Attributes
9.4.7. link Example Attributes
9.5. Zenoss Permissions
9.5.1. Adding New Permissions
9.5.2. Assigning Permissions to a Method
9.5.3. Checking Links
10. Zenoss Daemons
10.1. Twisted Network Programming Overview
10.1.1. Understanding NJobs, Driver and DeferredList DeferredList NJobs Driver A Simple Example
10.2. Zenoss Daemon Overview
10.3. zenhub: Daemon to ZODB management
10.3.1. Daemon to ZODB management
10.3.2. Heartbeats and other Events
10.3.3. Pluggable Daemon Services
10.4. ZenRender and Graphs
10.5. Developing a Daemon
10.5.1. Command-line Options
10.5.2. Add the Daemon Control Script
10.5.3. Set Up ZenHub Communications Registering Services with the Hub
11. Add a Performance Daemon
11.1. Overview
11.2. DataMaps
11.3. Performance Collection
11.3.1. Connecting Collectors and Services
11.4. Creating a New Collector
11.4.1. Constructor
11.4.2. Getting a List of Devices Thresholds
11.4.3. fetchConfig()
11.4.4. Collector's ZenHub Service
11.4.5. Miscellaneous Functions
11.4.6. Collect the Performance Data
12. Adding a Device Type
12.1. Overview
12.2. Add the MIB
12.3. Add a Device Organizer
12.4. Create a Modeler
12.4.1. Verify the SNMP connectivity and OIDs
12.4.2. Common SNMP Issues
12.4.3. Modeler Code
12.4.4. Testing the Modeler
12.5. Create a Performance Collector
12.5.1. Performance Data Collector Code
12.5.2. Writing Your Own Command Parser
12.6. Create the Template
12.6.1. Create the DataSource
12.6.2. Create a Threshold
12.6.3. Create a Graph
12.7. Map Events
12.8. Adding SSH Monitoring Tests
12.8.1. Overview
12.8.2. Modeling Plugin Test Data Test Data for an ObjectMap Test Data for a RelationshipMap Test Data for a List of Data Maps
12.8.3. Data Point Parser Test Data Test Data for Device-Level Parsers Test Data for Component Parsers
12.8.4. Running the Tests
13. Extending the User Interface
13.1. Overview of the Zenoss UI Technologies
13.1.1. HyperText Markup Language (HTML)
13.1.2. Cascading Style Sheets (CSS)
13.1.3. Zope 2, ZPT and TAL
13.1.4. ZPT and Macro Expansion for TAL (METAL)
13.1.5. JavaScript / AJAX
13.1.6. JavaScript libraries: YUI and MochiKit
13.2. Customizing the Navigation Bar
13.2.1. Adding a link
13.2.2. A Simple HTML Page
13.2.3. A Simple TAL and METAL page
13.3. Customizing the Logo
13.4. Zope 2 Page Templates, TAL and METAL and Zenoss
13.4.1. Tips
13.5. Zope 3 Views Explained
13.5.1. The Zope 2 Way
13.5.2. The Zope 3 Way
13.6. Other Customizations
13.6.1. Adding Tabs
13.6.2. Adding a Dialog
13.6.3. Adding a New Menu or Menu Item
13.6.4. Creating a Table Using ZenTableManager
13.6.5. Creating an Editable Table
13.6.6. How to Save Properties via an Edit Screen
13.7. Creating a Dashboard Portlet
13.7.1. Create a ZenPack
13.7.2. Write the Python back-end code
13.7.3. Write the JavaScript Portlet
13.7.4. Register the portlet
13.8. Debugging Tips
14. Reports
14.1. Adding a New Report
14.2. Plugins
14.3. Adding Export Buttons to Reports
15. Migrating Zenoss Code
15.1. Introduction and Steps
15.2. How It Works
15.3. What You Write
15.3.1. Implement cutover()
15.3.2. Supporting Code
15.3.3. Testing and Deployment
16. Testing
16.1. Zenoss Unit Tests
16.1.1. Introduction
16.1.2. doctest Testing
16.1.3. Zenoss' Test Runner An Example Unit Test
16.1.4. Integrating With Buildbot
16.1.5. JavaScript Test Framework
16.2. Functional User Interface Testing
16.2.1. Introduction
16.2.2. Installing and Running Installing and Configuring Mac OS X
16.3. Where to Get More Information
A. Event Database Dictionary
B. TALES Expressions
B.1. Examples
B.1.1. ping
B.1.2. DNS forward lookup
B.1.3. DNS reverse lookup
B.1.4. snmpwalk
B.2. TALES Device Attributes
B.3. TALES Event Attributes
Comments (0)