Nagios服务器架设之一
Nagios服务器架设之一实验环境:RHEL 5.4
一、Nagios服务器安装过程
1)配置服务器端IP地址
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices 79c970
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:0c:29:fe:39:A1
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=192.168.6.199
GATEWAY=192.168.6.1
TYPE=Ethernet
2)安装Nagios
A,安装前准备
1)创建nagios程序用户、组
# useradd -s /sbin/nologin nagios ---阻止用户登录服务器
-s :用户登录shell
# mkdir /usr/local/nagios
# chown -R nagios.nagios /usr/local/nagios/ ---修改它的属主属组权限
2)保证系统中sendmail服务器要开启
# service sendmail status
sendmail (pid 3090) 正在运行...
B、编译安装Nagios
# cd /aaa/
# tar zxf nagios-3.2.0.tar.gz
# cd nagios-3.2.0
# ./configure --prefix=/usr/local/nagios/
# make all ; make install ; make install-init ; make install-commandmode ; make install-config
# chkconfig --add nagios
# chkconfig nagios on
# chkconfig --list nagios ---查看nagios服务是否运行
nagios 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
C、安装Nagios插件
你可以从http://www.nagios.org官方网站上下载最新的nagios插件
# tar zxf nagios-plugins-1.4.14.tar.gz
# cd nagios-plugins-1.4.14
# ./configure --prefix=/usr/local/nagios/ ; make ; make install
D、安装Nagios的汉化包
# tar jxf nagios-cn-3.2.0.tar.bz2
# cd nagios-cn-3.2.0
# ./configure ; make all ; make install
E、安装LAMP架构
# mount /dev/cdrom /media/
# vi /etc/yum.repos.d/rhel-debuginfo.repo
name=Red Hat Enterprise Linux $releasever - $basearch - Debugbaseurl=file:///media/Server
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
# yum -y install php* mysql* http*
# service httpd start
启动 httpd: [确定]
# chkconfig httpd on
# vi /etc/httpd/conf/httpd.conf
231 User apache
232 Group apache
391 DirectoryIndex index.php index.html index.html.var
992 #setting for nagios
993 ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
994
995 AuthType Basic
996 Options ExecCGI
997 AllowOverride None
998 Order allow,deny
999 Allow from all
1000 AuthName "nagios access"
1001 AuthUserFile /usr/local/nagios/etc/htpasswd
1002 Require valid-user
1003
1004 Alias /nagios "/usr/local/nagios/share"
1005
1006 AuthType Basic
1007 Options ExecCGI
1008 AllowOverride None
1009 Order allow,deny
1010 Allow from all
1011 AuthName "nagios access"
1012 AuthUserFile /usr/local/nagios/etc/htpasswd
1013 Require valid-user
1014
创建apache目录的验证文件“/usr/local/nagios/etc/htpasswd”
# htpasswd -c /usr/local/nagios/etc/htpasswd benet
New password:
Re-type new password:
Adding password for user benet
重启apache服务器并进行验证nagios登陆情况
# service httpd restart
停止 httpd: [确定]
启动 httpd: [确定]
至此nagios服务器安装结束
页:
[1]