rpm -qa |grep gd
rpm -ql gd-devel-2.0.28-5.4E.el4_6.1
cd nagios-3.0.5
./configure --prefix=/usr/local/nagios --with-command-group=nagcmd --with-gd-lib=/usr/lib --with-gd-inc=/usr/include
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
#
可以自动配置
httpd.conf
|
cd nagios-plugins-1.4.11
./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-redhat-pthread-workaround
make
make install
|
cd nagios-nrpe_2.8.1
./configure
#
默认自动添加了
openssl
#
因为传送过程要加密
,
如果后面
make
报错
,
加如下参数
rpm -qa| grep ssl
openssl-devel-0.9.7a-43.17.el4_6.1
rpm -ql openssl-devel-0.9.7a-43.17.el4_6.1 | more
./configure --enable-ssl --with-ssl-lib=/lib/
(
当然前提要有
openssl)
make all
make install-plugin
|
vi /usr/local/nagios/etc/objects/commands.cfg
#
添加
#
check nrpe
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
|
vi /usr/local/nagios/etc/nagios.cfg
#
中间添加
cfg_file=/usr/local/nagios/etc/objects/mylinux.cfg
|
vi /usr/local/nagios/etc/objects/mylinux.cfg
define host{
use linux-server
host_name mylinux
alias mylinux
address 192.168.0.21
(
客户端
IP
既被监控的
IP)
}
define service{
use generic-service
host_name mylinux
service_description check-swap
check_command check_nrpe!check_swap
}
define service{
use generic-service
host_name mylinux
service_description check-load
check_command check_nrpe!check_load
}
define service{
use generic-service
host_name mylinux
service_description check-disk
check_command check_nrpe!check_had1
define service{
use generic-service
host_name mylinux
service_description check-users
check_command check_nrpe!check_users
}
define service{
use generic-service
host_name mylinux
service_description otal_procs
check_command check_nrpe!check_total_procs
}
|
chkconfig --add nagios
#
配置机器启动时自动启动
Nagios
chkconfig nagios on
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
#
检查
Nagios
配置文件
vi /etc/selinux/config
#
关闭
SELinux
SELINUX=disabled
service iptables stop
#
关闭
SELinux,
或打开
80,5666
端口
service nagios start
|
useradd nagios
passwd nagios
tar -zxvf nagios-plugins- 1.4.12 .tar.gz
cd nagios-plugins-1.4.12
./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-redhat-pthread-workaround
Make
make install
|
chown �CR nagios.nagios /usr/local/nagios
[root@client nagios]# ll
drwxr-xr-x 2 nagios nagios 4096 Jun 1 00:07 libexec
drwxr-xr-x 3 nagios nagios 4096 Jun 1 00:07 share
|
tar -zxvf nagios-nrpe_ 2.8.1 .orig.tar.gz
cd nagios-nrpe_2.8.1
./configure
(
会自动加载
SSL)
#
如果后面
make
报错
,
加如下参数
./configure --enable-ssl --with-ssl-lib=/usr/lib/
(
当然前提要有
openssl)
make all
make install-plugin
make install-daemon
make install-daemon-config
|
vi /usr/local/nagios/etc/nrpe.cfg
allowed_hosts=192.168.0.20,127.0.0.1,192.168.0.99
|
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg �Cd
#
或
vi /etc/rc.d/rc.local
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg �Cd
|
netstat -an | grep 5666
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
NRPE v2.8.1
#
服务端测试
/usr/local/nagios/libexec/check_nrpe -H l92.168.0.21
NRPE v2.8.1
#
常见错误
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
CHECK_NRPE: Error - Could not complete SSL handshake.
配置
allowed_hosts=192.168.0.20,127.0.0.1,192.168.0.99,
然后
kill
进程再重启就
OK
了
2./usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
Connection refused by host
Nrpe
进程没有启动
|
vi /usr/local/nagios/etc/nrpe.cfg
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/hda1
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
|