Requirements Description :
Recently, we are ready to deploy monitoring platform to the online production environment, monitor the resource usage and service of each system, and deploy with Nagios core version.
Nagios Core is an open source version of the software that is free for Nagios XI to be on the night shift.
Environmental Information :
Operating system version: RedHat 6.6 x64
installation process :
1. Set the Selinx to Disabled or permissive
[Email protected] ~]# sed-i ' s/selinux=.*/selinux=disabled/g '/etc/selinux/config
[Email protected] ~]# Getenforce
Permissive
2. Installing dependent Packages
Yum Install GCC wget Unzip Perl Postfix
3. Download and upload the Nagios-core package
:
Https://www.nagios.org/downloads/nagios-core/thanks/?skip=1&product_download=nagioscore-source
This example installs the version :
Nagios-4.4.1.tar.gz
upload the software to the specified directory :
[Email protected] ~]# cd/opt/softwares/; ls -l #实际情况中可以上传软件到自己指定的目录中. 11032 1 11296403 to One: nagios-4.4. 1. tar. gz
4. Unzip, compile, install
[Email protected] nagios-4.4. 1 tar zxf nagios-4.4. 1. Tar . Gz[[email protected] Nagios-4.4. 1] # CD nagios-4.4. 1 [email protected] Nagios-4.4. 1] #./Configure[[email protected] Nagios-4.4. 1 make all
5. Create user, user group
[Email protected] nagios-4.4. 1 Make Install-groups---G Nagios nagios[[email protected] Nagios-4.4 . 1] # usermod-a-G Nagios Apache
[[email protected] nagios-4.4.1]# ID Nagios
uid=500 (Nagios) gid=499 (Nagios) groups=499 (Nagios)
[[email protected] nagios-4.4.1]# ID Apache
uid=48 (Apache) gid=48 (Apache) groups=48 (Apache), 499 (Nagios
6. Create binary command, cgi,html file
[Email protected] nagios-4.4. 1 Make Install
7. Install related process files (install startup script), increase httpd boot start, Nagios boot up
[Email protected] nagios-4.4.1]# Make Install-Daemoninit/usr/bin/Install-c-m755-d-o root-g root/etc/INIT.D/usr/bin/Install-c-m755-O root-g Root startup/default-init/etc/init.d/NagiosInit Script Installed * * *
[Email protected] nagios-4.4.1]# chkconfig--level 2345 httpd on
[Email protected] nagios-4.4.1]# Chkconfig--list | grep httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[Email protected] nagios-4.4.1]# Chkconfig--list | grep Nagios
Nagios 0:off 1:off 2:on 3:on 4:on 5:on 6:off
8. Installing external command files
[email protected] nagios-4.4.1]# make Install-commandmode
/usr/bin/install-c-M 775-o nagios-g nagios-d/USR/LOCAL/NAGIOS/VAR/RW
chmod G+S/USR/LOCAL/NAGIOS/VAR/RW
External Command Directory configured * * *
9. Install the configuration file
[Email protected] nagios-4.4.1]# Make Install-Config/usr/bin/Install-c-m775-O nagios-g nagios-d/usr/local/nagios/etc/usr/bin/Install-c-m775-O nagios-g nagios-d/usr/local/nagios/etc/Objects/usr/bin/Install-c-b-M664-O nagios-g nagios sample-config/nagios.cfg/usr/local/nagios/etc/nagios.cfg/usr/bin/Install-c-b-M664-O nagios-g nagios sample-config/cgi.cfg/usr/local/nagios/etc/cgi.cfg/usr/bin/Install-c-b-M660-O nagios-g nagios sample-config/resource.cfg/usr/local/nagios/etc/resource.cfg/usr/bin/Install-c-b-M664-O nagios-g nagios sample-config/template-Object/templates.cfg/usr/local/nagios/etc/objects/templates.cfg/usr/bin/Install-c-b-M664-O nagios-g nagios sample-config/template-Object/commands.cfg/usr/local/nagios/etc/objects/commands.cfg/usr/bin/Install-c-b-M664-O nagios-g nagios sample-config/template-Object/contacts.cfg/usr/local/nagios/etc/objects/contacts.cfg/usr/bin/Install-c-b-M664-O nagios-g nagios sample-config/template-Object/timeperiods.cfg/usr/local/nagios/etc/objects/timeperiods.cfg/usr/bin/Install-c-b-M664-O nagios-g nagios sample-config/template-Object/localhost.cfg/usr/local/nagios/etc/objects/localhost.cfg/usr/bin/Install-c-b-M664-O nagios-g nagios sample-config/template-Object/windows.cfg/usr/local/nagios/etc/objects/windows.cfg/usr/bin/Install-c-b-M664-O nagios-g nagios sample-config/template-Object/printer.cfg/usr/local/nagios/etc/objects/printer.cfg/usr/bin/Install-c-b-M664-O nagios-g nagios sample-config/template-Object/switch.cfg/usr/local/nagios/etc/objects/switch.cfgConfig Files Installed * * *Remember, these is*sample* config files. You'll need to readThe documentation for MoreInformation on what to actually defineservices, hosts, etc. to fit your particular needs.
Note: These are some sample configuration files, such as nagios.cfg, which you need to use when starting Nagios.
10. Install the Apache configuration file as the httpd configuration file
[Email protected] nagios-4.4. 1 Make Install-webconf/usr/bin/install644 sample-config/httpd.conf/etc/httpd/ conf.d/nagios.confif01 thenln -S/ etc/httpd/conf.d/nagios.conf/etc/apache2/sites-enabled/nagios.conf; fi file Installed * * *
11. Configuring the firewall or shutting down the firewall
Configuration allows 8 ports to enter:
-J Acceptservice iptables Save
Turn off the firewall and turn off boot:
Service Iptables Stop
[Email protected] nagios-4.4.1]# chkconfig--level 2345 iptables off
[Email protected] nagios-4.4.1]# Chkconfig--list | grep iptables
Iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:of
12. Create Nagios Admin Account
[Email protected] nagios-4.4. 1] # htpasswd-c/usr/local/nagios/etc/htpasswd.users nagiosadminnew Password: #输入新密码Re-type new Password: for user nagiosadmin
13. Launch Apache service, Nagios Core Service
[Email protected] nagios-4.4. 1 ]# service httpd start[[email protected] Nagios-4.4. 1]# service Nagios start
14. Access testing via the page
Access address: Http://192.168.53.25/nagios Enter Nagios admin account, password to log in.
After successful login, the page is as follows:
See hosts,services as below error:
Note: The above error indicates that there are no commands, that is, the command is extinguished in/usrlocal/nagios/libexex, you need to install Nagios-plugins to install the corresponding command
15. Download, upload nagios-plugins compression pack
:
https://www.nagios.org/downloads/nagios-plugins/
Package: nagios-plugins-2.2.1.tar.gz
[Email protected] softwares]# cd/opt/softwares/; ls 1 2728818 to : nagios-plugins- 2.2. 1. tar. gz
16. Install dependent packages, unzip, compile, install
Yum Install GCC Make wget openssl-devel net-snmp net-snmp-utils
tar zxf nagios-plugins-2.2. 1. Tar . gz [[email protected] softwares]# CD Nagios-plugins-2.2. 1 [email protected] Nagios-plugins-2.2. 1
[[email protected] nagios-plugins-2.2.1]# make
[[email protected] nagios-plugins-2.2.1]# make install
Note: Plug-in installation is complete
17. Re-test on the Nagios page and click on the command menu of localhost in the hosts. Re-schedule the next check "To view the hosts status
Note: The instructions have been successful, and for the inspection in services, the scheduled time will be changed after a certain amount of time.
Status of Servies:
18. For HTTP check, create index.html file in local/var/www/html to resolve this warning
[Email protected] libexec]# cd/var/www/html/Touch index.html
After the configuration is complete, the status of the HTTP service:
To this, all the nagios-core,nagios-plugins have been installed to complete!
Document creation time: July 31, 2018 12:58:55
What does Nagios (Nagios core) install in a Linux environment?