User Tools

Site Tools


monitoring:nagios_install

Nagios server installation on linux

Base install using provider package

Install Compiler

# yum -y install gcc glibc glibc-common gd gd-devel rpm-build

Install Apache

# yum -y install httpd php openssl

Configure Apache to start on boot

# /sbin/chkconfig --levels 345 httpd on 

Ajust the time zone in php config to prevent errors:

[root@nagios etc]# cat /etc/php.ini | grep zone
date.timezone = 'Europe/Berlin'

Configure iptables to allow Apache traffic

# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
# /etc/init.d/iptables save
# /etc/init.d/iptables restart 

Install & Configure Nagios

# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Install Nagios & Plugins

# yum install nagios nagios-plugins nagios-plugins-setuid 

Create the default Nagios web access user & set a password

# htpasswd -c /etc/nagios/htpasswd.users nagiosadmin 

Verify default config files

# nagios -v /etc/nagios/nagios.cfg 

Start Nagios

# /etc/init.d/nagios start 

Start Apache

# /etc/init.d/httpd start 

Verify Install

  Try logging into your new Nagios installation by going to http://<servername>/nagios/ and logging in with nagiosadmin and the password you set. 

Notes

Install the latest nagios using source package

http://sourceforge.net/projects/nagios/

Install Compiler

# yum -y install gcc glibc glibc-common gd gd-devel rpm-build openssl-devel
# yum -y install doxygen gperf rpm-build 
# cp /tmp/nagios-4.0.2.tar.gz /root/rpmbuild/SOURCES/

Build and compile the rpm package with spec file:

[root@nagios tmp]# tar ztvf nagios-4.0.2.tar.gz | grep spec
-rw-rw-r-- root/root      9062 2013-11-25 15:16 nagios-4.0.2/nagios.spec
[root@nagios tmp]# tar zxvf nagios-4.0.2.tar.gz nagios-4.0.2/nagios.spec
[root@nagios tmp]# rpmbuild -bb nagios-4.0.2/nagios.spec
[root@nagios x86_64]# cd /root/rpmbuild/RPMS/x86_64
[root@nagios x86_64]# ll
total 2780
-rw-r--r-- 1 root root 2746484 Jan  9 12:38 nagios-4.0.2-2.el6.x86_64.rpm
-rw-r--r-- 1 root root   25470 Jan  9 12:38 nagios-contrib-4.0.2-2.el6.x86_64.rpm
-rw-r--r-- 1 root root   66750 Jan  9 12:38 nagios-devel-4.0.2-2.el6.x86_64.rpm
[root@nagios x86_64]# rpm -Uhv nagios-4.0.2-2.el6.x86_64.rpm

[root@nagios x86_64]# htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
New Password: xxx
[root@nagios x86_64]# service nagios start 

NRPE allows you to remotely execute Nagios plugins on other Linux/Unix machines. This allows you to monitor remote machine metrics (disk usage, CPU load, etc.). NRPE can also communicate with Windows agent addons like NSClient++, so you can check metrics on remote Windows machines as well.

NSCA allows you to integrate passive alerts and checks from remote machines and applications with Nagios. Useful for processing security alerts, as well as deploying redundant and distributed Nagios setups.

For NRPE v2.15, extract the spec file before doing the rpmbuild, and uncomment the line

cp init-script ${RPM_BUILD_ROOT}%{_init_dir}/nrpe

Nagios web users are managed into the file:

/etc/nagios/cgi.cfg
monitoring/nagios_install.txt · Last modified: 2021/01/01 21:25 (external edit)