centos5.8上nagios服务端安装


[root@mode yum.repos.d]# useradd -s /sbin/nologin nagios
[root@mode yum.repos.d]# mkdir /usr/local/nagios
[root@mode yum.repos.d]# chown -R nagios.nagios /usr/local/nagios
[root@mode yum.repos.d]# ll -d /usr/local/nagios
drwxr-xr-x 2 nagios nagios 4096 Mar 17 06:14 /usr/local/nagios
[root@mode yum.repos.d]# cd /home/oldboy/tools/
[root@mode tools]# rz
rz waiting to receive.

开始 zmodem 传输。 按 Ctrl+C 取消。
100% 1742 KB 1742 KB/s 00:00:01 0 Errors


[root@mode tools]# tar zxf nagios-3.4.3.tar.gz
[root@mode tools]# cd nagios
[root@mode nagios]# ./configure --prefix=/usr/local/nagios

[root@mode nagios]# make all

[root@mode nagios]# make install

root@mode nagios]# make install-init

[root@mode nagios]# make install-config



[root@mode nagios]# make install-commandmode


安装nagios web 配置文件及创建用户

make install-webconf

\\

因为nagios的配置文件指定了密码文件的存放路径就是/usr/local/nagios/etc/htpasswd.users

\

添加监控报警的email 地址

[root@mode nagios]# sed -i 's#nagios@localhost#1204070172@qq.com#' /usr/local/nagios/etc/objects/contacts.cfg

root@mode nagios]# /etc/init.d/sendmail start
Starting sendmail:
[root@mode nagios]# /etc/init.d/sendmail status
sendmail (pid 3203) is running...
[root@mode nagios]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 mode localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
[root@mode nagios]# hostname
mode

[root@mode nagios]# chkconfig sendmail on
[root@mode nagios]# chkconfig --list on
error reading information on service on: No such file or directory
[root@mode nagios]# chkconfig --list sendmail
sendmail 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@mode nagios]# netstat -lnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:841 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:55924 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:789 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:757 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 :::22 :::* LISTEN

配置apache服务

/etc/init.d/httpd start

chkconfig httpd on

如果Apache是编译安装的,那么它的用户和用户组默认是daemon需要

x修改httpd.conf

安装nagios插件:

\

[root@mode nagios-plugins-1.4.16]# ls /usr/local/nagios/libexec/|wc -l
61

添加nagios开机自启动

chkconfig add nagios

验证nagios 配置文件语法两种:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

/etc/init.d/nagios checkconfig

启动nagios:




 

/etc/init.d/nagios start

 




 

然后登陆:http://ip/nagios

安装nrpe

 

[root@mode yum.repos.d]# useradd -s /sbin/nologin nagios
[root@mode yum.repos.d]# mkdir /usr/local/nagios
[root@mode yum.repos.d]# chown -R nagios.nagios /usr/local/nagios
[root@mode yum.repos.d]# 


 



[root@mode tools]# tar zxf nrpe-2.12.tar.gz
[root@mode tools]# cd nrpe-2.12
[root@mode nrpe-2.12]# ./configure

 

[root@mode nrpe-2.12]# make all
[root@mode nrpe-2.12]# make install-plugin
[root@mode nrpe-2.12]# make install-daemon
[root@mode nrpe-2.12]# make install-daemon-config

[root@mode nrpe-2.12]# ls /usr/local/nagios/libexec/|wc -l
62

 

相关内容