Building Nagios on CentOS 5

Nagios Core

Source used: nagios-3.2.0

Prepare user and group:

useradd -r -d /var/log/nagios -s /bin/sh -c "nagios" nagios
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -G nagcmd nagios
/usr/sbin/usermod -G nagcmd apache

Compile and install:

cd /unpacked-src-folder
./configure \
	--prefix=/usr \
	--exec-prefix=/usr/sbin \
	--bindir=/usr/sbin \
	--sbindir=/usr/lib/nagios/cgi \
	--libexecdir=/usr/lib/nagios/plugins \
	--datadir=/usr/share/nagios \
	--sysconfdir=/etc/nagios \
	--localstatedir=/var/lib/nagios \
	--with-init-dir=/etc/rc.d/init.d \
	--with-cgiurl=/nagios/cgi-bin \
	--with-htmurl=/nagios \
	--with-lockfile=/var/run/nagios.pid \
	--with-nagios-user=nagios \
	--with-nagios-group=nagios \
	--with-file-perfdata \
	--disable-embedded-perl \
	--without-perlcache \
	--with-gd-lib=/usr/lib \
	--with-gd-inc=/usr/include \
	--with-template-objects \
	--with-template-extinfo

make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf

Plugins

Source used: nagios-plugins-1.4.14

./configure \
 --prefix=/usr \
 --libexecdir=/usr/lib/nagios/plugins \
 --sysconfdir=/etc/nagios \
 --with-cgiurl=/nagios/cgi-bin \
 --without-ipv6

make
make install

Also install dependencies using cpan:

install Net::SNMP

NRPE

Source used: nrpe-2.12

./configure \
  --prefix=/usr \
  --libexecdir=/usr/lib/nagios/plugins \
  --sysconfdir=/etc/nagios

make all
cp src/check_nrpe /usr/lib/nagios/plugins/

Additional steps for a monitored target

Install nrpe daemon:

# setup the daemon
cp src/nrpe /usr/bin/
chmod 755 /usr/bin/nrpe
chown root:root /usr/bin/nrpe

# setup the config file
mkdir -p /etc/nagios/
cp sample-config/nrpe.cfg /etc/nagios/

# setup the init script
cp init-script /etc/init.d/nrpe
chmod 755 /etc/init.d/nrpe
chown root:root /etc/init.d/nrpe
chkconfig nrpe on

NSCA

Source used: nsca-2.7.2

./configure --prefix=/usr --sysconfdir=/etc/nagios
make all
cp src/nsca /usr/bin/
cp sample-configs/nsca.cfg /etc/nagios/

Edit the config file /etc/nagios/nsca.cfg to your needs. Normally these:

# this should match with the option "command_file=" in nagios.cfg
command_file=/var/lib/nagios/rw/nagios.cmd

alternate_dump_file=/var/lib/nagios/rw/nsca.dump

Create /etc/xinetd.d/nsca for running by xinetd:

nsca
# default: on
# description: NSCA (Nagios Service Check Acceptor)
service nsca
{
        disable = no
        flags           = REUSE
        socket_type     = stream
        wait            = no
        user            = nagios
        group           = nagios
        server          = /usr/sbin/nsca
        server_args     = -c /etc/nagios/nsca.cfg --inetd
        #log_on_failure  += USERID
        #only_from       = 127.0.0.1
}
nagios/building_from_source_on_centos_5.txt · Last modified: 2010-05-11 18:11 by admin
Back to top
GNU Free Documentation License 1.2
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0