First of all, the environment of their own building. RedHat6.4 system nagios-4.0.7. Turn off SELinux and iptables services
1, get ready to work, install the software that Nagios needs
Apache
Php
GCC compiler
GD Development Libraries
Yum install httpd php gcc glibc glibc-common gd gd-devel
2, create the accounts and groups used by Nagios, first switch to Administrator account
[Email protected] ~]useradd-m Nagios
[Email protected] ~]echo Nagios |passwd--stdin Nagios
[Email protected] ~]# Groupadd nagcmd
[Email protected] ~]# Usermod-ag nagcmd Nagios
[Email protected] ~]# Usermod-ag nagcmd Apache
3. Download Nagios and Nagio-plugin
[[Email protected] ~] #wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz
[[Email protected] ~] #wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz
4, compile the installation (install binaries, init script, sample config files and set permissions on the external command directory.)
[Email protected] ~]#./configure--with-command-group=nagcmd
[[Email protected] ~] #make All
[[Email protected] ~] #make Install
[[Email protected] ~] #make install-init
[[Email protected] ~] #make install-config
[[Email protected] ~] #make install-commandmodes
[[Email protected] ~] #make Install-commandmode
5, custom configuration file
[[Email protected] ~] #vim/usr/local/nagios/etc/objects/contacts.cfg
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/44/56/wKiom1PgzwKAKX-cAADephdrKnU106.png "title=" capture. PNG "alt=" Wkiom1pgzwkakx-caadephdrknu106.png "/>
Configure the administrator's email address, when monitoring to a problem will send mail to the Administrator mailbox 6, configure the Web interface management interface, and create login to the Nagios management interface account password, and then restart the Apache service to make the configuration file effective [[email protected] ~] #make install-webconf[[email protected] ~] #htpasswd -c /usr/local/nagios/etc/ Htpasswd.users nagiosadmin //htpasswd.users the file name must be written correctly [[email protected] ~]# SERVICE HTTPD RESTART7, compiling and installing nagios-plugin[[email protected] ~] #tar -zxvf Nagios-plugins-2.0.3.tar.gz -c /usr/src/[[email protected] ~] #cd /usr/src/ Nagios-plugins-2.0.3/[[email protected] ~] #ls [[email protected] ~]#./configure --with-nagios-user=nagios --with-nagios-group=nagios[[email protected] ~] #make [[email protected] ~] #make install [[email protected] ~] #cd [[email protected ] ~] #chkconfig --add nagios[[email protected] ~] #chkconfig nagios on[[email protected] ~] #service &nbsP;nagios start [[email protected] ~] #service nagios restart [[email protected] ~]#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg //Check the configuration file for errors or warnings, and if not, start the Nagios service [[email protected] ~]# Service nagios start7, now we can test nagios monitoring native localhost, login server ip/nagios I'll let you enter it. htpasswd created user name and password (blue border) I wipe, the picture how can not upload it? Can't upload the picture just forget it.
This article is from "Linux rookie" blog, please be sure to keep this source http://ludihua.blog.51cto.com/4601284/1536113