Detailed description of Nagios remote monitoring installation and configuration page 1/3

Source: Internet
Author: User

As a system administrator, I am most worried about stopping or stopping network services for important online systems without my knowledge, in addition, it may take a long time for the faulty service or host to know. Especially during holidays, the system administrator is very nervous. To change this passive situation, I recommend the network monitoring software Nagios. I personally think its biggest advantage is that it can send a fault warning text message-as long as the Nagios monitoring object fails, the system automatically sends a text message to the mobile phone. The following is an excerpt from the official Nagios Website:

Nagios is an open source host, service and network monitoring program.
Who uses it? Lots of people, including using big companies and organizationsnagios is an open source software used to monitor hosts, services, and networks. Many large companies or organizations are using it.

Before I came to this organization, I had a netsaint (the old Nagios version) That was monitoring those online servers, but it was not perfect. Then I set up an item, the new monitoring platform Nagios has been deployed to monitor all online servers. So far, 413 hosts and 754 services have been monitored.
Although Nagios is very useful, it is difficult to configure it. I can give it a Chinese name based on its pronunciation-it is hard to die. For this reason, I will try my best to tell you in detail about the Nagios process and my experiences, hoping to help beginners.
Install Required Software
1. Install Nagios

Nagios can run in various versions of Linux and mainstream UNIX environments. The environments I have tried include RedHat Linux, centos, and Debian. In actual O & M, I deployed Nagios with centos 4. After the operating system is installed, you need to turn off all the extra services, leaving only the sshd service. Then, use the wgetdownload source code package nagios-2.6.tar.gzand httpd-2.2.0.tar.gz. Next, install the software separately. The process is as follows:
1. Decompress Nagios. Tar zxvf nagios-2.6.tar.gz
2. Configure Nagios. CD Nagios;./configure-Prefix =/usr/local/Nagios
3. Compile Nagios. Make all
4. Install Nagios. Unlike installing other software, it takes several steps to install Nagios. Step 1: Execute make install to install the main Program CGI and HTML files. Step 2: Execute make install-commandmode to grant external commands the permission to access the Nagios configuration file, step 3: Run make install-config to copy the configuration file example to the Nagios installation directory. Follow the prompts in the installation wizard. In fact, there is also a make install-init step, which is used to make Nagios a running script so that Nagios can start with the system boot, this is a convenient measure. However, I am a person who prefers to simplify the problem and did not perform such operations.
5. Check whether the verification program is correctly installed. Switch the directory to the installation path (/usr/local/Nagios) to check whether the five directories including etc, bin, sbin, share, and VAR exist, if yes, it indicates that the program has been correctly installed to the system. The following table provides a brief description of the five directory functions:

Bin

The directory where the Nagios executable program is located. This directory has only one file Nagios

Etc

Location of the Nagios configuration file. After the initial installation, there are only a few *. cfg-sample files.

Sbin

The directory where the Nagios CGI file is located, that is, the directory where the file needed to execute External commands is located

Share

Nagios webpage file directory

VaR

Directory where Nagios log files, spids, and other files are located

2. Install the Nagios plug-in
There is no plug-in, and Nagios does not play any role. The plug-in is also a powerful weapon for Nagios extension functions. In addition to downloading common plug-ins, we can also compile our own plug-ins according to actual requirements. Nagios plug-in nagios-plugins-1.4.5 can be found on www.nagios.org, And then we use wget to download it. Note: The version between the plug-in and Nagios is not associated much, not necessarily with the nagios-plugins-1.4.5 version. After the download is complete, it is easy to install: first execute the configuration./configure-Prefix =/usr/local/Nagios, then compile and install make; make install. The installation path specified during the configuration process is/usr/local/Nagios, instead of/usr/local/Nagios-plus, the libexec directory will be generated in the/usr/local/Nagios directory (which contains many files), which is exactly what Nagios needs.

3. install Apache on the Web Server
The Web Service is not required by Nagios. However, if Nagios does not have the web, it is very troublesome and interesting to view the Monitored object (only by checking the Nagios log to determine the status ). I don't want to do anything boring, so it takes a little time to install the web.
In the Unix/Linux World, Apache is the first choice for Web servers. Its download website is www.apache.org. We recommend that you download the source code. Because we do not need complex web functions, you can simply execute a few steps to correctly install Apache to the system:
1. Unpack, configure: Tar zxvf httpd-2.2.0.tar.gz; CD httpd-2.2.0;./configure-Prefix =/usr/local/Apache.
2. Compile and install: Make; make install.
After the installation is complete, run the command./usr/local/Apache/bin/apachectl-t to check whether Apache is correctly installed.
Pre-configuration Processing
The main task is to create Nagios users and their bundle groups so that the running users of Nagios are Nagios rather than root. Then, set the owner of the directory/usr/local/Nagios to ensure system security. Nagios can run as a root user, but this is not recommended. Follow these steps:
1. Add the system account Nagios: useradd Nagios to easily add users and group Nagios to the system. Some types of Linux releases require users and groups to be added. You need to add a group before performing operations such as useradd-G Nagios. In actual use cases, Nagios users do not need to log on to the Linux system as system users. Therefore, you do not need to set the Nagios user password, you can even set the logon shell of a Nagios user to/bin/false.
2. Change the directory group: chown-r Nagios. Nagios/usr/local/Nagios. Note that some Unix/Linux users and group separators are not "." and may be in the form of chown-r Nagios: Nagios/usr/local/Nagios.
3. Sendmail. Check if Sendmail is running properly? We need to use sendmail to send fault alarm information, so this package must work properly. Sendmail is divided into two parts: server and client. There are two ways to send alarm Emails:
(1) The machine on which Nagios is located sends the mail to the dedicated email server through the Sendmail client program, and then the mail server sends the message to the user's mailbox.
(2) The mail client and server use sendmail in the system where Nagios is located. The first method is very standard, but it is more troublesome. For example, you need to perform address resolution and modify the configuration of the email server. Another problem is that it depends on other systems, it increases fault points and complexity. The second method is very simple. You only need to start the sendmail service, and it no longer depends on other systems and services. In actual scenarios of my work, both methods are used. A dedicated email server may cause sending latency (because the email server needs to process emails sent and received by many other users ); directly Using Sendmail as the server and client is very simple and convenient. Fortunately, Sendmail is installed by default in almost all Linux/Unix distributions. If so much ink is required, simply run the sendmail service.
4. Mobile text message sending tool. My current company is sp. I have my own Short Message channel. I directly copy the client program sms_send that sent the short message to the directory/usr/local/bin. What if there is no gateway channel for text message delivery? There are many client programs for sending text messages on the network. The most famous one is smsclient. Download it, unpack it, and install it. Do not forget to purchase mobile phone modem and mobile phone card. Modem only supports SIM card but not CDMA. After installing the smsclient software and hardware modem, test whether the software is normal. What if there is no modem? There are still some ways: to make your mobile phone number acceptable to emails, you need to go to the Business Hall to activate this function. The text message alarm function is the most useful function. We cannot stare at the monitoring screen all day long or receive emails all day long, but our mobile phone can be online 24 hours a day, as long as the Monitored object fails, you can receive a fault alert text message immediately. In the past, I was afraid of taking a long vacation, because I was most worried about critical equipment or services failing during the holidays and did not know it, so I became on duty. Presumably, many network administrators had similar experiences. Before deploying Nagios, I searched the internet Article I found that most of them did not introduce the convenient function of using text messages. Sorry! Once again, we strongly recommend that you enable the SMS fault alert function for Nagios.

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.