Nagos is an open source computer system and network monitoring tool, can effectively monitor the Windows,linux,uninx host status, switch routers and other network settings, Printer, etc. when the system or service status is abnormal, send a message or SMS alarm the first time notify the operator, after the status of the resumption of normal mail or SMS alarm notification
Main functions:
* Network Service Monitoring (STMP simple e-mail service; POP3 mail server; http;nntp;icmp; SNMP; FTP; SSH)
* Host Resource monitoring (CPU locd,disk Usage,system logs), also including Windows host (using nsclient++ Plugin)
* You can specify the plugin you write to collect data over the network to monitor any situation (temperature, warning ...) )
* Can monitor support SSH or SSK plus channel mode for monitoring
Scripts can be executed remotely by configuring the Nagio remote execution plug-in
* Simple plugin design allows users to easily develop their own required inspection services, supporting many development languages (Shel Scripts,c++,perl,ruby,python,php,c)
* Contains a lot of graphical data plugins (Nagiosgraph,nagiosgrapher,pnp4nagios, etc.)
* Parallel Service Check available
* Ability to define the layer of the network host, allowing a step-by-step investigation, starting from the parent host to check down
* Notification is issued when a problem occurs with the service or host and can be notified via emall,pager,sms or any user-defined plugin
* Automatic log loop
* Support redundant monitoring
* Package Web interface can view current network status, notifications, problem history, log files, etc.
Two How Nagios Works
NAGIOSQ's function is to monitor the service and host, but also he does not include this part of the function, all monitoring, detection functions are through a variety of plug-ins to complete.
After you start Nagios, he periodically automatically calls the plugin to check the status of the server, while Nagios maintains a queue, all the status information returned by the plug-in is queued, and Nagios reads the information from the first team and processes it, displaying the status results through the web results.
Nagios provides a number of plug-ins that allow you to easily monitor a number of service statuses, and after the installation is complete, there are all the available plugins in Nagios's/libexec in the Nagios home directory, such as Check_disk is a plug-in that checks disk space Check_ Load is checking the CPU load, and so on. Each plugin can be run by the./check_xxx–h to view the usage and function;
Nagios can identify 4 status return messages, 0 (OK) for normal/green, 1 (WARNING) for warning/yellow, 2 (crittcal) for very serious errors/red, 3 (UNKNOWN) for unknown errors, dark yellow. Nagios determines the state of the monitored object based on the value returned by the plug-in, and displays it over the web to provide the Administrator with timely detection of the failure
Besides the alarm function, if the monitoring system found that the problem can not be reported, it makes no sense, so the alarm is also nagios is one of the most important features, but, the same, Nagios itself does not have the alarm part of the code, and even no plug-in, but to the user or other relevant open source project team to complete
Nagios installation refers to the installation of the basic platform, the Nagios software package, which is the framework of the monitoring system and the basis of all monitoring.
Nagios uses Nrpe to manage services remotely
- Nagios executes the Check_nrpe plugin installed inside it and tells Check_nrpe to detect which services.
- Connecting the Nrpe on the remote machine via the Ssl,check_nrpe daemon
- Nrpe running various local plugins to detect local service and status
- Finally, Nrpe the results of the test to the host side Check_nrpe,check_nrpe the results are sent to the Nagios state queue,
- Nagios reads the information in the queue, then displays the results.
Three Experimental environment
Host Name |
OS |
Ip |
Software |
Nagios-server |
CentOS Release 6.3 (Final) |
192.168.1.108 |
Apache, PHP, Nagios, Nagios-plugins |
Nagios-linux |
CentOS Release 5.8 (Final) |
192.168.1.111 |
Nagios-plugins, Nrpe |
Nagios-windows |
Windows XP |
192.168.1.113 |
nsclient++ |
The server installs Nagios software, processes the monitored data, provides web interface viewing and management, and, of course, monitors the local information itself.
Client installs Nrpe and other clients, performs monitoring according to the Monitor's request, and then transmits the result back to the monitoring machine.
Firewall is off/iptables:firewall is not running
Selinux=disabled
Four Experimental objectives
Host name Services to monitor
CPU Load
Number of non-users currently logged on
Whether to turn on port 80
is active
Nagios-server/Partition Usage
Whether to turn on SSH service
Swap partition usage
Total number of processes
----------------------------------------------------------
Disk usage
Swap partition usage
Number of zombie processes
Nagios-linux CPU Load
Number of currently logged on users
Whether to turn on port 80
Total number of processes
-------------------------------------------------------------
Memory usage
Nagios-windows nsclient Client version
Run time
Whether to open the external 3svc service
Five Nagios Server-side installation
5.1. Basic Support Kit:
GCC glibc Glibc-common gd gd-devel xinetd openssl-devel
[[email protected] YUM.REPOS.D] #rpm-q gcc glibc glibc-common gd gd-devel xinetd openssl-devel
[Email protected] yum.repos.d]# rpm-q gcc glibc glibc-common gd gd-devel xinetd
Create Nagios users and user groups
[Email protected] ~]# useradd-s/sbin/nologin Nagios
[Email protected] ~]# Mkdir/usr/local/nagios
[Email protected] ~]# chown-r Nagios:nagios/usr/local/nagios
View permissions for the Nagios directory
[Email protected] ~]# ll-d/usr/local/nagios/
Drwxr-xr-x. 2 Nagios nagios 4096 April 15:52/usr/local/nagios/
Compiling and installing Nagios
[Email protected] ~]# tar zxvf nagios-4.0.1.tar.gz-c/usr/src/
[Email protected] nagios-4.0.1]# cd/usr/src/nagios-4.0.1
[Email protected] nagios-4.0.1]#/configure--prefix=/usr/local/nagios
[[email protected] nagios-4.0.1]# make all
[[email protected] nagios-4.0.1]# make install
[email protected] nagios-4.0.1]# make Install-init
[email protected] nagios-4.0.1]# make Install-commandmode
[email protected] nagios-4.0.1]# make Install-config
[Email protected] nagios-4.0.1]# chkconfig--add Nagios
[Email protected] nagios-4.0.1]# chkconfig--level Nagios on
[Email protected] nagios-4.0.1]# chkconfig--list Nagios
Verify that the program is installed
[A1]
Bin:nagios the directory where the executable program resides
directory where the Etc:nagios configuration file resides
Sbin:nagios the directory where the CGI file is located, that is, the file that is required to execute the external command
Share:nagios the directory where the Web page file resides
Libexec:nagios the directory where the external plugins are located
Var:nagios log files, lock and other files in the same directory
Var/archives:nagios Log Automatic Archive
VAR/RW: The directory used to store external command files
[A1] Switch to the installation path, that is, "/usr/local/nagios", to see if there are etc,bin,sbin,share,var these five directories, if present can indicate that the program is properly installed to the system! Nagios uses the following directories for each directory:
Bin:nagios the directory where the executable program resides
directory where the Etc:nagios configuration file resides
Sbin:nagios the directory where the CGI file is located, that is, the file that is required to execute the external command
Share:nagios the directory where the Web page file resides
Libexec:nagios the directory where the external plugins are located
Var:nagios log files, lock and other files in the same directory
Var/archives:nagios Log Automatic Archive
VAR/RW: The directory used to store external command files
Installing the Nagios Plugin
[Email protected] ~]# tar zxvf nagios-plugins-1.5.tar.gz-c/usr/src/
[Email protected] ~]# cd/usr/src/nagios-plugins-1.5/
[Email protected] nagios-plugins-1.5]#./configureprefix=/usr/local/nagios
[[email protected] nagios-plugins-1.5]# make && make install
Installing and configuring Apache and PHP
Apache and PHP are not required to install Nagios, but Nagios provides a web monitoring interface that clearly sees the running state of the monitored hosts and resources through the Web monitoring interface, so it is necessary to install a Web service.
Installing Apache
Configure Apache
For security reasons, it is common for Nagios's web monitoring pages to be authorized for access, which requires an additional authentication configuration, which is to add the following information to the httpd.conf file:
Create Apache directory validation files
#在上面的配置中, to the immediate directory to verify the file htpasswd, so that in the/usr/local/nagios/etc/directory to create a htpasswd authentication file, when the URL path can be accessed through the user name and password
View the contents of an authentication file
[Email protected] ~]# CAT/USR/LOCAL/NAGIOS/ETC/HTPASSWD
Xiaoyu: $apr 1$MFNBJHBT$8GQMV4FDERNPKPKY9NBHV.
Start the Aoache service
[Email protected] ~]#/etc/init.d/httpd restart
-------------------Nagios Service installation is basically complete------------------
At this point, we can access the Web client browser
Nagios Deployment and Configuration