Nagios is an open source, free network monitoring tool that effectively monitors Windows, Linux and UNIX host status, network settings such as switch routers, printers, and more. Send mail or SMS alarm when the system or service status is abnormal the first time to notify the site operators, after the status of the resumption of normal mail or SMS notification.
Prerequisite time needs to be synchronized
1.Nagios relies on php,http
2. See if the dependent packages have been installed
#rpm-Q gcc glibc glibc-common gd gd-devel xinetd openssl-devel
The default is no gd-devel and xinetd .
# yum-y Localinstall gd-devel-2.0.35-11.el6.x86_64.rpm # yum Install xinetd
3. Add nagios user groups, users
# groupadd nagcmd# useradd-g nagcmd nagios# ID nagiosuid=501 (nagios) gid=502 (Nagios) group =502 (Nagios), 501 (nagcmd) # Usermod -a-g Nagcmd Apache
4. install nagios and nagios-plugins
# tar xf nagios-4.0.2.tar.gz # cd nagios-4.0.2# ./configure --prefix=/ usr/local/nagios --with-command-group=nagcmd --enable-event-broker --sysconfdir=/etc/ nagios# make all# make install# make install-init# make Install-commandmode# make install-config# make install-webconf# htpasswd -c /etc/nagios/htpasswd.users nagiosadminNew password: Re-type new password: Adding password for user nagiosadmin# service httpd restart# chkconfig --add nagios# chkconfig nagios on# tar xf nagios-plugins-1.5.tar.gz # cd nagios-plugins-1.5# ./configure --with-nagios-user=nagios -- with-nagios-group=nagios# make && make install# service nagios Start off SELinux to prevent SELinux organization scripts from running
5. Login nagios-web interface
Http://nagiosIP/nagios
Enter user name and password
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7C/A3/wKiom1bUIHrSOT67AAHRUSMVkSU442.png "style=" float: none; "title=" Image 1.png "alt=" Wkiom1buihrsot67aahrusmvksu442.png "/>
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7C/A3/wKiom1bUIHzgoxLzAAFWBuA-mvY463.png "style=" float: none; "title=" Image 2.png "alt=" Wkiom1buihzgoxlzaafwbua-mvy463.png "/>
6. installed nagios-plugins on the monitored side
Required software nagios-plugins,Nrpe
# tar XF nagios-plugins-1.5.tar.gz# useradd-s/sbin/nologin nagios# cd nagios-plugins-1.5#./configure--with-nagios-use R=nagios--with-nagios-group=nagios# make all# make install
7. installed Nrpe on the monitored side
# tar xf nrpe-2.15.tar.gz # cd nrpe-2.15# ./configure --with-nrpe-user =nagios --with-nrpe-group=nagios --with-nagios-user=nagios --with-nagios-group=nagios -- Enable-command-args --enable-ssl# make all# make install-plugin # make install-daemon# make install-daemon-config# /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d //start Nrpe Service or # vim /etc/init.d/nrped#!/bin/bash# chkconfig: 2345 88 12# description: nrpe DAEMON NRPE=/usr/local/nagios/bin/nrpeNRPECONF=/usr/local/nagios/etc/nrpe.cfg case "$" in start) echo -n "Starting nrpe daemon ..." $NRPE -c $NRPECONF -d echo " done." ;; stop) echo -n "Stopping nrpe daemon ..." pkill -u nagios nrpe echo " done." ;; restart) $0 stop sleep 2 $0 start ;; *) echo "Usage: $0 start|stop|restart" ;; esacexit 0# /etc/init.d/nrped start
8. Add nrpe definition in Master monitor
# ' Check_nrpe ' command definitiondefine command{command_name Check_nrpe command_line $USER 1$/check_nr Pe-h $HOSTADDRESS $-C $ARG 1$}
9. Increase the host monitoring configuration item
# vim /etc/nagios/objects/131.cfgdefine host{ use linux-server host_name 192.168.235.131 alias 192.168.235.131 address 192.168.235.131}define service{ use Generic-service host_name 192.168.235.131 service_ description load check_command check_nrpe!check_load}define service{ use generic-service host_name 192.168.235.131 service_description ping check_command check_ping!100.0,20% !200.0,50% max_check_attempts 5 normal_check_interval 1}define service{ use generic-service host_name 192.168.235.131 seRvice_description ftp check_command check_ftp!21 max_ check_attempts 5 normal_check_interval 1}define service{ use generic-service host_name 192.168.235.131 service_description SSH check_command check_ssh max_check_attempts 5 normal_check_interval 1}define service{ use generic-service host_name 192.168.235.131 service_description HTTP check_command check_http max_check_attempts 5 normal_check_interval 1}# vim /etc /nagios/nagios.cfgcfg_file=/etc/nagios/objects/131.cfg# service nagios reload Reload Refresh Nagios-web interface to see the addedMonitored host
OK, here Nagios has been installed, and the monitored node is online!
This article is from the "9470860" blog, please be sure to keep this source http://9480860.blog.51cto.com/9470860/1746124
Nagios Installation and addition of monitoring hosts