Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


nagios_4_nagiosgraph_and_nagvis_on_centos_6.4

This is an old revision of the document!


Nagios 4 - CentOS 6.4

Nagios 4 is not available via repo (yet) so we install from source.

Install requisites

yum install -y wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel net-snmp-utils

Compile Nagios from source

Download source from Nagios

Extract source code:

tar zxvf nagios-4.0.1.tar.gz

Create user and group:

useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios

Extract source code:

tar zxvf nagios-4.0.1.tar.gz
tar zxvf nagios-plugins-1.5.tar.gz

Configure:

cd nagios-4.0.1
./configure --with-command-group=nagcmd

Compile and install:

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

Post configuration

cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
chown nagios.nagiocmd /usr/local/nagios/var/rw
chown nagios.nagcmd /usr/local/nagios/var/rw
chmod u+rwx /usr/local/nagios/var/rw
chmod g+rwx /usr/local/nagios/var/rw
chmod g+s /usr/local/nagios/var/rw
/etc/init.d/nagios start
/etc/init.d/httpd start

Create web user

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Install plugins

cd nagios-plugins-1.5
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

Start Nagios at boot

chkconfig --add nagios
chkconfig --level 35 nagios on
chkconfig --add httpd
chkconfig --level 35 httpd on

Open firewall

Edit /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

Restart iptables:

service iptables restart

SELinux

chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/
chcon -R -t httpd_sys_script_rw_t /usr/local/nagios/var/rw

HTTP index page

Give the Nagios localhost http check something

touch /var/www/html/index.html

Test

Nagios should be running on your webserver /nagios

nagios_4_nagiosgraph_and_nagvis_on_centos_6.4.1402403436.txt.gz · Last modified: 2014/06/10 12:30 by admin