I would like to do this as well for a few reasons. This is pretty common in the Nix* world to be able to run multiple instances of whatever is needed for hosting, multi tenancy, operational, test, or load purposes. Usually just entails setting new base directories for each instance, a different init script, maybe a service name, and if it binds to a port, and alternate port number.
I am working on it a bit myself to get my own going v4.0.7 second nagios server on CentOS 6.5 x64 going.
It seems a few, but not enough, of the variables are avail during compile (./configure) but not all.
I am starting to look at items it seems are hard coded into the nagios.spec file.
In particular init script names it would seem but I am no expert on this and just starting down this road.
It seems out of the box its not cut and dry.
My configure items are straight forwards and I simply place them in a script:
Code: Select all
#!/bin/bash
#
# custom nagios 4.0.7 build
# see configure --help
#
mybasename="nagios2"
thisuser="nagios2"
thisgroup="nagios2"
thiscmdgroup="nagcmd2"
thishomedir="nagios2"
thishomefile="nagios2"
./configure \
--prefix=/usr/local/${thishomedir} \
--exec-prefix=/usr/local/${thishomedir} \
--with-lockfile=$prefix/var/${mybasename}.lock \
--with-cgiurl=/${thishomedir}/cgi-bin \
--with-htmurl=/${thishomedir} \
--with-httpd-conf=/etc/httpd/conf.d \
--with-nagios-user=${thisuser} \
--with-nagios-group=${thisgroup} \
--with-command-user=${thisuser} \
--with-command-group=${thiscmdgroup}
exit
But the init items, http conf file, service names, process names, and a couple other items that typically land in /etc I don't have figured out yet.
That is where I started out editing the spec file to define new variables so this could be done but that is not so straight forwards.
Would be helpful to see the necessary variables created/exposed for configure script.