主机安装
yum install -y gcc glibc glibc-common gd gd-devel xinetd openssl-devel perl
yum -y install httpd php mysql-devel php-mysql
groupadd nagcmd
useradd -G nagcmd nagios
usermod -a -G nagcmd apache
date
tar zxvf nagios-3.4.3.tar.gz
cd nagios
./configure --sysconfdir=/etc/nagios --with-command-group=nagcmd --enable-event-broker
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf
htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
chkconfig --add nagios
chkconfig nagios on
service nagios start
#插件
tar zxvf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
service nagios restart
tar zxvf nrpe-2.13.tar.gz
cd nrpe-2.13
make all
make install-plugin
#被监控机
useradd -s /sbin/nologin nagios
tar zxvf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --with-nagios-user=nagios --with-nagios-group=nagios #如果mysql先装mysql
make
make install
tar zxvf nrpe-2.13.tar.gz
cd nrpe-2.13
./configure --with-nrpe-user=nagios --with-nrpe-group=nagios --with-nagios-user=nagios --with-nagios-group=nagios --enable-command-args --enable-ssl
make all
make install-plugin
make install-daemon
make install-daemon-config
cd /usr/local/nagios/etc/
vi usr/local/nagios/etc/nrpe.cfg 修改allowed_hosts
#启动加可到rc.local中
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
-------------------------------------------下面是检查
./check_nrpe -H 192.168.1.225
commands.cfg 主机上增加
# 'check_nrpe' command definition
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
object 目录下增加 225.cfg
define host{
use generic-host
host_name 225
alias 225
address 192.168.1.225 ;被测试机ip
max_check_attempts 10
check_command check-host-alive ; Default command to check if servers are "alive"
}
define service{
use generic-service
host_name 225
service_description 225-load
check_command check_nrpe!check_load
}
define service{
use generic-service
host_name 225
service_description 225-users
check_command check_nrpe!check_users
}
define service{
use generic-service
host_name 225
service_description 225-hda1
check_command check_nrpe!check_hda1
}
/usr/local/nagios/bin/nagios -v /etc/nagios/nagios.cfg 检查语法
yum install -y gcc glibc glibc-common gd gd-devel xinetd openssl-devel perl
yum -y install httpd php mysql-devel php-mysql
groupadd nagcmd
useradd -G nagcmd nagios
usermod -a -G nagcmd apache
date
tar zxvf nagios-3.4.3.tar.gz
cd nagios
./configure --sysconfdir=/etc/nagios --with-command-group=nagcmd --enable-event-broker
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf
htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
chkconfig --add nagios
chkconfig nagios on
service nagios start
#插件
tar zxvf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
service nagios restart
tar zxvf nrpe-2.13.tar.gz
cd nrpe-2.13
make all
make install-plugin
#被监控机
useradd -s /sbin/nologin nagios
tar zxvf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --with-nagios-user=nagios --with-nagios-group=nagios #如果mysql先装mysql
make
make install
tar zxvf nrpe-2.13.tar.gz
cd nrpe-2.13
./configure --with-nrpe-user=nagios --with-nrpe-group=nagios --with-nagios-user=nagios --with-nagios-group=nagios --enable-command-args --enable-ssl
make all
make install-plugin
make install-daemon
make install-daemon-config
cd /usr/local/nagios/etc/
vi usr/local/nagios/etc/nrpe.cfg 修改allowed_hosts
#启动加可到rc.local中
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
-------------------------------------------下面是检查
./check_nrpe -H 192.168.1.225
commands.cfg 主机上增加
# 'check_nrpe' command definition
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
object 目录下增加 225.cfg
define host{
use generic-host
host_name 225
alias 225
address 192.168.1.225 ;被测试机ip
max_check_attempts 10
check_command check-host-alive ; Default command to check if servers are "alive"
}
define service{
use generic-service
host_name 225
service_description 225-load
check_command check_nrpe!check_load
}
define service{
use generic-service
host_name 225
service_description 225-users
check_command check_nrpe!check_users
}
define service{
use generic-service
host_name 225
service_description 225-hda1
check_command check_nrpe!check_hda1
}
/usr/local/nagios/bin/nagios -v /etc/nagios/nagios.cfg 检查语法