Launching Multiple Nagios instances on the same server

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
rshankar93
Posts: 7
Joined: Fri Jan 31, 2014 1:05 pm

Launching Multiple Nagios instances on the same server

Post by rshankar93 »

I have a server on which I have installed nagios. I have duplicated the nagios.cfg file and changed some configuration properties in the duplicated file. I am trying to now launch both instances of nagios. However, both these instances would be listening on the same port. I wasn't able to find a configuration property for the port in nagios.cfg. How do I go about launching both these nagios instances, but on different ports?
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: Launching Multiple Nagios instances on the same server

Post by jsmurphy »

The devs may need to correct me here as my knowledge in this area is a bit out of date. There are several reasons why you probably shouldn't run multiple instances of Nagios on a single box but there's one reason in particular why you may not be able to at all. Historically in versions 2.x and early 3.x there was a particularly nasty bug where Nagios could end up running a duplicated process that would cause all kinds of unexpected weirdness. As a result there were some fail safes built in that would prevent a duplicate process running... I don't know for certain if this would affect a separate install but I suspect it might.

If you want to try it out anyway, basic Nagios Core doesn't (as far as I can remember off hand) use any port other than the basic http port. You can change this by telling Apache to bind to a different port for one of the installs. http://httpd.apache.org/docs/current/bind.html
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Launching Multiple Nagios instances on the same server

Post by abrist »

If you do this, I would highly suggest you run them in chroots. You may run into issues if they share configs.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
emikulic
Posts: 2
Joined: Fri Jun 27, 2014 3:09 pm

Re: Launching Multiple Nagios instances on the same server

Post by emikulic »

I believe this should be possible if compiling from source and into different directories like:

#!/bin/bash

#
# custom nagios 4.0.7 build
# see configure --help
#
thishomedir="nagios-2"
thishomefile="nagios-2"

./configure \
--prefix=/usr/local/${thishomedir} \
--exec-prefix=/usr/local/${thishomedir} \
--with-lockfile=$prefix/var/nagios-2.lock \
--with-cgiurl=/${thishomedir}/cgi-bin \
--with-htmurl=/${thishomedir} \
--with-httpd-conf=/etc/httpd/conf.d \
--with-nagios-user=nagios \
--with-nagios-group=nagios \
--with-command-user=nagios \
--with-command-group=nagcmd
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Launching Multiple Nagios instances on the same server

Post by tmcdonald »

Thank you for the input, but this thread is somewhat old and the original poster has not been back in quite a while. I will be locking this thread now.
Former Nagios employee
Locked