Wednesday, April 25, 2007

An SMF package for Maven Continuum

The Continuum continuous build system is excellent for Maven projects (and ant, etc), but it doesn't ship with a good way to start/stop it. It only comes with a start script, and a wrapper for sparc solaris that'll start/stop, which naturally won't work.

So, why not an SMF package?

Download:
GTcontinuum-smf.pkg.gz

Manual Installation:

Decompress:
# gunzip GTcontinuum-smf.pkg.gz
Add the Package:
# pkgadd -d GTcontinuum-smf.pkg

You will be prompted for the install location of continuum, the user and group to run as, and where the Java JDK is located.

Verify SMF sees it:
# svcs continuum
Startup Continuum:
# svcadm enable continuum
Check logs:
# tail -f /var/svc/log/network-continuum\:default.log

Automated Install

Create a response file like this gtcontinuum.cf:

CONTINUUM_HOME=/usr/local/continuum
CONTINUUM_USER=mvnbuild
CONTINUUM_GROUP=other
JAVA_HOME=/usr/java

Run pkgadd using response file:
# echo y | pkgadd -r gtcontinuum.cf -d GTcontinuum-smf.pkg GTcontinuum-smf

I'll post a "how to setup continuum" as well soon, since you'll probably want to change the port that it starts up on.

Cheers

Brian

Compiling Nagios 3.0a3 (and plugins) for OpenSolaris 64bit

Wrestling with the "native" cc in OpenSolaris is not my favorite thing to do, and I really wish the whole project would drop "cc" in favor of gcc.

Nagios is a good example of a "common" application that "just compiles" on Linux, and has to be thoughtfully compiled on OpenSolaris.

By default, Nagios will choose gcc as the compiler, but it links in 32bit libraries (specifically libopenssl.so and libcrypto.so). The native compiler chokes on the plugins (mostly the check_dhcp plugin, but also check_mysql, etc).

But enough of that, here's how to compile Nagios for OpenSolaris in 64bit mode.

Step 1: Download Source
Get GD from here
Get Nagios from here
Get Nagios Plugins from here

Step 2: Create nagios user and group
#groupadd nagios
#useradd -g nagios nagios

Step 3: Build GD
Note: having to dynamically link this in is the default, and preferably there would be a method to just statically link in this library, but for this doc, we'll install GD somewhere common and pass in the search path.

Extract the source:
#gtar xfz gd-2.0.34.tar.gz

Setup Environment:
#export CFLAGS=-m64
#export PATH=$PATH:/usr/ccs/bin

Configure:
#./configure --prefix=/usr/local/gd-2.0.34

Compile:
#make

Install:
#make install

Step 4: Build Nagios

Extract the source:
#gtar xfz nagios-3.0a3.tar.gz

Setup Environment:
#export CFLAGS=-m64
#export LDFLAGS="-L/usr/local/src/gd-2.0.34/lib -R/usr/local/src/gd-2.0.34/lib"

Configure:
#./configure --prefix=/usr/local/nagios-3.0a3 --with-gd-lib=/usr/local/gd-2.0.34/lib \
--with-gd-inc=/usr/local/gd-2.0.34/include \
--with-init-dir=/usr/local/nagios-3.0a3/init.d

Compile:
#make all

Install:
#make install
#make install-init
#make install-commandmode
#make install-config

Step 5: Build Nagios Plugins
Extract the plugins:
#gtar xfz nagios-plugins-1.4.8.tar.gz

Setup Environment:
#export PATH=$PATH:/usr/ccs/bin
#export CFLAGS=-m64
#export LDFLAGS="-Xlinker -64 -L/usr/sfw/lib/amd64 -R/usr/sfw/lib/amd64"

Configure:
#./configure --prefix=/usr/local/nagios-3.0a3

Compile:
#make

Install:
#make install

Step 6: Setup Nagios Configuration
# cd /usr/local/nagios-3.0a3/etc
# cp -p cgi.cfg-sample cgi.cfg
# cp -p commands.cfg-sample commands.cfg
# cp -p localhost.cfg-sample localhost.cfg
# cp -p nagios.cfg-sample nagios.cfg
# cp -p resource.cfg-sample resource.cfg

Step 7: Install SMF package for Nagios
See this post for the SMF package

Cheers

Brian

Friday, April 13, 2007

OpenSolaris - an SMF Package for Nagios

(Updated to be zone-friendly)

While playing around with Nagios, I figured it was time to learn how SMF
works a bit more, and brush on Solaris packaging while I was at it.

I've created an SMF package for Nagios, which I hope others find useful.

The first pass at this allows you to specify the location where nagios is install (detecting /usr/local/nagios is the default action).

In addition, you can specify the username and group that nagios is launched by.

Download:

Without further ado: GTnagios-smf-1.1.pkg.gz

Version 1.1 will create the startup files in /opt/GTnagios-smf, which can be installed in a zone by itself, or made globally available (pkgadd -G).

The first version (if you dont require zones) can be used GTnagios-smf-1.0.pkg.gz Zones are useful, so I'm updating the SMF packages I've written to adhere to their rules.

Manual Installation
Decompress:
# gunzip GTnagios-smf-1.1.pkg.gz
Add the Package:
# pkgadd -d GTnagios-smf-1.1.pkg
Verify SMF sees it:
# svcs nagios
Startup nagios:
# svcadm enable nagios
Check logs:
# tail -f /var/svc/log/network-nagios\:default.log

Automated Install

Automated installs are common, here's how to automate pkgadd.

Create a response file like this gtresponse.cf:
NAGIOS_HOME=/usr/local/nagios
NAGIOS_USER=nagios
NAGIOS_GROUP=nagios
Run pkgadd using response file:
# echo y | pkgadd -r gtresponse.cf -d GTnagios-smf-1.1.pkg GTnagios-smf

I'll publish the "how to make an smf package installer" soon as well.

Cheers

Brian