Nagios: howto become a happy network and system monitoring engineer

Nagios: howto become a happy network and system monitoring engineer

Nagios: howto become a happy network and system monitoring engineer 150 150 Roderick Derks


Here is a list of the commands I used to install all needed software on a Fedora 7 server in a VMware environment to get Nagios and Nagiosgrapher running.

yum -y update

vi /etc/inittab
shutdown -r 0

yum -y install gcc perl-Config-IniFiles net-snmp net-snmp-perl net-snmp-utils perl-Net-SNMP net-snmp-libs

cd /tmp/
tar xvzf nagios-2.9.tar.gz
rm nagios-2.9.tar*
cd nagios-2.9
adduser nagios
mkdir /usr/local/nagios
chown nagios:nagios /usr/local/nagios
grep “^User” /etc/httpd/conf/httpd.conf
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -G nagcmd apache
/usr/sbin/usermod -G nagcmd nagios

./configure –prefix=/usr/local/nagios –with-command-group=nagcmd
make all
make install
make install-init
chkconfig –add nagios
service nagios status
cd /usr/local/nagios/
chown -R nagios:nagios etc/
ln -s /usr/local/nagios/etc/apache/nagios.conf /etc/httpd/conf.d/nagios.conf
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

rsync -avu /usr/local/nagios/
rsync -avu /usr/local/nagios/
mv share share.bak
rsync -avu /usr/local/nagios/
service httpd start

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

tar xvzf nagiosgraph-0.9.0.tgz
cd nagiosgraph-0.9.0
mkdir /usr/local/nagios/nagiosgraph
cp nagiosgraph.conf /usr/local/nagios/nagiosgraph/
cp map /usr/local/nagios/nagiosgraph/
cp /usr/local/nagios/nagiosgraph/
cp show.cgi /usr/local/nagios/nagiosgraph/
vi /usr/local/nagios/nagiosgraph/nagiosgraph.conf

ls -ald /var/log
touch /usr/local/nagios/var/nagiosgraph.log
chown nagios:nagios /usr/local/nagios/var/nagiosgraph.log
vi /usr/local/nagios/nagiosgraph/nagiosgraph.conf
mkdir /usr/local/nagios/nagiosgraph/rrd
chown nagios:nagios /usr/local/nagios/nagiosgraph/rrd
chown -R nagios:nagios /usr/local/nagios/nagiosgraph
vi /usr/local/nagios/nagiosgraph/nagiosgraph.conf
locate perfdata.log
touch /usr/local/nagios/var/perfdata.log
vi /usr/local/nagios/nagiosgraph/nagiosgraph.conf

cd /usr/local/nagios/nagiosgraph/
vi show.cgi

chown nagios:nagios /usr/local/nagios/var/perfdata.log
chmod 664 /usr/local/nagios/var/nagiosgraph.log
chmod 664 /usr/local/nagios/var/perfdata.log
chmod 775 /usr/local/nagios/nagiosgraph/rrd/

chown nagios:nagios ../../var/nagiosgraph.log
chmod 666 ../../var/nagiosgraph.log

yum -y install perl-Config-IniFiles

[root@cacti ~]# scp /lib/ root@
root@’s password: 100% 225KB 224.7KB/s 00:00
[root@cacti ~]# scp /lib/ root@
root@’s password:


NagiosPlugin NSCA

tar xvzf nsca-2.7.2.tar.gz
cd nsca-2.7.2
make all
cp src/nsca /usr/local/nagios/bin
cp /tmp/nsca-2.7.2/sample-config/nsca.cfg /usr/local/nagios/etc/nsca.conf
cp /tmp/nsca-2.7.2/sample-config/nsca.xinetd /etc/xinetd.d/nsca

vi /etc/services

nsca 5667/tcp # NSCA

touch /etc/xinetd.d/nsca

[root@cacti ~]# vi /etc/xinetd.d/nsca
# default: on
# description: NSCA (Nagios Service Check Acceptor)
service nsca
flags = REUSE
socket_type = stream
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nsca
server_args = -c /usr/local/nagios/etc/nsca.cfg –inetd
log_on_failure += USERID
disable = no
#only_from = ezhdevdb02 ezhcom02 ezhcom01

cd /usr/local/nagios/var
touch nsca.dump
chown nagios:nagios nsca.dump
chmod 660 nsca.dump
vi /usr/local/nagios/etc/nsca.cfg


yum install xinetd
chkconfig –add xinetd
chkconfig –level 3 xinetd on
service xinetd start
chkconfig –list
# system-config-securitylevel
add port 5667

example command for executing send_nsca on the commandline:
<servername>;adt-endo_adt;2;TESTJE”| /usr/local/nagios/bin/send_nsca -H <ip_adress_hostserver> -d “;” -c /usr/local/nagios/etc/send_nsca.cfg

Roderick Derks

Liefhebber van fietsen, van het oplossen van IT puzzels, en van het delen van informatie om anderen te helpen.

All stories by:Roderick Derks

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Your Name (required)

    Your Email (required)


    Your Message

      Your Name (required)

      Your Email (required)


      Your Message