Nagios is currently a very popular system, server monitoring free software, many large domestic sites like Sohu, NetEase are using Nagios for server monitoring.
Nagios is a bit of a frame in itself, for the Nagios Extended monitoring module, as well as the alarm module is very convenient, can easily add their own written service monitoring, as well as mobile phone text messages, mail, Gtalk, MSN Alarm and so on.
The following are the setup and simple configuration procedures for Nagios under Linux REDHAT as4u4:
Download software:
Http://pan.baidu.com/s/1c02EzZy
Http://pan.baidu.com/s/1jG5jZL0
Add Users:
Useradd-m Nagios
passwd Nagios
Groupadd Nagcmd
Usermod-g Nagcmd Nagios
Usermod-g nagcmd Daemon
Compiling and installing Nagios
Tar-xvzf nagios-cn-3.2.3.tar.bz2
CD nagios-3.0.3
./configure–with-command-group=nagcmd
Make all
Make install
Make Install-init
Make Install-config
Make Install-commandmode
To set the Apache server access password:
cd/usr/local/nagios/etc/
/usr/local/apache/bin/htpasswd-c/usr/local/nagios/etc/htpasswd.users Nagiosadmin
cd/usr/local/apache/conf/
VI httpd-vhosts.conf
Configure Apache CGI with the following configuration:
Scriptalias/nagios/cgi-bin/usr/local/nagios/sbin
<directory "/usr/local/nagios/sbin" >
Options execcgi
AllowOverride None
Order Allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
Authuserfile/usr/local/nagios/etc/htpasswd.users
Require Valid-user
</Directory>
Alias/nagios/usr/local/nagios/share
<directory "/usr/local/nagios/share" >
Options None
AllowOverride None
Order Allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
Authuserfile/usr/local/nagios/etc/htpasswd.users
Require Valid-user
</Directory>
Restart Apache
/usr/local/apache/bin/apachectl Configtest
/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl start
Installing the Nagios Plugin
Tar-xvzf nagios-plugins-2.0.1.tar.gz
CD nagios-plugins-1.4.12
./configure–with-nagios-user=nagios–with-nagios-group=nagios
Make
Make install
Chkconfig–add Nagios
Chkconfig Nagios on
/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg
Service Nagios Start
Now you can access the monitoring interface through the browser, Http://www.example.com/nagios
Now you can only see the monitoring for this machine, next we add a monitoring of the HTTP service
cd/usr/local/nagios/
VI nagios.cfg
Add a line:
Cfg_file=/usr/local/nagios/etc/objects/wwws.cfg
Writing configuration Wwws.cfg
Touch Objects/hosts.cfg Objects/wwws.cfg
VI objects/wwws.cfg
The specific contents are as follows:
Define Host{
Use Generic-host
HOST_NAME Maycode
Alias Www.maycode.com
Address 10.11.24.42
Hostgroups webhosts
Max_check_attempts 10
}
Define Hostgroup{
Hostgroup_name webhosts
Alias Web Service hosts
Members Maycode
}
Define Service{
Use Generic-service
HOST_NAME Maycode
Service_description HTTP
Check_command check_http! -H www.maycode.com
}
Please change it to the host and domain name you want to monitor and see if your profile is correct:
/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg
If you fight, restart the Nagios server
Service Nagios Start
Next, please go to the browser to see, if you see pending in the host section don't be surprised, we only set up the monitoring WWW server, if you need to monitor alive, please refer to localhost.cfg configuration file.
In the Libexec directory, all the monitoring scripts and applications are in, you can use Prog-h to see how to use these monitoring scripts and programs. If you write your own program is best placed in this directory.
This article is from the "7924127" blog, please be sure to keep this source http://7934127.blog.51cto.com/7924127/1583141
Nagios monitoring software Source installation