Over the past 18 months the developers at Zenoss have used a variety of development environments and methods to productively work with Zenoss, but there are a lot of best practices that have emerged out of this diversity.
I develop Zenoss primarily on Mac OS X, with some work done on Ubuntu when necessary. I normally use Eclipse as my development editor, although I’ll often just use vim when doing quick changes or bug fixes. In either case, careful setup of the Zenoss environment is key to being able to productively work with both the new development version and with the shipping versions that require maintenance.
The environment you get by default when you check out the source version of Zenoss from the source repository, or from a source tarball, is not necessarily setup in the best way to develop productively using tools like Eclipse.
The rest of this post will document how both my Mac OS X and Ubuntu environments are initially configured so that a working source Zenoss installation is realized.
Mac OS X Prerequisites
These prerequisite instructions assume Mac OS X 10.5 Leopard; 10.6 Snow Leopard will not be able to compile Zenoss’s third-party dependencies, so an additional work-around is required for that platform until Zenoss moves to Python 2.6.
- Install Xcode. Why? Installs the GNU C/C++ compiler and other command-line development tools needed to build dependencies used by Zenoss.
- Install Universal Subversion 1.6.x from CollabNet Community. Why? Leopard only comes with Subversion 1.4.x. This version is not compatible with the Subclipse plug-in for Eclipse that will be used later. In order to be able to use both the command-line and Eclipse Subversion versions simultaneously on the same checked our source, the release of subversion should match. This installation will place the Subversion binaries in
/opt/subversionand should automatically add it to your
- Install MySQL Community Edition 5.1 32-bit. Why? Zenoss needs MySQL for storage of event data.
These prerequisite instructions assume Ubuntu 9.04 32-bit Desktop Edition. Installing the server edition or one with different options may require additional prerequisites to be installed.
- Install Subversion. Why? Working with the Zenoss product in source form requires Subversion to access the source repositories (it is also possible to build directly from a source tarball, but this is not discussed here).
sudo apt-get -y install subversion
- Install MySQL. Why? Zenoss needs MySQL for storage of event data.
sudo apt-get -y install mysql-client mysql-server libmysqlclient15-dev
- Install additional development environment tools. Why? Zenoss third-party dependencies require several binaries to be built from source.
sudo apt-get -y install patch make vim gcc g++ autoconf
- Install SNMP support. Why? Zenoss requires SNMP libraries for monitoring, and having a local SNMP agent is useful for testing.
sudo apt-get -y install libsnmp-base snmp snmpd
- Install Liberation TrueType fonts. Why? Graphs generated by RRDtool will not contain the correct glyphs without this font package.
sudo apt-get -y install ttf-liberation
Configuring Eclipse will require determining where you want to work with your Zenoss installation, and installing Eclipse plug-ins to provide the features required for Python and Subversion support.
- Create your Zenoss root directory:
- Create and run a
setup.shscript that will configure needed environment variables for zenoss. This script can be started from your log in profile if desired.
cd $HOME/zenoss cat > zenoss-config.sh <<EOF ZENHOME=$HOME/zenoss/zenhome PYTHONPATH=$ZENHOME/lib/python PATH=\$ZENHOME/bin:\$PATH export ZENHOME PYTHONPATH PATH EOF chmod +x zenoss-config.sh . zenoss-config.sh mkdir $ZENHOME
- Checkout the Zenoss source installation tree. Why? This tree is used to bootstrap the installation from the source repository and create a running Zenoss installation. We’ll need this before we modify it to fit the needs of our development environment.
svn co http://dev.zenoss.org/svn/trunk/inst inst
- Run the installation script to checkout, compile, and configure a zenoss environment. If you need to customize your MySQL configuration at all do not use the
cd inst ./install.sh --no-prompt
- Modify the
zensocketfile to be setuid root. Why? Some of the Zenoss daemons use a privileged port and making the file owned by root and accessible by the Zenoss user allows the daemons to be run as a non-priviledged user but still use the privileged port.
sudo chown root:id -g
$ZENHOME/bin/zensocket sudo chmod 04750 $ZENHOME/bin/zensocket
In Part 2 of this series, we’ll download and configure the Eclipse IDE.