Install Nagios, an open-source free network monitoring tool

Source: Internet
Author: User
Operation Process 1) create an account and switch to the root user su-l to create an account named nagios with a given logon password usrsbinuseraddnagiospasswdnagios. Create a user group named nagcmd to execute External commands from the Web interface. Add both nagios users and apache users to this group. Usrsbingroupaddn operation process

1) create an account

Switch to root user

su -l

CreateNagiosAccount with a logon Password

/usr/sbin/useradd nagios passwd nagios

Create a user group namedNagcmdUsed for external execution from Web interfacesCommand. Add both nagios users and apache users to this group.

/usr/sbin/groupadd nagcmd /usr/sbin/usermod -G nagcmd nagios /usr/sbin/usermod -G nagcmd apache

2) download Nagios and plug-in packages (please note that you should not make the same mistake as me. Please download the Chinese Version)

Create a directory to store downloaded files

mkdir ~/downloads cd ~/downloads

Download the software packages for Nagios and Nagios plug-ins (visit http://www.nagios.org/download/ ). When writing this document, the latest Nagios software version is 3.0rc1 and the Nagios plug-in version is 1.4.11.

wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0rc1.tar.gz wget http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz

3) Compile and install Nagios

Expand Nagios source package

cd ~/downloads tar xzf nagios-3.0rc1.tar.gz cd nagios-3.0rc1

Run the Nagios configuration script and use the previously opened users and user groups:

./configure --with-command-group=nagcmd

Compile the Nagios package source code

make all

Install binary programs, initialization scripts, configuration file samples, and set running Directory Permissions

make install make install-init make install-config make install-commandmode

You cannot start Nagios now.-You have to do more...

4) custom configuration

The configuration file is installed in this directory by default./Usr/local/nagios/etcThese sample files can be configured with Nagios to run properly. You only need to make a simple modification...

Use the editor software you are good at to edit this/Usr/local/nagios/etc/objects/contacts. cfgConfiguration file, change email addressNagiosadminThe EMail information in the contact definition information is your EMail information to receive the alarm content.

vi /usr/local/nagios/etc/objects/contacts.cfg

5) configure the WEB interface

Install the Nagios WEB configuration file to the conf. d directory of Apache.

make install-webconf

CreateNagiosadminThe user is used to log on to Nagios WEB interface. Write down the logon password you set and you will use it later.

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Restart the Apache service to make the settings take effect.

service httpd restart

6) Compile and install the Nagios plugin

Expand the source package of the Nagios plug-in

cd ~/downloads tar xzf nagios-plugins-1.4.11.tar.gz cd nagios-plugins-1.4.11

Compile and install the plug-in

./configure --with-nagios-user=nagios --with-nagios-group=nagios make make install

7) Start Nagios

Add Nagios to the service list to enable it automatically when the system starts.

chkconfig --add nagios chkconfig nagios on

Verify the Nagios sample configuration file

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

If no error is reported, you can start the Nagios service.

service nagios start

8) Change SELinux settings

FEdAfter ora and SELinux (secure and enhanced Linux) are released and installed simultaneously, the forced mode is used by default. This will cause an "Internal Service error" message when you try to join the CGI of Nagios.

If SELinux is in forced security mode

getenforce

Make SELinux in allowed Mode

setenforce 0

If you want to change it permanently, you need to change/Etc/selinux/configAnd restart the system.

If you do not disable SELinux or change SELinux permanently, you can enable the CGI Module to specify the forced target mode under SELinux:

chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/ chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

For more information about how to add the target policy's mandatory permissions to the CGI Module of Nagios, see NagiosCommunity.org Wikipedia http://www.nagioscommunity.org/wiki.

9) log on to the WEB interface

Now you can access the WEB interface of Nagios through WEB. You need to enter your username (Nagiosadmin) And password, which you just set, use the browser installed by default in the system, and use the hyperlink below

Http: // localhost/nagios/Note: if the error "You don't have permission to access/nagios/on this server" is reported, You need to installPhpThe plug-in can solve the problem by running the command yum install php-y (yum must ensure that your linux system can be connected to the Internet and the yum can be used normally)

Click "service details" to view the monitoring details of your local machine. You may need some time for Nagios to detect the services on your machine because the detection takes some time.

10) Other changes

Make sure that the firewall rule configuration of your machine allows you to remotely log on to Nagios WEB Services.

The alarm item configured for EMail exceeds the content of this document. Point to your system file and use the website NagiosCommunity.org wiki to find more information, so that your system can send EMail information to external addresses. For more information about notifications, refer to this document.

11) completed

Congratulations, you have successfully installed Nagios, but network monitoring is just the beginning. There is no doubt that you are not only monitoring the local system, so please refer to the following documents...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.