nagios中文安装说明
(1) nagios
[root@localhost ~]# mkdir /usr/local/nagios
[root@localhost ~]# useradd -s /sbin/nologin nagios
[root@localhost ~]# chown -R nagios:nagios /usr/local/nagios/
[root@localhost ~]# cd /install/
[root@localhost install]# tar -zxvf nagios-3.2.0.tar.gz -C /usr/src
[root@localhost install]# cd /usr/src/nagios-3.2.0/
[root@localhost nagios-3.2.0]# ./configure --prefix=/usr/local/nagios
[root@localhost nagios-3.2.0]# make all
[root@localhost nagios-3.2.0]# make install
[root@localhost nagios-3.2.0]# make install-init
[root@localhost nagios-3.2.0]# make install-commandmode
[root@localhost nagios-3.2.0]# make install-config
[root@localhost nagios-3.2.0]# chkconfig --add nagios
[root@localhost nagios-3.2.0]# chkconfig --level 35 nagios on
[root@localhost nagios-3.2.0]# chkconfig --list nagios
nagios 0:关闭 1:关闭 2:关闭 3:启用 4:启用 5:启用 6:关闭
(2)nagios-plugins
[root@localhost install]# tar -zxvf nagios-plugins-1.4.14.tar.gz -C /usr/src/
[root@localhost install]# cd /usr/src/nagios-plugins-1.4.14/
[root@localhost nagios-plugins-1.4.14]# ./configure --prefix=/usr/local/nagios
[root@localhost nagios-plugins-1.4.14]# make
[root@localhost nagios-plugins-1.4.14]# make install
(3)nagios汉化插件
[root@localhost install]# tar -jxvf nagios-cn-3.2.0.tar.bz2 -C /usr/src/
[root@localhost install]# cd /usr/src/nagios-cn-3.2.0/
[root@localhost nagios-cn-3.2.0]# ./configure
[root@localhost nagios-cn-3.2.0]# make all
[root@localhost nagios-cn-3.2.0]# make install
(11)配置apache
[root@localhost ~]# vim /usr/local/apache/conf/httpd.conf 在最好添加如下:
#setting for nagios
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
AuthType Basic
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthUserFile /usr/local/nagios/etc/htpasswd
Require valid-user
Alias /nagios "/usr/local/nagios/share"
AuthType Basic
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthUserFile /usr/local/nagios/etc/htpasswd
Require valid-user
[root@localhost ~]# /usr/local/apache/bin/htpasswd -c /usr/local/nagios/etc/htpasswd pengliang
New password: 11qq```
Re-type new password: 11qq```
Adding password for user pengliang
(4)
[root@localhost objects]# touch hosts.cfg
[root@localhost objects]# chmod 664 hosts.cfg
[root@localhost objects]# chown nagios:nagios hosts.cfg
[root@localhost objects]# vim /usr/local/nagios/etc/objects/hosts.cfg
############################################################################
define host{
use linux-server
host_name 115-server
alias 115
address 192.168.1.115
}
define host{
use linux-server
host_name 120-server
alias 120
address 192.168.1.120
}
define hostgroup{
hostgroup_name sa-servers
alias sa servers
members 115-server,120-server
}
6、
[root@localhost objects]# vim /usr/local/nagios/etc/objects/contacts.cfg
define contact{
contact_name shancg ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias sa-system ; Full name of user