Below are the steps followed:
Nagios core version is 4.2.4 and nagios-plugins is on 2.1.4
OS is Oracle Linux 6.8
Steps followed:
1) Download Nagios Core from
https://www.nagios.org/downloads/nagios-4.2.4.tar
2) Download Nagios plugins from
https://www.nagios.org/downloads/nagios ... -2.1.4.tar
3) Install pre-requisite rpm using yum utility httpd,php,gcc,glibc,glibc-common,gd,gd-devel
4) create nagios OS user and nagcmd group and attach group to the user
5) Untar the software to the server under /root/repos directory
6) Change the directory to /root/repos/nagios-4.2.4 directory and start configuring nagios
• [root@ambari nagios-4.2.4]# ./configure --with-command-group=nagcmd
*** Configuration summary for nagios 4.2.4 12-07-2016 ***:
General Options:
-------------------------
Nagios executable: nagios
Nagios user/group: nagios,nagios
Command user/group: nagios,nagcmd
Event Broker: yes
Install ${prefix}: /usr/local/nagios
Install ${includedir}: /usr/local/nagios/include/nagios
Lock file: ${prefix}/var/nagios.lock
Check result directory: ${prefix}/var/spool/checkresults
Init directory: /etc/rc.d/init.d
Apache conf.d directory: /etc/httpd/conf.d
Mail program: /bin/mail
Host OS: linux-gnu
IOBroker Method: epoll
Web Interface Options:
------------------------
HTML URL:
http://localhost/nagios/
CGI URL:
http://localhost/nagios/cgi-bin/
Traceroute (used by WAP): /bin/traceroute
Review the options above for accuracy. If they look okay,
type 'make all' to compile the main program and CGIs.
Compile the nagios source code
• [root@ambari nagios-4.2.4]# make all
• [root@ambari nagios-4.2.4]# make install
• [root@ambari nagios-4.2.4]# make install-init
/usr/bin/install -c -m 755 -d -o root -g root /etc/rc.d/init.d
/usr/bin/install -c -m 755 -o root -g root daemon-init /etc/rc.d/init.d/nagios
*** Init script installed ***
• [root@ambari nagios-4.2.4]# make install-config
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc/objects
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/nagios.cfg /usr/local/nagios/etc/nagios.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/cgi.cfg /usr/local/nagios/etc/cgi.cfg
/usr/bin/install -c -b -m 660 -o nagios -g nagios sample-config/resource.cfg /usr/local/nagios/etc/resource.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/templates.cfg /usr/local/nagios/etc/objects/templates.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/commands.cfg /usr/local/nagios/etc/objects/commands.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/contacts.cfg /usr/local/nagios/etc/objects/contacts.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/timeperiods.cfg /usr/local/nagios/etc/objects/timeperiods.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/localhost.cfg /usr/local/nagios/etc/objects/localhost.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/windows.cfg /usr/local/nagios/etc/objects/windows.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/printer.cfg /usr/local/nagios/etc/objects/printer.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/switch.cfg /usr/local/nagios/etc/objects/switch.cfg
*** Config files installed ***
Remember, these are *SAMPLE* config files. You'll need to read
the documentation for more information on how to actually define
services, hosts, etc. to fit your particular needs.
• [root@ambari nagios-4.2.4]# make install-commandmode
/usr/bin/install -c -m 775 -o nagios -g nagcmd -d /usr/local/nagios/var/rw
chmod g+s /usr/local/nagios/var/rw
*** External command directory configured ***
7) Edit the /usr/local/nagios/etc/objects/contact.cfg config file and change the email address associated with the nagiosadmin contact definition to the address for receiving alerts.
8) Install the nagios web config file in the Apache conf.d directory
• [root@ambari nagios-4.2.4]# make install-webconf
/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf
if [ 0 -eq 1 ]; then \
ln -s /etc/httpd/conf.d/nagios.conf /etc/apache2/sites-enabled/nagios.conf; \
fi
*** Nagios/Apache conf file installed ***
9) Create a nagisoadmin account for logging into the nagios web interface.
• [root@ambari nagios-4.2.4]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin
10) Restart Apache to make the new settings take effect
• [root@ambari nagios-4.2.4]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
11) Install nagios plugin. Change the directory to /root/repos/nagios-plugins-2.1.4
• [root@ambari nagios-plugins-2.1.4]# pwd
/root/repos/nagios-plugins-2.1.4
12) Compile and install the plugin
• [root@ambari nagios-plugins-2.1.4]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
• [root@ambari nagios-plugins-2.1.4]# make
• [root@ambari nagios-plugins-2.1.4]# make intall
• [root@ambari nagios-plugins-2.1.4]# chkconfig --add nagios
• [root@ambari nagios-plugins-2.1.4]# chkconfig nagios on
13) Verify the sample Nagios configuration file
• [root@ambari nagios-plugins-2.1.4]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios Core 4.2.4
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 12-07-2016
License: GPL
Website:
https://www.nagios.org
Reading configuration data...
Read main config file okay...
Read object config files okay...
Running pre-flight check on configuration data...
Checking objects...
Checked 8 services.
Checked 1 hosts.
Checked 1 host groups.
Checked 0 service groups.
Checked 1 contacts.
Checked 1 contact groups.
Checked 24 commands.
Checked 5 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 1 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
14) Start Nagios services
• [root@ambari nagios-plugins-2.1.4]# service nagios start
Starting nagios: done.
Please advise.
Thank you,
Sachin A