Configure the basic Nagios System on RHEL5.3 (using Nagios-3.1.2)

Source: Internet
Author: User
1. install and configure Nagios1 and Nagios is an open-source network monitoring software that complies with GPLv2 and can be used to monitor hosts and services of a specified variety of systems, you can also notify the Administrator when their working status changes. Its features include: 1) Monitoring Network Services (HTTP, POP3, SMTP, PING, MySQL, etc.) 2) monitoring host resources (disk space utilization, memory utilization, CPU load, etc) 3) Simple plug-in design interfaces, allowing users to easily develop 1. install and configure Nagios
1. About Nagios
Nagios is an open-source network monitoring software that complies with GPLv2. It can be used to monitor hosts and services of a specified variety of systems and notify administrators when their working status changes. Its features include: 1) Monitoring Network Services (HTTP, POP3, SMTP, PING, MySQL, etc.) 2) monitoring host resources (disk space utilization, memory utilization, CPU load, etc) 3) Simple plug-in interface design, allowing users to easily develop the required detection script 4) Parallel service mode 5) easy description of the network structure, and the ability to distinguish between "down" and "host inaccessible" 6) notify the administrator of the changes in the working status of the host or service by email or user-defined means 7) automatic Log rolling (8) support for host monitoring in redundancy mode (9) allows you to visually view the current network status, notification and problem history, log files, and so on through the web. This component is optional.
Nagios generally consists of a main program (Nagios), a plug-in program (Nagios-plugins), and four optional ADDON (NRPE, NSCA, NSClient ++, and NDOUtils. Nagios monitoring is implemented through plug-ins. Therefore, Nagios and Nagios-plugins are necessary components for server work. Among the four ADDON instances, NRPE is used to execute script INS on the monitored remote Linux/Unix hosts to monitor these host resources; NSCA is used to allow the monitored remote Linux/Unix host to send monitoring information to the Nagios server (this is especially used in redundant monitoring mode ); NSClient ++ is a component used to monitor Windows hosts installed on Windows hosts, while NDOUtils is used to store Nagios configuration information and data generated by various events into the database, to quickly retrieve and process the data. In the four ADDON (attachments), NRPE and NSClient ++ work on the client, NDOUtils work on the server, and NSCA must be installed on both the server and the client.
The relationship diagram of Nagios components provided by the author based on his own understanding, hoping to help readers understand. If you disagree with the relationship in this diagram, you are welcome to communicate with the author in various ways.

Currently, Nagios can only be installed on a Linux host, and gcc is required for compiling. At the same time, if you want to use the web interface management tool, you also need support for the apache server and GD graphics library.
2. Preparations before installation
(1) solve the dependency between Nagios installation:
The running of basic Nagios components depends on httpd, gcc, and gd. Run the following command to check whether the rpm package on which nagios depends has been fully installed: # rpm-q httpd gcc glibc-common gd-devel
For missing rpm packages, you can mount the disc and directly use the rpm command for installation. If you do not want to be always troubled by rpm dependencies, you can use yum with local sources to manage rpm packages. For the establishment of the local source, you can refer to the author's other article on yum.
Note: You can also install the software package by compiling the source code, but the path of many related files to be used must be modified one by one according to the configuration during installation of your source code.

(2) Add the users and groups required for running nagios:
# Groupadd nagcmd # useradd-m nagios # usermod-a-G nagcmd nagios
Add apache to the nagcmd group so that you can have sufficient permissions when using the web Interface to operate nagios: # usermod-a-G nagcmd apache
3. Compile and install nagios:
# Tar zxf nagios-3.1.2.tar.gz # cd nagios-3.1.2 #./configure -- with-command-group = nagcmd # make all # make install-init # make install-config # make install-commandmode
Specify the email address that you want to use to receive nagios warnings. The default address is # vi/usr/local/nagios/etc/objects/contacts. cfg email nagios @ localhost # This is the default setting
Create the Nagios Web program configuration file in the httpd configuration file directory (conf. d): # make install-webconf
Create a user logging on to the nagios web program. This User Account will be used to log on to nagios for later authentication: # htpasswd-c/usr/local/nagios/etc/htpasswd. users nagiosadmin
After the above process is configured, restart httpd: # service httpd restart
4. Compile and install nagios-plugins
All monitoring work of nagios is completed through the plug-in. Therefore, you need to install the official plug-in for nagios before starting it.
# Tar zxf nagios-plugins-1.4.13.tar.gz # cd nagios-plugins-1.4.13 #./configure -- with-nagios-user = nagios -- with-nagios-group = nagios # make install
5. 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 whether the syntax of the main configuration file is correct: #/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios. cfg
(3) If the above syntax check is correct, then you can officially start the nagios service: # service nagios start
(4) Configure selinux. If the selinux service is enabled on your system, the running of the nagios web cgi program is denied by default. You can run the following command to check whether selinux is enabled on your system: # getenforce
If the result of the preceding command shows that the selinux service is enabled, You can temporarily disable it using the following command: # setenforce 0
If you want to completely disable selinux in the future, you can modify the value "force" after selinux to "disable" by editing the/etc/sysconfig/selinux file.
Of course, you can also run the nagios CGI program in SELinux/targeted mode without disabling selinux: # chcon-R-t httpd_sys_content_t/usr/local/nagios/sbin # chcon-R-t httpd_sys_content_t/usr/local/nagios/share
(5) view nagios: http: // your_nagios_IP/nagios on the web interface
You must specify the web Authentication account and password you have set before logon.
Note: To ensure the security of nagios, we recommend that you use the strong information digest Authentication Mode (such as MD5) and use the web TSL/SSL secure communication mode, in addition, the access control list is used to set the client address that can access the nagios web interface.
II. Introduction to Nagios plug-ins
NagiosIt does not contain any monitoring mechanism, and all its monitoring work is through the plug-in (Plugin. These plug-ins usually monitor the working status of the host or service through command linePerlScript orShellScript (usually/Usr/local/nagios/libexecDirectory ),NagiosAnd return the execution resultNagios.NagiosIt is based on the returned values to determine whether to "take some action" (such as running event handle (Event handlers). Shows the relationship between the agent and the Nagios process and the Monitored object.

The official website provides some basic resources for monitoring the system (suchCPULoad, disk utilization,PingSpeed. If you need to monitor other forms of resources (suchCPUVoltage,CPUFan speed, network traffic, etc.) status, you can use other official plug-ins or third-party plug-ins, of course, you can also write your own required plug-ins.

The following are commonly used to obtain the plug-in address:

NagiosPlug-in project:Http://nagiosplug.sourceforge.net/
NagiosDownload Page:Http://www.nagios.org/download/
NagiosExchange.org:Http://www.nagiosexchange.org/

The official plug-ins usually provide simple help, and can be used after each script-H"Or"-- HelpTo obtain the help information. To understand the plug-in scriptCheck_ntYou can use the following command:

#./Check_nt  -- Help

Related Article

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.