Nagios installation, nagios
Environment: vmware workstation Virtual Machine, server: 192.168.118.128
Server Environment: centos-6.6 nagios-4.1.1 httpd-2.4.20 php-5.6.22
Server installation:
Useradd nagios User Creation
mkdir /usr/local/nagios
chown -R nagios:nagios /usr/local/nagios
Tar-xzvf nagios-4.1.1.tar.gz.gz cd nagios-4.1.1 ll. /configure -- prefix =/usr/local/nagios make all yum install unzip make all make install-init make install-commandmode make install-config chkconfig -- add nagios chkconfig -- level 35 nagios on chkconfig -- list nagios cd .. rz ll tar-xzvf nagios-plugins-2.1.1.tar.gz # plugin installation package tar-xzvf nagios-cn-3.2.3.tar.bz2 ll rm nagios-cn-3.2.3.tar.bz2 ll rz ll tar-jxvf nagios-cn-3.2.3.tar.bz2 # Chinese installation package cd nagios-cn-3.2.3 ll. /configure make all make install cd .. ll mkdir/usr/local/apache2 tar-zxvf httpd-2.4.20.tar.gz cd httpd-2.4.20. /configure -- prefix =/usr/local/apache2 ll vi README more INSTALL. /configure -- prefix =/usr/local/apache2 find/-name apr find/-name APR find/-name apr * # Apr Library supports yum search apr yum install apr. x86_64 apr-util.x86_64 yum remove httpd. /configure -- prefix =/usr/local/apache2 cd .. ll wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz ll rm apr-1.4.5.tar.gz rz ll tar-zxvf apr-1.5.2.tar.gz tar-zxvf apr-util-1.5.4.tar.gz tar-zxvf pcre-8.38.tar.gz cd apr-1.5.2. /configure -- prefix =/usr/local/apr make & make install cd .. cd apr-util-1.5.4. /configure -- prefix =/usr/local/apr-util -- with-apr =/usr/local/apr/bin/apr-1-config make & make install cd .. cd pcre-8.38. /configure -- prefix =/usr/local/pcre make & make install cd .. cd httpd-2.4.20. /configure -- prefix =/usr/local/apache2 -- enable-so -- with-apr =/usr/local/apr -- with-apr-util =/usr/local/apr- util/-- with-pcre =/usr/local/pcre make install cd .. ll tar-zxvf php-5.6.22.tar.gz mkdir/usr/local/php cd php-5.6.22. /configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache2/bin/apxs yum install libxml2 find/-name libxml2 find/-name libxml2 * find/ -name xml2-config yum install libxml2-devel find/-name xml2-config. /configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache2/bin/apxs make test make install
Cp php. ini-development/usr/local/lib/php. ini # php configuration
Configure apache. File Location: usr/local/apache2/conf/http. conf
Change the process startup user to nagios, namely:
User nagios
Group nagios
LoadModule php5_module modules/libphp5.so # Remove the comment before this line
Find DirectoryIndex and add index. php
Added SetHandler application/x-httpd-php to support parsing php.
Add nagios configuration at the end:
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"<Directory "/usr/local/nagios/sbin"> AuthType Basic Options ExecCGI AllowOverride None Order allow,deny Allow from all AuthName "Nagios Access" AuthUserFile /usr/local/nagios/etc/htpasswd Require valid-user</Directory>Alias /nagios "/usr/local/nagios/share"<Directory "/usr/local/nagios/share"> AuthType Basic Options None AllowOverride None Order allow,deny Allow from all AuthName "nagios Access" AuthUserFile /usr/local/nagios/etc/htpasswd Require valid-user</Directory>
Because the access authentication file is specified, you need to create one:
/Usr/local/apache2/bin/htpasswd-c/usr/local/nagios/etc/htpasswd [set your logon username] Press enter and enter the set password.
After the configuration is complete, you can start nagios and apache.
Problems:
Local access is allowed, and other hosts in the LAN are not accessible. If no router is reported, the firewall is blocked. You can turn off the server firewall: service iptables stop or add a new listener port 80 (http. conf) Rules: iptables-I INPUT-p tcp -- dport 80-j ACCEPT
After installing the server, you must configure the corresponding nagios file to monitor other hosts.