1. The dependency between nagios and the running of basic Nagios components depends on httpd, gcc, and gd. Make sure that the following software packages have been installed with Httpdgccglibcglibc-commongdgd-develmysqlmysql-serverphpgd and other software packages 2 Add users and groups required for running nagios # groupaddnagcmd # useradd-mn
1. Solve the dependency between nagios Installation
The running of basic Nagios components depends on httpd, gcc, and gd.
Make sure that the following software packages are installed
Httpd gcc glibc-common gd-devel mysql-server php gd and other software packages
2. Add users and groups required for running nagios
# Groupadd nagcmd
# Useradd-m nagios
# Usermod-a-G nagcmd nagios
# Usermod-a-G nagcmd apache
Note: Add apache to the nagcmd group so that you have sufficient permissions to operate nagios through web interfaces;
3. Install and compile nagios
# Tar xvf nagios-3.1.2.tar.gz
# Cd nagios-3.1.2
#./Configure-with-command-group = nagcmd -- enable-event-broker
# Make all
# Make install
# Make install-init
# Make install-config
# Make install-commandmode
4. Configure the mail address to receive the nagios warning. The default mail address is the native nagios user.
# Vim/usr/local/nagios/etc/objects/contacts. cfg
Email nagios @ localhost # This Email is default
5. Create the nagios web program file in the httpd configuration file directory. The file is in conf. d.
# Make install-webconf
6. Create a user and password for nagios web, and use a user account to log on to nagios through web Authentication.
# Htpasswd-c/usr/local/nagios/etc/htpasswd. users nagiosadmin
Restart httpd after configuration.
# Service httpd restart
7. Compile and install nagios-plugins
# Tar xvf nagios-plugins-1.4.14.tar.gz
# Cd nagios-plugins-1.4.14
#./Configure-with-nagios-user = nagios-with-nagios-group = nagios
# Make
# Make install
8. Configure and start nagios
(1) Add nagios as a system service and add it to the auto start service queue
# Chkconfig -- add nagios
# Chkconfig nagios on
(2) Check the syntax of nagios configuration file.
#/Usr/local/nagios/bin/nagios/-v/usr/local/nagios/etc/nagios. cfg
Note: if there is an error in the syntax check, modify it according to the error prompt and check again.
(3) Check whether selinux is enabled on the host,
# Getenforce
If selinux is enabled, the running of the nagios web cgi program is denied by default.
1. If the selinux displayed by getenforce is Enforcing,
Selinux can be disabled.
Setenforce 0 note this method only temporarily disables selinux. When the machine restarts,
Selinux is also enabled
2 If you want selinux to be permanently disabled, You need to configure/etc/sysconfig/selinux
Change SELINUX = enforcing to SELINUX = disabled.
3. To ensure security, you can run the nagios CGI program without shutting down selinux. Of course, you need to modify the file tag.
# Chcon-R-t httpd_sys_content_t/usr/local/nagios/share
# Chcon-R-t httpd_sys_content_t/usr/local/nagios/sbin
(3) view nagios on the web page
Http: // IP/nagios
Provide the account and password when viewing