Install and compile the Nagios document quickly in CentOS 6.5
Install and compile the Nagios documentation-all virtual environments in CentOS 6.5.
The purpose of writing this document is to facilitate and quickly deploy Nagios, which involves configurations that you like. You can modify and apply the configurations on your own.
Network Monitor Nagios Overview
Nagios construction and Configuration
Build a Nagios monitoring platform in the Nginx Environment
Configure the basic Nagios System on RHEL5.3 (using Nagios-3.1.2)
CentOS 5.5 + Nginx + Nagios monitoring and control terminal installation and Configuration Guide
Install Nagios Core for Ubuntu 13.10 Server
1. download and install the required software
1. yum install gcc mysql httpd php gd openssl-devel mysql-server vim wget
Wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.7.tar.gz
Wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
Wget http://nchc.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.14/nrpe-2.14.tar.gz
Ls can see the nagios-4.0.7.tar.gz nagios-plugins-2.0.3.tar.gz nrpe-2.14.tar.gz
Yum install wget httpd php gcc glibc-common gd-devel make net-snmp
Useradd nagios
Passwd nagios
Groupadd nagcmd
Usermod-a-G nagcmd nagios
(Nagcmd: x: 504: nagios)
Tar-xvzf nagios-4.0.7.tar.gz
Cd nagios-4.0.7
./Configure-with-command-group = nagcmd
You can first./configure-help first to check the help. It should be the main nagios user by default, and you do not need to specify-with-nagios-user or anything else.
Make all
Make install
Make install-init
Install the init script in/etc/rc. d/init. d.
Make install-commandmode
This installation and configuration permission
Directory's external command file
Make install-config
This installation **/usr/local/nagios/etc configuration file example
Before modifying these sample files
Use Nagios. Read the HTML document
Make install-webconf
This Apache configuration file for installing Nagios
Web Interface
Cp-R contrib/eventhandlers // usr/local/nagios/libexec/
(-R: recursively copy the directory, that is, copy the directory together with the subdirectories and files under the directory .)
Chown-R nagios: nagios/usr/local/nagios/libexec/eventhandlers
/Usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios. cfg (check whether the configuration file has an error)
{[Root @ Nagios libexec] # chown-R nagios: nagios/usr/local/nagios/libexec/eventhandlers/
[Root @ Nagios libexec] # ll
Total 4
Drwxr-xr-x. 4 nagios 4096 Oct 21 eventhandlers}
/Etc/init. d/nagios start or service nagios start
Chkconfig -- add nagios
Chkconfig nagios on
Chkconfig httpd on
Service httpd start
2. Create a web User
Switch to ngios user
Htpasswd-c/usr/local/nagios/etc/htpasswd. users nagiosadmin
Enter the password nagios
3. Install nagios-plugins
Tar-xvzf nagios-plugins-2.0.3.tar.gz
Cd nagios-plugins-2.0.3
./Configure {-with-nagios-user = nagios-with-nagios-group = nagios}
Make
Make install
You can skip the previous step and do it once.
Chkconfig nagios on or chkconfig-level 35 nagios on
Chkconfig httpd on or chkconfig-level 35 httpd on
4. Disable firewall and selinux
Service iptables stop
Vim/etc/sysconfig/selinux: Change selinux to "disabled", which requires a restart to take effect.
Http: // 192.168.1.202/nagios/This is the nagios address. You need to enter the nagiosadmin nagios address with the username and password.
****************************** **********
Error: cocould not open command file '/usr/local/nagios/var/rw/nagios. cmd' for update!
This is mainly because apache users do not have permission to execute/usr/local/nagios/var/rw/nagios. cmd,
Solution:
Usermod-a-G nagcmd apache
Add the apache user to the nagios user group.
Date-s adjust the date and time clock-w save
5. Install the NRPE plug-in.
Tar-xvzf nrpe-2.14.tar.gz
Cd nrpe-2.14
./Configure
Make & make install
Make install-plugin
Put check_nrpe under/usr/local/nagios/libex. To use check_nrpe.
**************************************** **************************************** ***
****** **************************************** *****
Install on the monitored machine.
Install Nagios-plugins.
Useradd nagios
Passwd nagios
Tar-xvzf nagios-plugins-2.0.3.tar.gz
Cd nagios-plugins
./Configure
Make
Make install
Chown-R nagios: nagios/usr/local/nagios
Install nrpe-2.14
Tar-xvzf nrpe-2.14.tar.gz
Cd nrpe-2.14
./Configure
Make all
Make install-plugin
Make install-daemon
Make install-daemon-config
Yum install xinetd
Chkconfig -- add xinetd
Chkconfig xinetd on
Make install-xinetd
Vim/etc/xinetd. d/nrpe
Add the address of the monitoring host to the file's only_from = 127.0.0.1 192.168.1.107 //, separated by Spaces
Vim/usr/local/nagios/etc/nrpe. cfg
Vim/etc/services
Start nrpe.
/Usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe. cfg-d
Service xinetd restart
Netstat-at | grep nrpe
Netstat-an | grep 5666
Vim/etc/sysconfig/iptables
-A input-m state -- state NEW-m tcp-p tcp -- dport 5666-j ACCEPT)
If you do not add this line, the check_nrpe: Error-cocould not complete SSL handshake will be reported.
Run ipables-F to clear the rule and save it.
Then, check and confirm iptables-L-n.
Service iptables save
Service iptables restart
2. configuration files:
(1)/usr/local/nagios/etc/nrpe. cfg: the configuration file is correctly configured. Multiple IP addresses are separated by commas (,). Note that the space: allowed_host = 127.0.0.1, 192.168.0.1 is incorrect. It must be allowed_host = 127.0.0.1, there cannot be spaces after 192.168.1.202 comma;
(2) check whether the configuration is restricted in/etc/xinetd. d/nrpe file: add the IP address of the server that is allowed to access. Add the IP address in the line "only_from =". Separate multiple IP addresses with spaces, for example, only_from = 192.168.0.8 192.168.1.202.
Controlled terminal:
Vi/etc/xinetd. d/nrpe
Only_from
Vi/usr/local/nagios/etc/nrpe. cfg
Allowed_hosts adds the master IP Address
Service xinetd restart
Master terminal:
/Usr/local/nagios/libexec/check_nrpe-H the monitored IP address is used to test whether the connection is successful.
After modifying nrpe. cfg, you must restart nrpe. I did this:
Pkill nrpe;
/Usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe. cfg-d
2. Add monitoring nodes and services
3. Added verification users.
That is, when you access nagios through the web, you must use this user to log in. Here we add the user test: the password is 12345.
64. [root @ localhost nagios-plugins-1.4.13] # htpasswd-c/usr/local/nagios/etc/htpasswd test
You can use the which command to view the location of the htpasswd command. If the source code is installed in apache, write the full path of htpasswd. The user is test. After the command ends, you will be prompted to enter the password. Enter 123456 here.
65. View authentication File Content
66. [root @ localhost nagios-plugins-1.4.13] # less/usr/local/nagios/etc/htpasswd
67. Now the nagios installation is basically complete. You can access it through the web.
For more details, please continue to read the highlights on the next page: